source: buchla-68k/orig/RAM/INSTDSP.C@ 06ccda2

Last change on this file since 06ccda2 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

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