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

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

Fixed char array subscripts.

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