source: buchla-68k/ram/instdsp.c@ 0580615

Last change on this file since 0580615 was 0580615, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Point of no return.

  • Property mode set to 100644
File size: 23.7 KB
Line 
1/*
2 =============================================================================
3 instdsp.c -- instrument definition display driver and support functions
4 Version 181 -- 1988-10-06 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define D_EXECKI 0 /* debug execins() */
9
10#include "stddefs.h"
11#include "memory.h"
12
13#include "biosdefs.h"
14#include "charset.h"
15#include "fields.h"
16#include "fpu.h"
17#include "hwdefs.h"
18#include "vsdd.h"
19#include "vsddsw.h"
20#include "vsddvars.h"
21#include "graphdef.h"
22#include "smdefs.h"
23
24#include "midas.h"
25#include "instdsp.h"
26
27#define LSPCH 2 /* pitch source scale factor */
28#define MAXRAND (0x00FFFFFFL) /* largest random number */
29
30/* things defined elsewhere */
31
32extern void fpuint(void);
33extern unsigned setipl(unsigned arg);
34extern void cnvc2p(char *buf, short cv);
35
36extern unsigned tofpu(unsigned time);
37extern unsigned fromfpu(unsigned fputime);
38extern unsigned exp_c(unsigned c);
39
40extern char *dsimlt(char *buf, short src, short mltval);
41
42extern long rand24(void);
43
44/*
45
46*/
47
48extern short cxval, cyval, stcrow, stccol, initcfg;
49extern short curslim, idimsw;
50
51extern unsigned *obj0, *obj2;
52
53extern char bfs[], *srctbl[], sfdsp[];
54extern char vtlin1[], vtlin2[], vtlin3[];
55
56extern struct sment sments[];
57extern struct valent valents[];
58extern struct sment *vpsms[];
59
60extern short s_inst[], vce2trg[], vce2grp[];
61
62extern short curfunc; /* current function number */
63extern short curinst; /* current instrument number */
64extern short curpnt; /* current point number (absolute) */
65extern short curvce; /* current voice number */
66extern short idcfsw; /* copy / fetch menu switch */
67extern short idintmp; /* temporary for instrument number */
68extern short idnamsw; /* typewriter switch */
69extern short idsrcsw; /* source menu switch */
70extern short npts; /* number of points in function */
71extern short pecase; /* point edit case variable */
72extern short pntsv; /* point selection state variable */
73extern short subj; /* edited point number (relative) */
74extern short submenu; /* submenu cursor switch */
75extern short temax; /* time upper limit */
76extern short temin; /* time lower limit */
77extern short vlbtype; /* type of message window display */
78extern short wcflag; /* ws/cf menu type */
79extern short wcpage; /* ws/cf menu page */
80
81extern short instmod[12]; /* intrument data modified */
82
83extern unsigned *instob; /* instrument object pointer */
84
85extern struct octent *idoct; /* instrument display octent pointer */
86extern struct instpnt *pntptr; /* pointer to edited point */
87
88extern struct instdef idefs[NINST]; /* current instrument definitions */
89extern struct instdef vbufs[12]; /* voice instrument buffers */
90
91extern char *funcndx[256][2]; /* function header pointers */
92extern char *vlbptr[3]; /* variable label pointers */
93
94extern char idbuf[65]; /* display conversion work area */
95
96/*
97
98*/
99
100/* forward references */
101
102void idpoint(short x, short y, short pen);
103
104short idbox[][8] = { /* display box parameters */
105
106 { 1, 1, 84, 26, CFBX00, CBBX00, 0, 1}, /* 0: Freq 1 */
107 { 86, 1, 169, 26, CFBX01, CBBX01, 0, 11}, /* 1: Freq 2 */
108 {171, 1, 254, 26, CFBX02, CBBX02, 0, 22}, /* 2: Freq 3 */
109 {256, 1, 339, 26, CFBX03, CBBX03, 0, 33}, /* 3: Freq 4 */
110 {341, 1, 424, 26, CFBX04, CBBX04, 0, 44}, /* 4: Filter / Resonance */
111 {426, 1, 509, 26, CFBX05, CBBX05, 0, 54}, /* 5: Location */
112
113 { 1, 29, 84, 54, CFBX06, CBBX06, 2, 1}, /* 6: Index 1 */
114 { 86, 29, 169, 54, CFBX07, CBBX07, 2, 11}, /* 7: Index 2 */
115 {171, 29, 254, 54, CFBX08, CBBX08, 2, 22}, /* 8: Index 3 */
116 {256, 29, 339, 54, CFBX09, CBBX09, 2, 33}, /* 9: Index 4 */
117 {341, 29, 424, 54, CFBX10, CBBX10, 2, 44}, /* 10: Index 5 */
118 {426, 29, 509, 54, CFBX11, CBBX11, 2, 54}, /* 11: Index 6 */
119
120 { 1, 56, 509, 208, CFBX12, CBBX12, 4, 54}, /* 12: Level */
121
122 { 1, 210, 110, 236, CFBX13, CBBX13, 15, 1}, /* 13: Source- Mlt */
123 {112, 210, 142, 236, CFBX14, CBBX14, 15, 15}, /* 14: Pt */
124 {144, 210, 206, 236, CFBX15, CBBX15, 15, 19}, /* 15: Time */
125 {208, 210, 366, 236, CFBX16, CBBX16, 15, 27}, /* 16: Value */
126 {368, 210, 509, 236, CFBX17, CBBX17, 15, 47}, /* 17: Action */
127
128 { 1, 238, 131, 348, CFBX18, CBBX18, 17, 2}, /* 18: Configuration */
129 {133, 238, 267, 251, CFBX19, CBBX19, 17, 17}, /* 19: Voice & Inst */
130 {269, 238, 379, 306, CFBX20, CBBX20, 17, 35}, /* 20: Oscillators */
131 {381, 238, 509, 348, CFBX21, CBBX21, 17, 48}, /* 21: Waveshape */
132
133 {133, 308, 379, 348, CFBX22, CBBX22, 22, 17}, /* 22: (messages) */
134
135 {133, 252, 267, 306, CFBX23, CBBX23, 18, 17} /* 23: Name & comments */
136};
137
138/*
139
140*/
141
142/* instrument function to FPU function table */
143
144short fnoff[NFINST] = {
145
146 1, /* 0: Freq 1 */
147 3, /* 1: Freq 2 */
148 5, /* 2: Freq 3 */
149 7, /* 3: Freq 4 */
150 10, /* 4: Filter / Resonance */
151 4, /* 5: Location */
152 9, /* 6: Index 1 */
153 11, /* 7: Index 2 */
154 12, /* 8: Index 3 */
155 13, /* 9: Index 4 */
156 14, /* 10: Index 5 */
157 15, /* 11: Index 6 */
158 2 /* 12: Level */
159};
160
161short inspal[16][3] = { /* instrument display color palette */
162
163 {0, 0, 0}, /* 0 */
164 {3, 3, 3}, /* 1 */
165 {2, 2, 2}, /* 2 */
166 {3, 0, 0}, /* 3 */
167 {0, 3, 2}, /* 4 */
168 {0, 0, 1}, /* 5 */
169 {0, 1, 1}, /* 6 */
170 {1, 0, 1}, /* 7 */
171 {3, 2, 0}, /* 8 */
172 {1, 1, 2}, /* 9 */
173 {2, 3, 0}, /* 10 */
174 {2, 3, 3}, /* 11 */
175 {3, 0, 2}, /* 12 */
176 {0, 2, 3}, /* 13 */
177 {0, 3, 0}, /* 14 */
178 {3, 3, 0} /* 15 */
179};
180
181/*
182
183*/
184
185char *idbxlbl[] = { /* display box labels */
186
187 " Frq 1", /* 0 */
188 " Frq 2", /* 1 */
189 " Frq 3", /* 2 */
190 " Frq 4", /* 3 */
191 " Filtr", /* 4 */
192 " Loctn", /* 5 */
193 " Ind 1", /* 6 */
194 " Ind 2", /* 7 */
195 " Ind 3", /* 8 */
196 " Ind 4", /* 9 */
197 " Ind 5", /* 10 */
198 " Ind 6", /* 11 */
199 " Level", /* 12 */
200 "Source Mult", /* 13 */
201 "Pt", /* 14 */
202 "Time ", /* 15 */
203 "Value Source Mult", /* 16 */
204 "Conditioned Acts", /* 17 */
205 " Config #", /* 18 */
206 "Voice Inst", /* 19 */
207 "Oscillators", /* 20 */
208 "Wavshpe", /* 21 */
209 "", /* 22 */
210 "" /* 23 */
211};
212
213char idhlbl[] = /* main function time axis label */
214 " \324\302 \325\305 \326 \301 \302 \304 \310 \321\306 \323\302";
215
216
217char *osclbl[] = { /* oscillator mode labels */
218 /* NOTE: must match values in instdsp.h */
219
220 "Int", /* 0: OC_INT - Interval */
221 "Rat", /* 1: OC_RAT - Ratio */
222 "Frq", /* 2: OC_FRQ - Frequency */
223 "Pch" /* 3: OC_PCH - Pitch */
224};
225
226/*
227
228*/
229
230long rngdiv[] = { /* divisors for ranges of 0..9 */
231
232 MAXRAND, /* 0..0 */
233 MAXRAND / 2, /* 0..1 */
234 MAXRAND / 3, /* 0..2 */
235 MAXRAND / 4, /* 0..3 */
236 MAXRAND / 5, /* 0..4 */
237 MAXRAND / 6, /* 0..5 */
238 MAXRAND / 7, /* 0..6 */
239 MAXRAND / 8, /* 0..7 */
240 MAXRAND / 9, /* 0..8 */
241 MAXRAND / 10 /* 0..9 */
242};
243
244/*
245
246*/
247
248/*
249 =============================================================================
250 drawpt() -- draw a point as a cross
251 =============================================================================
252*/
253
254void drawpt(short px, short py, short pc)
255{
256 register short tmp;
257
258 tmp = px - 1;
259
260 if (tmp > 7)
261 idpoint(tmp, py, pc);
262
263 tmp = px + 1;
264
265 if (tmp < 509)
266 idpoint(tmp, py, pc);
267
268 tmp = py - 1;
269
270 if (tmp > 55)
271 idpoint(px, tmp, pc);
272
273 tmp = py + 1;
274
275 if (tmp < 196)
276 idpoint(px, tmp, pc);
277
278 idpoint(px, py, pc);
279}
280
281/*
282
283*/
284
285/*
286 =============================================================================
287 drawfn() -- draw a function
288 =============================================================================
289*/
290
291void drawfn(short fn, short how, short pen, short wn)
292{
293 struct idfnhdr *fp;
294 struct instdef *ip;
295 register struct instpnt *pt1, *pt2;
296 register short i, npt1, npt2, xp;
297 register unsigned color;
298 short np, ptx, pty, ptc;
299
300 ip = &vbufs[curvce];
301 fp = &ip->idhfnc[fn];
302 point = idpoint;
303
304 np = fp->idfpif; /* number of points in the function */
305 xp = subj; /* edit point */
306
307 npt1 = 0; /* left endpoint of line */
308 npt2 = 1; /* right endpoint of line */
309
310 pt1 = &ip->idhpnt[fp->idfpt1]; /* left endpoint of line */
311 pt2 = pt1 + 1; /* right endpoint of line */
312
313 color = exp_c(pen); /* replicate 4 bit 'pen' for 16 bit 'color' */
314
315/*
316
317*/
318 ptx = ttox(timeto(fn, npt1), wn);
319 pty = vtoy((pt1->ipval >> 5), wn);
320
321 ptc = how ? ID_SELD :
322 ((pt1->ipact OR pt1->ipvsrc) ?
323 ID_ACTP : ID_CPNT);
324
325 if (np EQ 1) { /* single point ? */
326
327 if (wn EQ 12)
328 drawpt(ptx, pty, ptc);
329 else
330 idpoint(ptx, pty, ptc);
331
332 return;
333 }
334
335 if (how AND (xp EQ 0))
336 if (wn EQ 12)
337 drawpt(ptx, pty, ID_SELD);
338 else
339 idpoint(ptx, pty, ID_SELD);
340
341 for (i = 1; i < np; i++) {
342
343 ptx = ttox(timeto(fn, npt2), wn);
344 pty = vtoy((pt2->ipval >> 5), wn);
345
346 ptc = (pt2->ipact OR pt2->ipvsrc) ?
347 ID_ACTP : ID_CPNT;
348
349 if (how AND (xp EQ (i - 1))) {
350
351
352 if (wn EQ 12)
353 drawpt(ptx, pty, ptc);
354 else
355 idpoint(ptx, pty, ptc);
356
357 } else if (how AND (xp EQ i)) {
358
359 ptc = ID_SELD;
360
361 if (wn EQ 12)
362 drawpt(ptx, pty, ptc);
363 else
364 idpoint(ptx, pty, ptc);
365/*
366
367*/
368 } else {
369
370 lseg(ttox(timeto(fn, npt1), wn),
371 vtoy((pt1->ipval >> 5), wn),
372 ptx, pty, color);
373
374 if (wn EQ 12) {
375
376 drawpt(ttox(timeto(fn, npt1), wn),
377 vtoy((pt1->ipval >> 5), wn),
378 (pt1->ipact OR pt1->ipvsrc) ?
379 ID_ACTP : ID_CPNT);
380
381 drawpt(ptx, pty, ptc);
382
383 } else {
384
385 idpoint(ttox(timeto(fn, npt1), wn),
386 vtoy((pt1->ipval >> 5), wn),
387 (pt1->ipact OR pt1->ipvsrc) ?
388 ID_ACTP : ID_CPNT);
389
390 idpoint(ptx, pty, ptc);
391 }
392 }
393
394 npt1++;
395 npt2++;
396 pt1++;
397 pt2++;
398 }
399
400 return;
401}
402
403/*
404
405*/
406
407/*
408 =============================================================================
409 addpch() -- add an offset to a pitch function value
410 =============================================================================
411*/
412
413short addpch(short p1, short p2)
414{
415 register long pl;
416
417 pl = ((((long)p1 >> 5) - 500L) << LSPCH) + (long)p2;
418
419 if (pl > PITCHMAX)
420 pl = PITCHMAX;
421
422 return((short)pl);
423}
424
425/*
426
427*/
428
429/*
430 =============================================================================
431 irand() -- develop a random number in a given range
432 =============================================================================
433*/
434
435short irand(short range)
436{
437 if (range LE 0) /* limit things to 'reasonable' values */
438 return(0);
439
440 if (range > 9) /* limit things to 'reasonable' values */
441 range = 9;
442
443 return((short)(rand24() / rngdiv[range]));
444}
445
446/*
447
448*/
449
450/*
451 =============================================================================
452 xgetran() -- develop a random number
453 =============================================================================
454*/
455
456short xgetran(short mlt)
457{
458 register short sltmp;
459
460 sltmp = (short)rand24();
461
462 if (mlt < 0)
463 sltmp += (short)rand24();
464
465 return(sltmp);
466}
467
468/*
469
470*/
471
472/*
473 =============================================================================
474 dosync() -- update sync and configuration register
475 =============================================================================
476*/
477
478void dosync(short vce)
479{
480 register short sync;
481 register struct instdef *ip;
482
483 ip = &vbufs[vce];
484 sync = ip->idhcfg << 8;
485
486 if (ip->idhos1c & OC_SYN)
487 sync |= 0x2000;
488
489 if (ip->idhos2c & OC_SYN)
490 sync |= 0x4000;
491
492 if (ip->idhos3c & OC_SYN)
493 sync |= 0x8000;
494
495 *(io_fpu + vce + (long)FPU_OCFG) = sync;
496}
497
498/*
499
500*/
501
502/*
503 =============================================================================
504 oscdsp() -- display an oscillator frequency specification
505 =============================================================================
506*/
507
508void oscdsp(short row, short val, short n, short frq, char *lbl)
509{
510 register short fh, fl;
511
512 tsplot4(instob, 64, idbox[n][4], row, 34, lbl, 14);
513 tsplot4(instob, 64, idbox[n][4], row, 36, osclbl[val & 3], 14);
514
515 switch (val & 3) {
516
517 case OC_INT: /* interval */
518
519 sprintf(idbuf, "%c%04d", (frq < 0 ? '-' : '+'),
520 ((frq < 0 ? -frq : frq) >> 1));
521
522 break;
523
524 case OC_RAT: /* ratio */
525
526 int2rat(frq >> 1);
527
528 ebflag = FALSE;
529
530 idbuf[0] = ebuf[0];
531 idbuf[1] = ebuf[1];
532 idbuf[2] = ebuf[2];
533 idbuf[3] = '\0';
534
535 break;
536
537 case OC_FRQ: /* frequency */
538
539 fh = (frq >> 1) / 10;
540 fl = (frq >> 1) - (fh * 10);
541
542 sprintf(idbuf, "%02d.%d ", fh, fl);
543 break;
544/*
545
546*/
547 case OC_PCH:
548
549 cnvc2p(idbuf, (frq >> 1));
550 idbuf[0] += '0';
551 idbuf[1] += 'A';
552 idbuf[2] = sfdsp[idbuf[2]];
553 idbuf[3] += '0';
554 idbuf[4] += '0';
555 idbuf[5] = '\0';
556 break;
557 }
558
559 tsplot4(instob, 64, idbox[n][4], row, 40, idbuf, 14);
560
561 if (row NE 21)
562 tsplot4(instob, 64, idbox[n][4], row, 46,
563 ((val & OC_SYN) ? "S" : "s"), 14);
564}
565
566/*
567
568*/
569
570/*
571 =============================================================================
572 pltws() -- plot a small waveshape display
573 =============================================================================
574*/
575
576void pltws(unsigned ws[], short pen)
577{
578 register short i, x, y;
579
580 for (i = 1; i < 254; i++) {
581
582 x = 382 + (i >> 1);
583 y = 348 - ((ws[i] ^ 0x8000) / 676);
584
585 idpoint(x, y, pen);
586 }
587}
588
589/*
590
591*/
592
593/*
594 =============================================================================
595 dswin() -- display a window
596 =============================================================================
597*/
598
599void dswin(short n)
600{
601 short th, tl, vh, vl, vv, mltval, lboff;
602 char *s1, mltstr[6], mltsgn;
603 long tt, sc;
604 register short cx, pnt, par;
605 register struct instdef *ip;
606 register struct idfnhdr *fp;
607 register struct instpnt *pp;
608
609 if (wcflag NE -1)
610 return;
611
612 if (idimsw AND (n NE 19) AND (n < 22))
613 return;
614
615 ip = &vbufs[curvce];
616
617 fp = &ip->idhfnc[n LE 12 ? n : curfunc];
618
619 curpnt = subj + fp->idfpt1;
620 pp = &ip->idhpnt[curpnt];
621
622 cx = idbox[n][5];
623 cx |= cx << 4;
624 cx |= cx << 8;
625
626/*
627
628*/
629
630 /* first, fill the box with the background color */
631
632 if (v_regs[5] & 0x0180)
633 vbank(0);
634
635 vbfill4(instob, 128, idbox[n][0], idbox[n][1], idbox[n][2], idbox[n][3], cx);
636
637 if (n < 12) /* draw the function if it's a label window */
638 drawfn(n, 0, ID_CLIN, n);
639
640 /* put in the box label */
641
642 if (n GT 12) {
643
644 tsplot4(instob, 64, idbox[n][4], idbox[n][6], idbox[n][7],
645 idbxlbl[n], 14);
646
647 } else {
648
649 tsplot4(instob, 64,
650 ((ip->idhfnc[n].idftmd & I_TM_KEY) ? idbox[n][4] : ID_INST),
651 idbox[n][6], idbox[n][7], idbxlbl[n], 14);
652 }
653
654/*
655
656*/
657 switch (n) { /* final text - overlays above stuff */
658
659 case 12: /* level */
660
661 /* x labels */
662
663 tsplot4(instob, 64, TGRID, 14, 0, idhlbl, 14);
664
665 /* y labels */
666
667 tsplot4(instob, 64, TGRID, 14, 0, "\300", 14);
668 tsplot4(instob, 64, TGRID, 12, 0, "\302", 14);
669 tsplot4(instob, 64, TGRID, 10, 0, "\304", 14);
670 tsplot4(instob, 64, TGRID, 8, 0, "\306", 14);
671 tsplot4(instob, 64, TGRID, 6, 0, "\310", 14);
672 tsplot4(instob, 64, TGRID, 4, 0, "\312", 14);
673
674 lseg( 7, 56, 7, 196, LGRID); /* draw the grid */
675 lseg( 7, 196, 509, 196, LGRID);
676
677 drawfn(12, 0, ID_CLIN, 12); /* draw the function */
678
679 return;
680
681 case 13: /* source - multiplier */
682
683 dsimlt(bfs, fp->idfsrc, fp->idfmlt);
684
685 tsplot4(instob, 64, idbox[n][4],
686 idbox[n][6]+1, idbox[n][7], bfs, 14);
687 return;
688
689 case 14: /* point number */
690
691 sprintf(bfs, "%02d", subj);
692
693 tsplot4(instob, 64, idbox[n][4], idbox[n][6]+1, idbox[n][7], bfs, 14);
694
695 return;
696/*
697
698*/
699 case 15: /* time */
700
701 sc = 1000L;
702 tt = timeto(curfunc, subj);
703 th = tt / sc;
704 tl = tt - (th * sc);
705
706 sprintf(bfs, "%02d.%03d", th, tl);
707 tsplot4(instob, 64, idbox[n][4], idbox[n][6] + 1,
708 idbox[n][7], bfs, 14);
709
710 return;
711
712 case 16: /* value */
713
714 vv = pp->ipval >> 5;
715 vh = vv / 100;
716 vl = vv - (vh * 100);
717
718 sprintf(bfs, "%02d.%02d ", vh, vl);
719
720 dsimlt(&bfs[6], pp->ipvsrc, pp->ipvmlt);
721
722 tsplot4(instob, 64, idbox[n][4], idbox[n][6] + 1,
723 idbox[n][7], bfs, 14);
724
725 return;
726
727/*
728
729*/
730 case 17: /* action */
731
732 pnt = pp->ippar1;
733 par = pp->ippar2;
734
735 switch (pp->ipact) {
736
737 case AC_NULL:
738
739 s1 = " ";
740 break;
741
742 case AC_SUST:
743
744 sprintf(bfs, "Pause if key %c ", SP_DNA);
745 s1 = bfs;
746 break;
747
748 case AC_ENBL:
749
750 sprintf(bfs, "Stop if key %c ", SP_UPA);
751 s1 = bfs;
752 break;
753
754 case AC_JUMP:
755
756 sprintf(bfs, "GoTo %02d forever ", pnt);
757 s1 = bfs;
758 break;
759
760/*
761
762*/
763 case AC_LOOP:
764
765 sprintf(bfs, "GoTo %02d %02d times", pnt, par);
766
767 if (bfs[8] EQ '9') /* random */
768 bfs[8] = 'R';
769
770 s1 = bfs;
771 break;
772
773 case AC_KYUP:
774
775 sprintf(bfs, "GoTo %02d if key %c",
776 pnt, SP_UPA);
777 s1 = bfs;
778 break;
779
780 case AC_KYDN:
781
782 sprintf(bfs, "GoTo %02d if key %c",
783 pnt, SP_DNA);
784 s1 = bfs;
785 break;
786
787 default:
788
789 s1 = "????????????????";
790 break;
791 }
792
793 tsplot4(instob, 64, idbox[n][4], idbox[n][6] + 1,
794 idbox[n][7], s1, 14);
795
796 return;
797
798/*
799
800*/
801
802 case 18: /* configuration */
803
804 showcfg(ip->idhcfg);
805 return;
806
807 case 19: /* voice & instrument */
808
809 sprintf(idbuf, "%02d", curvce + 1);
810 tsplot4(instob, 64, idbox[n][4], 17, 23, idbuf, 14);
811
812 sprintf(idbuf, "%02d", curinst);
813 tsplot4(instob, 64, (instmod[curvce] ? ID_CHGD :idbox[n][4]),
814 17, 31, idbuf, 14);
815
816 return;
817
818 case 20: /* oscillators */
819
820 oscdsp(18, ip->idhos1c, n, "1", ip->idhos1v);
821 oscdsp(19, ip->idhos2c, n, "2", ip->idhos2v);
822 oscdsp(20, ip->idhos3c, n, "3", ip->idhos3v);
823 oscdsp(21, ip->idhos4c, n, "4", ip->idhos4v);
824
825 return;
826
827 case 21: /* waveshapes */
828
829 sprintf(idbuf, "A%02d", ip->idhwsa + 1);
830 tsplot4(instob, 64, WSAFC, 17, 56, idbuf, 14);
831 pltws(ip->idhwvaf, WSAFC);
832
833 sprintf(idbuf, "B%02d", ip->idhwsb + 1);
834 tsplot4(instob, 64, WSBFC, 17, 60, idbuf, 14);
835 pltws(ip->idhwvbf, WSBFC);
836
837 return;
838/*
839
840*/
841 case 22: /* message window */
842
843 tsplot4(instob, 64, idbox[n][4], 22, 17, vlbptr[0], 14);
844 tsplot4(instob, 64, idbox[n][4], 23, 17, vlbptr[1], 14);
845 tsplot4(instob, 64, idbox[n][4], 24, 17, vlbptr[2], 14);
846
847 if (idsrcsw) {
848
849 point = idpoint;
850
851 lseg(196, 308, 196, 348, CBORD);
852 lseg(260, 308, 260, 348, CBORD);
853 lseg(324, 308, 324, 348, CBORD);
854 }
855
856 return;
857
858 case 23: /* Name and comments */
859
860 tsplot4(instob, 64, idbox[n][4], 18, 17, ip->idhname, 14);
861 tsplot4(instob, 64, idbox[n][4], 19, 17, ip->idhcom1, 14);
862 tsplot4(instob, 64, idbox[n][4], 20, 17, ip->idhcom2, 14);
863 tsplot4(instob, 64, idbox[n][4], 21, 17, ip->idhcom3, 14);
864
865 return;
866 }
867}
868
869/*
870
871*/
872
873/*
874 =============================================================================
875 allwins() -- display all windows
876 =============================================================================
877*/
878
879void allwins(void)
880{
881 register short i;
882
883 for (i = 0; i < 24; i++)
884 dswin(i);
885}
886
887/*
888 =============================================================================
889 idpoint() -- plot a point for the lseg function
890 =============================================================================
891*/
892
893void idpoint(short x, short y, short pen)
894{
895 if (v_regs[5] & 0x0180)
896 vbank(0);
897
898 vputp(idoct, x, y, pen);
899}
900
901/*
902
903*/
904
905/*
906 =============================================================================
907 idbord() -- draw the border for the instrument display
908 =============================================================================
909*/
910
911void idbord(void)
912{
913 point = idpoint;
914
915 lseg( 0, 0, 510, 0, CBORD); /* outer border */
916 lseg(510, 0, 510, 349, CBORD);
917 lseg(510, 349, 0, 349, CBORD);
918 lseg( 0, 349, 0, 0, CBORD);
919
920 lseg( 0, 27, 510, 27, CBORD); /* label widows - H lines */
921 lseg( 0, 55, 510, 55, CBORD);
922
923 lseg( 85, 1, 85, 54, CBORD); /* label windows - V lines */
924 lseg(170, 1, 170, 54, CBORD);
925 lseg(255, 1, 255, 54, CBORD);
926 lseg(340, 1, 340, 54, CBORD);
927 lseg(425, 1, 425, 54, CBORD);
928
929 lseg( 0, 209, 510, 209, CBORD); /* S/M, Time, Val - H lines */
930 lseg( 0, 237, 510, 237, CBORD);
931
932 lseg(111, 210, 111, 236, CBORD); /* S/M, Time, Val - V lines */
933 lseg(143, 210, 143, 236, CBORD);
934 lseg(207, 210, 207, 236, CBORD);
935 lseg(367, 210, 367, 236, CBORD);
936
937 lseg(132, 238, 132, 349, CBORD); /* Voice, Osc, Vars */
938 lseg(380, 238, 380, 349, CBORD);
939 lseg(132, 307, 380, 307, CBORD);
940 lseg(268, 238, 268, 306, CBORD);
941}
942
943/*
944
945*/
946
947/*
948 =============================================================================
949 idvlblc() -- clear the message window
950 =============================================================================
951*/
952
953void idvlblc(void)
954{
955 vlbtype = 0; /* nothing in the message window */
956
957 vlbptr[0] = vlbptr[1] = vlbptr[2] = " ";
958}
959
960/*
961 =============================================================================
962 idvlbld() -- put the labels in the message window
963 =============================================================================
964*/
965
966void idvlbld(void)
967{
968 vlbtype = 1; /* variable labels */
969
970/* "123456789012345678901234567890" */
971
972 vlbptr[0] = "PchW/HT Pch/Frq Random GPC/V1";
973 vlbptr[1] = "ModW/VT Key Vel Pedal 1 ";
974 vlbptr[2] = "Brth/LP Key Prs ";
975}
976
977/*
978
979*/
980
981/*
982 =============================================================================
983 idvtyp() -- display the virtual typewriter in the message window
984 =============================================================================
985*/
986
987void idvtyp(void)
988{
989 vlbtype = 2; /* virtual typewriter */
990
991 vlbptr[0] = vtlin1;
992 vlbptr[1] = vtlin2;
993 vlbptr[2] = vtlin3;
994}
995
996/*
997 =============================================================================
998 idcpfch() -- display the copy / fetch menu in the message window
999 =============================================================================
1000*/
1001
1002void idcpfch(void)
1003{
1004 vlbtype = 3; /* copy / fetch menu */
1005
1006/* "123456789012345678901234567890" */
1007
1008 vlbptr[0] = "Fetch from library Escape ";
1009 vlbptr[1] = "Copy to library ";
1010 vlbptr[2] = " ";
1011}
1012
1013/*
1014
1015*/
1016
1017/*
1018 =============================================================================
1019 instdsp() -- put up the instrument display
1020 =============================================================================
1021*/
1022
1023void instdsp(void)
1024{
1025 register struct instdef *ip;
1026 register struct idfnhdr *fp;
1027
1028 instob = &v_score[0]; /* setup object pointer */
1029 idoct = &v_obtab[INSTOBJ]; /* setup object control table pointer */
1030 obj0 = &v_curs0[0]; /* setup cursor object pointer */
1031 obj2 = &v_tcur[0]; /* setup typewriter cursor pointer */
1032
1033 idnamsw = FALSE; /* typewriter not up */
1034 idsrcsw = FALSE; /* source menu not up */
1035 idcfsw = FALSE; /* copy / fetch menu not up */
1036 idimsw = FALSE; /* instrument menu not up */
1037 submenu = FALSE; /* submenu cursor not enabled */
1038 wcflag = -1; /* no menu page up */
1039 wcpage = 0; /* initial ws/cf page */
1040
1041 setinst(); /* setup editing variables */
1042
1043 dswap(); /* initialize display */
1044
1045 vbank(0); /* clear the display */
1046 memsetw(instob, 0, 32767);
1047 memsetw(instob+32767L, 0, 12033);
1048
1049 SetObj(INSTOBJ, 0, 0, instob, 512, 350, 0, 0, INSTFL, -1);
1050 SetObj(0, 0, 1, obj0, 16, 16, ICURX, ICURY, OBFL_00, -1);
1051 SetObj(TTCURS, 0, 1, obj2, 16, 16, 0, 0, TTCCFL, -1);
1052
1053 arcurs(ID_NCUR); /* setup arrow cursor object */
1054 itcini(ID_TCUR); /* setup text cursor object */
1055 ttcini(ID_TCUR); /* setup typewriter cursor object */
1056
1057 vbank(0);
1058 idbord(); /* draw the border */
1059 idvlblc(); /* no initial label */
1060 allwins(); /* fill in the windows */
1061
1062 SetPri(INSTOBJ, INSTPRI);
1063 SetPri(0, GCPRI); /* display the graphic cursor */
1064
1065 setgc(ICURX, ICURY);
1066
1067 vsndpal(inspal); /* set the palette */
1068}
1069
1070/*
1071
1072*/
1073
1074/*
1075 =============================================================================
1076 reshowi() -- redisplay the instrument
1077 =============================================================================
1078*/
1079
1080void reshowi(void)
1081{
1082 idfield(); /* fix up field table, etc. */
1083
1084 wcflag = -1; /* no menu page up */
1085 wcpage = 0; /* first page of waveshapes */
1086
1087 dswap(); /* initialize display */
1088
1089 vbank(0); /* clear the display */
1090 memsetw(instob, 0, 32767);
1091 memsetw(instob+32767L, 0, 12033);
1092
1093 SetObj(INSTOBJ, 0, 0, instob, 512, 350, 0, 0, INSTFL, -1);
1094 SetObj(0, 0, 1, obj0, 16, 16, ICURX, ICURY, OBFL_00, -1);
1095 SetObj(TTCURS, 0, 1, obj2, 16, 16, 0, 0, TTCCFL, -1);
1096
1097 arcurs(ID_NCUR); /* setup arrow cursor object */
1098 itcini(ID_TCUR); /* setup text cursor object */
1099 ttcini(ID_TCUR); /* setup typewriter cursor object */
1100
1101 vbank(0);
1102 idbord(); /* draw the border */
1103 idvlblc(); /* no initial label */
1104 allwins(); /* fill in the windows */
1105
1106 SetPri(INSTOBJ, INSTPRI);
1107 SetPri(0, GCPRI); /* enable the cursor */
1108
1109 if (cyval > curslim)
1110 settc(stcrow, stccol);
1111 else
1112 setgc(cxval, cyval);
1113
1114 vsndpal(inspal); /* set the palette */
1115}
Note: See TracBrowser for help on using the repository browser.