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

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

Prototypes for global function pointers. Consistent global types.

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