source: buchla-68k/ram/lcdlbls.c@ f4fbee9

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

Code compiles, doesn't link.

  • Property mode set to 100644
File size: 39.1 KB
Line 
1/*
2 =============================================================================
3 lcdlbls.c -- MIDAS-VII front panel support functions
4 Version 48 -- 1989-12-19 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define ROMPOK 1 /* non-zero enables the ROMP switch */
9
10#include "stddefs.h"
11#include "biosdefs.h"
12#include "graphdef.h"
13#include "glcfns.h"
14#include "glcdefs.h"
15#include "lcdline.h"
16#include "vsdd.h"
17#include "vsddvars.h"
18#include "hwdefs.h"
19#include "memory.h"
20#include "cmeta.h"
21#include "fields.h"
22#include "fpu.h"
23#include "macros.h"
24#include "panel.h"
25#include "patch.h"
26#include "smdefs.h"
27#include "sclock.h"
28
29#include "midas.h"
30#include "instdsp.h"
31#include "libdsp.h"
32#include "score.h"
33#include "scdsp.h"
34#include "scfns.h"
35
36#define ARTIVAL(x) (x << 5)
37#define SL2GAIN(x) (sl2gain[(x >> 11) + 16])
38
39#if ROMPOK
40#define ROMPFN trapper /* ROMP switch table entry */
41#else
42#define ROMPFN nokey /* ROMP switch table entry */
43#endif
44
45#define PCHMAX 21920L /* maximum pitch value */
46
47/*
48
49*/
50extern char gain2eq();
51
52extern short nokey();
53extern short setsr();
54
55extern short (*d_key)();
56extern short (*e_key)();
57extern short (*m_key)();
58extern short (*x_key)();
59extern short (*olddkey)();
60extern short (*oldekey)();
61extern short (*oldmkey)();
62extern short (*oldxkey)();
63extern short (*point)();
64
65extern PFS (*oldsw)[];
66extern PFS (*swpt)[];
67
68extern PFS aswtbl[14];
69
70extern short asig;
71extern short asmode;
72extern short astat;
73extern short aval;
74extern short clkrun;
75extern short ctrsw;
76extern short curasg;
77extern short gomode;
78extern short ismode;
79extern short lampio;
80extern short lampsw;
81extern short loadrow;
82extern short loadsw;
83extern short ltagged;
84extern short ndisp;
85extern short oldpk;
86extern short oldsl;
87extern short pkctrl;
88extern short recsw;
89extern short sliders;
90extern short tagslot;
91extern short tmpomlt;
92extern short tmpoval;
93extern short tuneval;
94
95extern unsigned short seqdupd;
96
97extern short BGeq[];
98extern short BGother[];
99extern short BGprmtr[];
100
101extern short articen[];
102extern short grpmode[];
103extern short grpsel[];
104extern short grpstat[];
105extern short ins2grp[];
106extern short lastart[];
107extern short s_trns[];
108extern short vce2grp[];
109extern short vce2trg[];
110
111extern short anrs[][16];
112
113extern long iotime;
114extern long lcdontm;
115extern long lcdtime;
116
117extern struct gdsel *gdstbc[];
118
119extern struct valent valents[];
120
121/*
122
123*/
124
125/* forward references */
126
127short l_prmtr(), l_other(), l_voice(), l_init(), l_clock(), l_eq();
128short trapper(), setlamp(), rpctl(), quiet();
129short l_group(), l_dflt(), l_inst(), l_goto(), l_asgn(), l_adfl(), l_load();
130
131/* initialized stuff */
132
133/* BarType -- LCD slider bar graph type table -- 0 = bottom, 1 = centered */
134
135short BarType[14] = { 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0 };
136
137short artitab[] = { /* articulation pot initialization values */
138
139 ARTIVAL(500), /* locn */
140 ARTIVAL(0), /* level */
141 ARTIVAL(0), /* ind 1 */
142 ARTIVAL(0), /* ind 2 */
143 ARTIVAL(0), /* ind 3 */
144 ARTIVAL(500), /* frq 1 */
145 ARTIVAL(500), /* frq 2 */
146 ARTIVAL(500), /* frq 3 */
147 ARTIVAL(500), /* frq 4 */
148 ARTIVAL(0), /* ind 4 */
149 ARTIVAL(0), /* ind 5 */
150 ARTIVAL(0), /* ind 6 */
151 ARTIVAL(500), /* filtr */
152 ARTIVAL(0) /* reson */
153};
154
155/* arpar[] -- articulation parameter map */
156/* sigtab[ 25 26 27 28 29 30 31 32 33 34 35 36 37 38] */
157
158short arpar[] = { 4, 2, 9, 11, 12, 1, 3, 5, 7, 13, 14, 15, 10, 6};
159
160/*
161
162*/
163
164short sl2gain[32] = { /* slider value to EQ gain conversion table */
165
166 -12, -12, -12, -12, -12, -11, -10, -9 ,-8 ,-7, -6, -5, -4, -3, -2, -1,
167 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12, 12, 12
168};
169
170short vmasks[16] = { /* variable resolution masks */
171
172 0x8000, 0xC000, 0xE000, 0xF000,
173 0xF800, 0xFC00, 0xFE00, 0xFF00,
174 0xFF80, 0xFFC0, 0xFFE0, 0xFFF0,
175 0xFFF8, 0xFFFC, 0xFFFE, 0xFFFF
176};
177
178short src2var[14] = { /* source number to analog variable number map */
179
180 -1, -1, 3, -1, -1, -1, 5, -1, 4, -1, -1, 0, 1, 2 };
181
182char *potlbls[] = { /* LCD pot labels */
183
184 /* Pot: 25 26 27 28 29 30 31 32 33 34 35 36 37 38 */
185
186 /* 0 */ "Locn Level Ind 1 Ind 2 Ind 3 Frq 1 Frq 2 Frq 3 Frq 4 Ind 4 Ind 5 Ind 6 Filtr Reson",
187 /* 1 */ "Locn Level Ind 1 Ind 2 Ind 3 Frq 1 Frq 2 Frq 3 Frq 4 Ind 4 Ind 5 Ind 6 Filtr Reson",
188 /* 2 */ " Aux Depth Rate Inten CV 1 CV 2 CV 3 CV 4 ",
189 /* 3 */ " 50 150 400 1k 2.5k 6k 15k 50 150 400 1k 2.5k 6k 15k ",
190 /* 4 */ "Locn Level Ind 1 Ind 2 Ind 3 Frq 1 Frq 2 Frq 3 Frq 4 Ind 4 Ind 5 Ind 6 Filtr Reson",
191 /* 5 */ "Locn Level Ind 1 Ind 2 Ind 3 Frq 1 Frq 2 Frq 3 Frq 4 Ind 4 Ind 5 Ind 6 Filtr Reson",
192 /* 6 */ "Locn Level Ind 1 Ind 2 Ind 3 Frq 1 Frq 2 Frq 3 Frq 4 Ind 4 Ind 5 Ind 6 Filtr Reson",
193 /* 7 */ "Locn Level Ind 1 Ind 2 Ind 3 Frq 1 Frq 2 Frq 3 Frq 4 Ind 4 Ind 5 Ind 6 Filtr Reson"
194};
195
196#if ROMPOK
197char *swtlbls[] = { /* LCD switch labels -- ROMP ENABLED */
198
199 /* 0 */ "Quiet ROMP Lamp Clock P/R Go To Instr Asgmt Load Other Voice Init ",
200 /* 1 */ " Voice Init ",
201 /* 2 */ "Quiet ROMP Lamp Clock P/R Go To Instr Asgmt Load EQ Voice Init ",
202 /* 3 */ "Quiet ROMP Lamp Clock P/R Go To Instr Asgmt Load Prmtr Voice Init ",
203 /* 4 */ " +00 Deflt",
204 /* 5 */ "Quiet ROMP Lamp Clock P/R Go To Instr Asgmt Load Other Voice Deflt",
205 /* 6 */ "Quiet ROMP Lamp Clock P/R ",
206 /* 7 */ "Quiet ROMP Lamp Load "
207};
208#else
209char *swtlbls[] = { /* LCD switch labels -- ROMP DISABLED */
210
211 /* 0 */ "Quiet Lamp Clock P/R Go To Instr Asgmt Load Other Voice Init ",
212 /* 1 */ " Voice Init ",
213 /* 2 */ "Quiet Lamp Clock P/R Go To Instr Asgmt Load EQ Voice Init ",
214 /* 3 */ "Quiet Lamp Clock P/R Go To Instr Asgmt Load Prmtr Voice Init ",
215 /* 4 */ " +00 Deflt",
216 /* 5 */ "Quiet Lamp Clock P/R Go To Instr Asgmt Load Other Voice Deflt",
217 /* 6 */ "Quiet Lamp Clock P/R ",
218 /* 7 */ "Quiet Lamp Load "
219};
220#endif
221
222char *aslbls[] = { /* Assignment select key labels */
223
224 "Asgmt", /* 0 */
225 " +00 ", /* 1 */
226 " +20 ", /* 2 */
227 " +40 ", /* 3 */
228 " +60 ", /* 4 */
229 " +80 " /* 5 */
230};
231
232/*
233
234*/
235
236PFS t_prmtr[] = { /* switch assignments for LS_PRMTR */
237
238 quiet, /* 0: Quiet */
239 ROMPFN, /* 1: ROMP */
240
241 setlamp, /* 2: Lamp */
242 l_clock, /* 3: Clock */
243 rpctl, /* 4: R/P */
244
245 l_goto, /* 5: Go To */
246 l_inst, /* 6: Instr */
247 l_asgn, /* 7: Asgmt */
248 l_load, /* 8: Load */
249
250 nokey, /* 9: -unused- */
251 nokey, /* 10: -unused- */
252 l_other, /* 11: Other */
253
254 l_prmtr, /* 12: Prmtr */
255 l_init /* 13: Init */
256};
257
258PFS t_voice[] = { /* switch assignments for LS_VOICE */
259
260 l_voice, /* 0: toggle voice status */
261 l_voice, /* 1: toggle voice status */
262
263 l_voice, /* 2: toggle voice status */
264 l_voice, /* 3: toggle voice status */
265 l_voice, /* 4: toggle voice status */
266
267 l_voice, /* 5: toggle voice status */
268 l_voice, /* 6: toggle voice status */
269 l_voice, /* 7: toggle voice status */
270 l_voice, /* 8: toggle voice status */
271
272 l_voice, /* 9: toggle voice status */
273 l_voice, /* 10: toggle voice status */
274 l_voice, /* 11: toggle voice status */
275
276 l_prmtr, /* 12: Prmtr */
277 l_init /* 13: Init */
278};
279
280/*
281
282*/
283
284PFS t_other[] = { /* switch assignments for LS_OTHER */
285
286 quiet, /* 0: Quiet */
287 ROMPFN, /* 1: ROMP */
288
289 setlamp, /* 2: Lamp */
290 l_clock, /* 3: Clock */
291 rpctl, /* 4: R/P */
292
293 l_goto, /* 5: Go To */
294 l_inst, /* 6: Instr */
295 l_asgn, /* 7: Asgmt */
296 l_load, /* 8: Load */
297
298 nokey, /* 9: -unused- */
299 nokey, /* 10: -unused- */
300 l_eq, /* 11: EQ */
301
302 l_prmtr, /* 12: Prmtr */
303 l_init /* 13: Init */
304};
305
306PFS t_eq[] = { /* switch assignments for LS_EQ */
307
308 quiet, /* 0: Quiet */
309 ROMPFN, /* 1: ROMP */
310
311 setlamp, /* 2: Lamp */
312 l_clock, /* 3: Clock */
313 rpctl, /* 4: R/P */
314
315 l_goto, /* 5: Go To */
316 l_inst, /* 6: Instr */
317 l_asgn, /* 7: Asgmt */
318 l_load, /* 8: Load */
319
320 nokey, /* 9: -unused- */
321 nokey, /* 10: -unused- */
322 l_eq, /* 11: Prmtr */
323
324 l_prmtr, /* 12: Voice */
325 l_init /* 13: Init */
326};
327
328/*
329
330*/
331
332PFS t_inst[] = { /* switch assignments for LS_INST */
333
334 l_group, /* 0: toggle group status */
335 l_group, /* 1: toggle group status */
336
337 l_group, /* 2: toggle group status */
338 l_group, /* 3: toggle group status */
339 l_group, /* 4: toggle group status */
340
341 l_group, /* 5: toggle group status */
342 l_group, /* 6: toggle group status */
343 l_group, /* 7: toggle group status */
344 l_group, /* 8: toggle group status */
345
346 l_group, /* 9: toggle group status */
347 l_group, /* 10: toggle group status */
348 l_group, /* 11: toggle group status */
349
350 l_inst, /* 12: 01-20 / 21-40 */
351 l_dflt /* 13: Deflt */
352};
353
354PFS t_libr[] = { /* switch assignments for LS_LIBR */
355
356 quiet, /* 0: Quiet */
357 ROMPFN, /* 1: ROMP */
358
359 setlamp, /* 2: Lamp */
360 l_clock, /* 3: Clock */
361 rpctl, /* 4: R/P */
362
363 nokey, /* 5: -unused- */
364 nokey, /* 6: -unused- */
365 nokey, /* 7: -unused- */
366 nokey, /* 8: -unused- */
367
368 nokey, /* 9: -unused- */
369 nokey, /* 10: -unused- */
370 nokey, /* 11: -unused- */
371
372 nokey, /* 12: -unused- */
373 nokey /* 13: -unused- */
374};
375
376/*
377
378*/
379
380PFS t_ngrp[] = { /* switch assignments for LS_NGRP */
381
382 quiet, /* 0: Quiet */
383 ROMPFN, /* 1: ROMP */
384
385 setlamp, /* 2: Lamp */
386 l_clock, /* 3: Clock */
387 rpctl, /* 4: R/P */
388
389 nokey, /* 5: -unused- */
390 nokey, /* 6: -unused- */
391 nokey, /* 7: -unused- */
392 nokey, /* 8: -unused- */
393
394 nokey, /* 9: -unused- */
395 nokey, /* 10: -unused- */
396 nokey, /* 11: -unused- */
397
398 nokey, /* 12: -unused- */
399 nokey /* 13: -unused- */
400};
401
402PFS t_load[] = { /* switch assignments for LS_LOAD */
403
404 quiet, /* 0: Quiet */
405 ROMPFN, /* 1: ROMP */
406
407 setlamp, /* 2: Lamp */
408 nokey, /* 3: -unused- */
409 nokey, /* 4: -unused- */
410
411 nokey, /* 5: -unused- */
412 nokey, /* 6: -unused- */
413 nokey, /* 7: -unused- */
414 l_load, /* 8: Load */
415
416 nokey, /* 9: -unused- */
417 nokey, /* 10: -unused- */
418 nokey, /* 11: -unused- */
419
420 nokey, /* 12: -unused- */
421 nokey /* 13: -unused- */
422};
423
424/*
425
426*/
427
428/*
429 =============================================================================
430 quiet() -- quiet the instrument
431 =============================================================================
432*/
433
434short
435quiet()
436{
437 register short vce;
438
439 for (vce = 0; vce < 12; vce++) /* for each voice ... */
440 sendval(vce, 2, 0); /* ... set level = 0 */
441
442 memsetw(seqflag, 0, 16); /* stop the sequences */
443 memsetw(seqtime, 0, 16); /* ... */
444
445 memsetw(trstate, 0, 16); /* reset the triggers */
446
447 seqdupd = 0xFFFF; /* request display update */
448
449 stmproc(NULL_DEF); /* trigger the blank definer */
450}
451
452/*
453 =============================================================================
454 rpctl() -- toggle record/play switch
455 =============================================================================
456*/
457
458short
459rpctl(stat)
460short stat;
461{
462 if (NOT stat)
463 return;
464
465 recsw = NOT recsw;
466 dsrpmod();
467}
468
469/*
470
471*/
472
473/*
474 =============================================================================
475 trapper() -- trap to ROMP
476 =============================================================================
477*/
478
479short
480trapper(stat)
481short stat;
482{
483 if (stat)
484 xtrap15();
485}
486
487/*
488 =============================================================================
489 l_clock() -- process 'Clock' switch
490 =============================================================================
491*/
492
493short
494l_clock(stat)
495short stat;
496{
497 if (NOT stat)
498 return;
499
500 clkset(NOT clkrun);
501 dclkmd();
502}
503
504/*
505 =============================================================================
506 ulamp() -- underline lamp if forced on
507 =============================================================================
508*/
509
510ulamp()
511{
512 if ((sliders EQ LS_VOICE) OR (sliders EQ LS_INST))
513 return;
514
515 point = GLCplot; /* setup to draw line */
516 GLCcurs(G_ON);
517
518 if (lampsw)
519 lseg (LAMP_XL, LAMP_Y, LAMP_XR, LAMP_Y, 1);
520 else
521 lseg (LAMP_XL, LAMP_Y, LAMP_XR, LAMP_Y, 0);
522
523 GLCcurs(G_OFF);
524}
525
526/*
527
528*/
529
530/*
531 =============================================================================
532 preio() -- turn off LCD backlight before disk I/O
533 =============================================================================
534*/
535
536preio()
537{
538 short oldipl;
539
540 oldipl = setipl(TIM_DI);
541
542 lampio = lampsw;
543 iotime = lcdtime;
544 lampsw = FALSE;
545 io_leds = 0x1F;
546
547 setipl(oldipl);
548}
549
550/*
551 =============================================================================
552 postio() -- restore LCD backlight state after disk I/O
553 =============================================================================
554*/
555
556postio()
557{
558 short oldipl;
559
560 oldipl = setipl(TIM_DI);
561
562 lampsw = lampio;
563
564 if (iotime OR lampsw) {
565
566 lcdtime = lcdontm;
567 io_leds = 0x9F;
568 }
569
570 setipl(oldipl);
571}
572
573/*
574
575*/
576
577/*
578 =============================================================================
579 setlamp() -- toggle LCD backlight mode
580 =============================================================================
581*/
582
583short
584setlamp(stat)
585{
586 register short oldi;
587
588 if (NOT stat) /* only act on key closures */
589 return;
590
591 oldi = setipl(TIM_DI); /* disable interrupts to keep out the timer */
592
593 lcdtime = lcdontm; /* set the LCD backlight timer */
594
595 if (lampsw) {
596
597 lampsw = FALSE; /* enable LCD timeouts */
598 io_leds = 0x1F; /* turn off the LCD backlight */
599
600 } else {
601
602 lampsw = TRUE; /* disable LCD timeouts */
603 io_leds = 0x9F; /* turn on the LCD backlight */
604 }
605
606 setipl(oldi); /* turn interrupts back on */
607
608 ulamp(); /* update underline on lamp key label */
609}
610
611/*
612 =============================================================================
613 lcd_on() -- turn on the LCD backlight
614 =============================================================================
615*/
616
617lcd_on()
618{
619 register short oldi;
620
621 oldi = setipl(TIM_DI); /* disable interrupts to keep out the timer */
622
623 lcdtime = lcdontm; /* set the LCD backlight timer */
624 io_leds = 0x9F; /* turn on the LCD backlight */
625
626 setipl(oldi); /* turn interrupts back on */
627}
628
629/*
630
631*/
632
633/*
634 =============================================================================
635 loadkey() -- process data keys in load mode
636 =============================================================================
637*/
638
639loadkey(key)
640short key;
641{
642 if (NOT astat)
643 return;
644
645 if (loadsw) { /* if it's load time */
646
647 if (key < 7) { /* ... and the key is valid */
648
649 loadem(key + 'A'); /* ... load the files */
650
651 loadsw = FALSE;
652 ltagged = FALSE;
653 d_key = olddkey;
654 x_key = oldxkey;
655 e_key = oldekey;
656 m_key = oldmkey;
657 pkctrl = oldpk;
658 sliders = oldsl;
659 swpt = oldsw;
660 lcdlbls();
661 }
662
663 return;
664 }
665}
666
667/*
668
669*/
670
671/*
672 =============================================================================
673 pcancel() -- cancel panel modes
674 =============================================================================
675*/
676
677pcancel(pm)
678short pm;
679{
680 point = GLCplot; /* setup to plot on LCD */
681 GLCcurs(G_ON);
682
683 if ((pm NE 0) AND asmode) {
684
685 /* cancel assignment mode */
686
687 asmode = 0;
688 pkctrl = oldpk;
689 swpt = oldsw;
690 lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 0);
691 }
692
693 if ((pm NE 1) AND (gomode NE GO_NULL)) {
694
695 /* cancel Go To mode */
696
697 gomode = GO_NULL;
698 pkctrl = oldpk;
699 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
700 }
701
702 if ((pm NE 2) AND (ismode NE IS_NULL)) {
703
704 /* cancel instrument select mode */
705
706 ismode = IS_NULL;
707 pkctrl = oldpk;
708 sliders = oldsl;
709 swpt = oldsw;
710 lcdlbls();
711 }
712
713 GLCcurs(G_OFF);
714 setleds();
715}
716
717/*
718
719*/
720
721/*
722 =============================================================================
723 l_load() -- process "Load" key
724 =============================================================================
725*/
726
727short
728l_load(stat)
729short stat;
730{
731 if (NOT stat)
732 return;
733
734 pcancel(3); /* cancel panel selections */
735 lcancel(3); /* cancel librarian selections */
736
737 point = GLCplot; /* setup to plot on LCD */
738 GLCcurs(G_ON);
739
740 if (loadsw) { /* if load is selected, deselect */
741
742 d_key = olddkey;
743 e_key = oldekey;
744 m_key = oldmkey;
745 x_key = oldxkey;
746
747 pkctrl = oldpk;
748 sliders = oldsl;
749 swpt = oldsw;
750
751 loadsw = FALSE;
752
753 lcdlbls();
754/*
755
756*/
757 } else { /* setup for load mode */
758
759 clkset(0); /* stop the clock */
760
761 if (ltagged) { /* cancel tag mode */
762
763 dslslot(tagslot, exp_c(LCFBX01), loadrow);
764 ltagged = FALSE;
765 }
766
767 if ((pkctrl EQ PK_PFRM) OR (pkctrl EQ PK_NOTE))
768 oldpk = pkctrl;
769
770 if (sliders NE LS_LOAD)
771 oldsl = sliders;
772
773 pkctrl = PK_LOAD;
774 sliders = LS_LOAD;
775 oldsw = swpt;
776 swpt = t_load;
777
778 olddkey = d_key;
779 oldxkey = x_key;
780 oldekey = e_key;
781 oldmkey = m_key;
782 d_key = loadkey;
783 x_key = l_load;
784 e_key = l_load;
785 m_key = l_load;
786
787 loadsw = TRUE;
788
789 lcdlbls();
790 lseg(LOAD_XL, LOAD_Y, LOAD_XR, LOAD_Y, 1);
791 }
792
793 GLCcurs(G_OFF);
794 setleds();
795}
796
797/*
798
799*/
800
801/*
802 =============================================================================
803 lcdlbls() -- put up the labels on the LCD display
804 =============================================================================
805*/
806
807lcdlbls()
808{
809 register short i, barval;
810 char buf[8];
811 char dsp[86];
812
813 point = GLCplot; /* set up to plot on the LCD */
814
815 GLCinit(); /* clear the LCD display */
816 GLCcurs(G_ON);
817
818 /* label the switches */
819
820 switch (sliders) {
821
822 case LS_PRMTR: /* parameter articulation */
823 case LS_OTHER: /* other stuff */
824 case LS_EQ: /* equalization */
825
826 GLCtext(0, 1, swtlbls[sliders]);
827
828 switch (gomode) {
829
830 case GO_SECT:
831
832 GLCtext(0, 31, "Sectn");
833 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 1);
834 break;
835
836 case GO_SCOR:
837
838 GLCtext(0, 31, "Score");
839 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 1);
840 break;
841
842 default:
843
844 GLCtext(0, 31, "Go To");
845 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
846 break;
847 }
848
849 break;
850/*
851
852*/
853 case LS_VOICE: /* voice selection */
854
855 dsp[0] = '\0';
856
857 for (i = 0; i < 12; i++) {
858
859 sprintf(buf, "%c%2d %c ",
860 (articen[i] ? '\176' : ' '), i + 1,
861 (articen[i] ? '\177' : ' '));
862
863 strcat(dsp, buf);
864 }
865
866 strcat(dsp, "Voice Init ");
867
868 GLCtext(0, 1, dsp);
869 break;
870
871 case LS_INST: /* instrument selection */
872
873 dsp[0] = '\0';
874
875 for (i = 0; i < 12; i++) {
876
877 sprintf(buf, "%c%2d %c ",
878 (grpsel[i] ? '\176' : ' '), i + 1,
879 (grpsel[i] ? '\177' : ' '));
880
881 strcat(dsp, buf);
882 }
883
884 if (ismode EQ IS_HORC)
885 strcat(dsp, " +20 "); /* hi orc */
886 else
887 strcat(dsp, " +00 "); /* lo orc */
888
889 strcat(dsp, " Deflt");
890
891 GLCtext(0, 1, dsp);
892 break;
893
894 case LS_LIBR:
895 case LS_NGRP:
896 case LS_LOAD:
897
898 GLCtext(0, 1, swtlbls[sliders]);
899 break;
900 }
901
902/*
903
904*/
905 GLCtext(7, 1, potlbls[sliders]); /* label the pots */
906
907 for (i = 0; i < 13; i++)
908 lseg(39 + (i * 36), 0, 39 + (i * 36), 63, 1);
909
910 switch (sliders) { /* draw the slider bars */
911
912 case LS_PRMTR: /* parameter articulation */
913 case LS_VOICE: /* voice articulation enable */
914 case LS_INST: /* instrument select */
915 case LS_LIBR: /* library select */
916 case LS_NGRP: /* group select */
917 case LS_LOAD: /* load select */
918
919 for (i = 0; i < 14; i++) {
920
921 if (BarType[i]) {
922
923 barval = (((BGprmtr[i] >> 5) - 500) << 6) / 252;
924 BarCset(i, barval);
925
926 } else {
927
928 barval = BGprmtr[i] / 252;
929 BarBset(i, barval);
930 }
931 }
932
933 break;
934
935 case LS_OTHER:
936
937 for (i = 0; i < 14; i++)
938 BarBset(i, (BGother[i] / 252));
939
940 break;
941
942 case LS_EQ:
943
944 for (i = 0; i < 14; i++)
945 BarCset(i, BGeq[i]);
946
947 break;
948
949 default:
950
951 break;
952 }
953
954 GLCcurs(G_OFF);
955 dsrpmod();
956 dclkmd();
957 ulamp();
958}
959
960/*
961
962*/
963
964/*
965 =============================================================================
966 selasg() -- select assignment table
967 =============================================================================
968*/
969
970selasg(n)
971short n;
972{
973 register struct s_entry *ep;
974
975 getasg(curasg = n); /* set the assignment */
976
977 if (recsw) { /* if we're recording ... */
978
979 if (E_NULL NE (ep = findev(p_cur, t_cur, EV_ASGN, -1, -1))) {
980
981 ep->e_data1 = n; /* update old event */
982
983 } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
984
985 ep->e_type = EV_ASGN; /* create new event */
986 ep->e_data1 = n;
987 ep->e_time = t_cur;
988 p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
989 eh_ins(ep, EH_ASGN);
990
991 if (ndisp EQ 2) { /* if the score is up ... */
992
993 ctrsw = TRUE;
994 se_disp(ep, D_FWD, gdstbc, 1);
995 scupd();
996 }
997 }
998 }
999
1000 asmode = 0; /* drop out of assignment mode */
1001 pkctrl = oldpk; /* restore previous mode */
1002 swpt = oldsw;
1003
1004 point = GLCplot; /* update the LCD */
1005 GLCcurs(G_ON);
1006 lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 0);
1007 GLCtext(0, 1, swtlbls[sliders]);
1008 GLCcurs(G_OFF);
1009
1010 mpcupd(); /* update the video display ... */
1011 setleds(); /* ... and the LEDs */
1012}
1013
1014/*
1015
1016*/
1017
1018/*
1019 =============================================================================
1020 l_adfl() -- select default assignment table
1021 =============================================================================
1022*/
1023
1024short
1025l_adfl(stat)
1026short stat;
1027{
1028 if (NOT stat)
1029 return;
1030
1031 selasg(0);
1032}
1033
1034/*
1035
1036*/
1037
1038/*
1039 =============================================================================
1040 l_asgn() -- select assignment
1041 =============================================================================
1042*/
1043
1044short
1045l_asgn(stat)
1046short stat;
1047{
1048 if (NOT stat) /* only do this on key closure */
1049 return;
1050
1051 point = GLCplot; /* set up to plot on the LCD */
1052 GLCcurs(G_ON);
1053
1054 if (ismode NE IS_NULL) { /* cancel instrument select mode */
1055
1056 ismode = IS_NULL;
1057 pkctrl = oldpk;
1058 sliders = oldsl;
1059 swpt = oldsw;
1060 lcdlbls();
1061 }
1062
1063 if (gomode NE GO_NULL) { /* cancel Go To mode */
1064
1065 gomode = GO_NULL;
1066 pkctrl = oldpk;
1067 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
1068 }
1069/*
1070
1071*/
1072 switch (asmode) {
1073
1074 case 0: /* initial actuation */
1075
1076 if ((pkctrl EQ PK_PFRM) OR (pkctrl EQ PK_NOTE))
1077 oldpk = pkctrl;
1078
1079 asmode = (curasg ? ((curasg - 1) / 20) : 0) + 1;
1080 pkctrl = PK_ASGN;
1081 memcpy(aswtbl, swpt, sizeof t_prmtr);
1082 oldsw = swpt;
1083 swpt = aswtbl;
1084 aswtbl[13] = l_adfl;
1085 lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 1);
1086 GLCtext(0, 79, "Deflt");
1087 break;
1088
1089 case 1: /* +00 -- 01..20 to +20 */
1090 case 2: /* +20 -- 21..40 to +40 */
1091 case 3: /* +40 -- 41..60 to +60 */
1092 case 4: /* +60 -- 61..80 to +80 */
1093
1094 ++asmode;
1095 break;
1096
1097 case 5: /* +80 -- 81..99 to +00 */
1098
1099 asmode = 1;
1100 break;
1101
1102 }
1103
1104 GLCtext(0, 43, aslbls[asmode]);
1105 GLCcurs(G_OFF);
1106 setleds();
1107}
1108
1109/*
1110
1111*/
1112
1113/*
1114 =============================================================================
1115 l_inst() -- set select instrument mode
1116 =============================================================================
1117*/
1118
1119short
1120l_inst(stat)
1121short stat;
1122{
1123 if (NOT stat)
1124 return;
1125
1126 point = GLCplot; /* set up to plot on the LCD */
1127 GLCcurs(G_ON);
1128
1129 if (asmode) { /* cancel assignment mode */
1130
1131 asmode = 0;
1132 pkctrl = oldpk;
1133 swpt = oldsw;
1134 lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 0);
1135 }
1136
1137 if (gomode NE GO_NULL) { /* cancel Go To mode */
1138
1139 gomode = GO_NULL;
1140 pkctrl = oldpk;
1141 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
1142 }
1143
1144 GLCcurs(G_OFF);
1145/*
1146
1147*/
1148 switch (ismode) {
1149
1150 case IS_NULL: /* select +00 -- low orchestra */
1151
1152 if ((pkctrl EQ PK_PFRM) OR (pkctrl EQ PK_NOTE))
1153 oldpk = pkctrl;
1154
1155 if (sliders NE LS_INST)
1156 oldsl = sliders;
1157
1158 oldsw = swpt;
1159 swpt = t_inst;
1160 pkctrl = PK_INST;
1161 ismode = IS_LORC;
1162 sliders = LS_INST;
1163 lcdlbls();
1164 break;
1165
1166 case IS_LORC: /* select +20 -- high orchestra */
1167
1168 ismode = IS_HORC;
1169 GLCcurs(G_ON);
1170 GLCtext(0, 73, " +20 ");
1171 GLCcurs(G_OFF);
1172 break;
1173
1174 case IS_HORC: /* deselect */
1175 default:
1176
1177 ismode = IS_NULL;
1178 pkctrl = oldpk;
1179 sliders = oldsl;
1180 swpt = oldsw;
1181 lcdlbls();
1182 break;
1183 }
1184
1185 setleds();
1186}
1187
1188/*
1189
1190*/
1191
1192/*
1193 =============================================================================
1194 selins() -- select an instrument
1195 =============================================================================
1196*/
1197
1198selins(ival)
1199register short ival;
1200{
1201 register short n;
1202 register struct s_entry *ep;
1203
1204 for (n = 0; n < 12; n++) {
1205
1206 if (FALSE EQ grpsel[n])
1207 continue;
1208
1209 ins2grp[n] = ival | (ins2grp[n] & 0xFF00);
1210 setv2gi(n);
1211
1212 if (recsw AND grpstat[n] AND (2 EQ grpmode[n])) {
1213
1214 if (E_NULL NE (ep = findev(p_cur, t_cur, EV_INST, n, -1))) {
1215
1216 ep->e_data2 = ival;
1217
1218 } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
1219
1220 ep->e_type = EV_INST;
1221 ep->e_data1 = n;
1222 ep->e_data2 = ival;
1223 ep->e_time = t_cur;
1224 p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
1225 eh_ins(ep, EH_INST);
1226
1227 if (ndisp EQ 2) {
1228
1229 ctrsw = TRUE;
1230 se_disp(ep, D_FWD, gdstbc, 1);
1231 scupd();
1232 }
1233 }
1234 }
1235 }
1236
1237 setinst();
1238
1239/*
1240
1241*/
1242 ismode = IS_NULL;
1243 pkctrl = oldpk;
1244 sliders = oldsl;
1245 swpt = oldsw;
1246 lcdlbls();
1247 setleds();
1248 mpcupd();
1249}
1250
1251/*
1252
1253*/
1254
1255/*
1256 =============================================================================
1257 l_dflt() -- select default isntrument
1258 =============================================================================
1259*/
1260
1261short
1262l_dflt(stat)
1263short stat;
1264{
1265 if (NOT stat)
1266 return;
1267
1268 selins(0);
1269}
1270
1271/*
1272
1273*/
1274
1275/*
1276 =============================================================================
1277 l_goto() -- go to (section / score)
1278 =============================================================================
1279*/
1280
1281short
1282l_goto(stat)
1283short stat;
1284{
1285 if (NOT stat) /* only do this on key closure */
1286 return;
1287
1288 point = GLCplot; /* set up to plot on the LCD */
1289 GLCcurs(G_ON);
1290
1291 if (asmode) { /* cancel assignment mode */
1292
1293 asmode = 0;
1294 pkctrl = oldpk;
1295 swpt = oldsw;
1296 lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 0);
1297 }
1298
1299 if (ismode NE IS_NULL) { /* cancel instrument select mode */
1300
1301 ismode = IS_NULL;
1302 sliders = oldsl;
1303 pkctrl = oldpk;
1304 swpt = oldsw;
1305 lcdlbls();
1306 }
1307
1308 recsw = FALSE; /* force play mode */
1309 dsrpmod();
1310/*
1311
1312*/
1313 switch (gomode) { /* select Go To mode */
1314
1315 case GO_NULL:
1316
1317 if ((pkctrl EQ PK_PFRM) OR (pkctrl EQ PK_NOTE))
1318 oldpk = pkctrl;
1319
1320 pkctrl = PK_GOTO;
1321 gomode = GO_SECT;
1322 GLCtext(0, 31, "Sectn");
1323 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 1);
1324 break;
1325
1326 case GO_SECT:
1327
1328 gomode = GO_SCOR;
1329 GLCtext(0, 31, "Score");
1330 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 1);
1331 break;
1332
1333 case GO_SCOR:
1334 default:
1335
1336 pkctrl = oldpk;
1337 gomode = GO_NULL;
1338 GLCtext(0, 31, "Go To");
1339 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
1340 break;
1341 }
1342
1343 GLCcurs(G_OFF);
1344 setleds();
1345}
1346
1347/*
1348
1349*/
1350
1351/*
1352 =============================================================================
1353 newpps() -- send out new polyphonic pressure source value
1354 =============================================================================
1355*/
1356
1357newpps(trg, grp, src, ival)
1358register short trg;
1359short grp, src;
1360register short ival;
1361{
1362 register struct sment *smf, *smp;
1363 register unsigned *fpu;
1364 register long ltmp;
1365 register short val;
1366 register short vce;
1367 short gs, oldi;
1368
1369 gs = (grp << 4) | src; /* calculate group/source index */
1370 fpu = io_fpu + FPU_OFNC; /* point at FPU base */
1371 valents[gs].val = ival; /* update value in table */
1372 smp = smf = (struct sment *)&valents[gs];
1373
1374/*
1375
1376*/
1377 while (smf NE (smp = smp->nxt)) { /* for each function ... */
1378
1379 vce = (smp->vp >> 4) & 0x0F; /* extract voice number */
1380
1381 if (vce2trg[vce] EQ trg) { /* for each key that matches ... */
1382
1383 switch (smp->vp & 0x000F) {
1384
1385 case 1: /* frq 1 */
1386 case 3: /* frq 2 */
1387 case 5: /* frq 3 */
1388 case 7: /* frq 4 */
1389
1390 val = ival >> 3;
1391 break;
1392
1393 case 10: /* filtr */
1394
1395 ltmp = ((long)ival >> 1) + ((long)ival >> 2);
1396
1397 if (ltmp > (long)VALMAX)
1398 ltmp = (long)VALMAX;
1399 else if (ltmp < (long)VALMIN)
1400 ltmp = (long)VALMIN;
1401
1402 val = (short)ltmp;
1403 break;
1404
1405 default:
1406
1407 val = ival;
1408 }
1409
1410 oldi = setipl(FPU_DI);
1411
1412/* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
1413
1414 *(fpu + (smp->vp << 4) + FPU_TCV1) = val;
1415
1416 setipl(oldi);
1417
1418/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
1419
1420 }
1421 }
1422}
1423
1424/*
1425
1426*/
1427
1428/*
1429 =============================================================================
1430 newsv() -- send out new source value if it's changed
1431 =============================================================================
1432*/
1433
1434short
1435newsv(grp, src, ival)
1436short grp, src;
1437register short ival;
1438{
1439 register struct sment *smf, *smp;
1440 register unsigned *fpu;
1441 register long ltmp;
1442 register short val;
1443 register short gs;
1444 register short oldi;
1445 short vmask, var;
1446
1447 gs = (grp << 4) | src; /* calculate grp/src index */
1448
1449 if (-1 NE (var = src2var[src])) { /* see if its a variable */
1450
1451 vmask = vmasks[anrs[var][grp]]; /* setup resolution mask */
1452
1453 /* see if we have a change in the selected significant bits */
1454
1455 if (((val = valents[gs].val) & vmask) EQ (ival & vmask)) {
1456
1457 /* make sure we always see a change to zero */
1458
1459 if (NOT ((ival EQ 0) AND val)) /* if not becoming zero */
1460 return(FALSE); /* ... it didn't change enough */
1461 }
1462 }
1463
1464 fpu = io_fpu + FPU_OFNC; /* point to FPU */
1465
1466 valents[gs].val = ival; /* update value in table */
1467
1468 smf = (struct sment *)&valents[gs]; /* point at value table */
1469 smp = smf;
1470
1471/*
1472
1473*/
1474 while (smf NE (smp = smp->nxt)) { /* update functions */
1475
1476 switch (smp->vp & 0x000F) {
1477
1478 case 1: /* frq 1 */
1479 case 3: /* frq 2 */
1480 case 5: /* frq 3 */
1481 case 7: /* frq 4 */
1482
1483 val = ival >> 3;
1484 break;
1485
1486 case 10: /* filtr */
1487
1488 ltmp = ((long)ival >> 1) + ((long)ival >> 2);
1489
1490 if (ltmp > (long)VALMAX)
1491 ltmp = (long)VALMAX;
1492 else if (ltmp < (long)VALMIN)
1493 ltmp = (long)VALMIN;
1494
1495 val = (short)ltmp;
1496 break;
1497
1498 default:
1499
1500 val = ival;
1501 }
1502
1503 oldi = setipl(FPU_DI);
1504
1505/* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
1506
1507 *(fpu + (smp->vp << 4) + FPU_TCV1) = val;
1508
1509 setipl(oldi);
1510
1511/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
1512
1513 }
1514
1515 return(TRUE);
1516}
1517
1518/*
1519
1520*/
1521
1522/*
1523 =============================================================================
1524 setsv() -- unconditionally send out new source value
1525 =============================================================================
1526*/
1527
1528setsv(grp, src, ival)
1529short grp, src;
1530register short ival;
1531{
1532 register struct sment *smf, *smp;
1533 register unsigned *fpu;
1534 register long ltmp;
1535 register short val;
1536 register short gs;
1537 register short oldi;
1538
1539 gs = (grp << 4) | src; /* calculate grp/src index */
1540 fpu = io_fpu + FPU_OFNC; /* point to FPU */
1541
1542 valents[gs].val = ival; /* update value in table */
1543
1544 smf = (struct sment *)&valents[gs]; /* point at value table */
1545 smp = smf;
1546
1547/*
1548
1549*/
1550 while (smf NE (smp = smp->nxt)) { /* update functions */
1551
1552 switch (smp->vp & 0x000F) {
1553
1554 case 1: /* frq 1 */
1555 case 3: /* frq 2 */
1556 case 5: /* frq 3 */
1557 case 7: /* frq 4 */
1558
1559 val = ival >> 3;
1560 break;
1561
1562 case 10: /* filtr */
1563
1564 ltmp = ((long)ival >> 1) + ((long)ival >> 2);
1565
1566 if (ltmp > (long)VALMAX)
1567 ltmp = (long)VALMAX;
1568 else if (ltmp < (long)VALMIN)
1569 ltmp = (long)VALMIN;
1570
1571 val = (short)ltmp;
1572 break;
1573
1574 default:
1575
1576 val = ival;
1577 }
1578
1579 oldi = setipl(FPU_DI);
1580
1581/* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
1582
1583 *(fpu + (smp->vp << 4) + FPU_TCV1) = val;
1584
1585 setipl(oldi);
1586
1587/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
1588
1589 }
1590}
1591
1592/*
1593
1594*/
1595
1596/*
1597 =============================================================================
1598 l_prmtr() -- set parameter articulation status
1599 =============================================================================
1600*/
1601
1602short
1603l_prmtr(stat, sig)
1604short stat, sig;
1605{
1606 if (NOT stat)
1607 return;
1608
1609 switch (sliders) {
1610
1611 case LS_PRMTR:
1612 case LS_OTHER:
1613 case LS_EQ:
1614
1615 sliders = LS_VOICE;
1616 swpt = t_voice;
1617 break;
1618
1619 case LS_VOICE:
1620 default:
1621
1622 sliders = LS_PRMTR;
1623 swpt = t_prmtr;
1624 break;
1625 }
1626
1627 lcdlbls();
1628 setleds();
1629}
1630
1631/*
1632
1633*/
1634
1635/*
1636 =============================================================================
1637 l_voice() -- set voice selection status
1638 =============================================================================
1639*/
1640
1641short
1642l_voice(stat, vce)
1643short stat, vce;
1644{
1645 register short ap, j, par;
1646 register unsigned *fpu;
1647
1648 char buf[8];
1649
1650 if (NOT stat)
1651 return;
1652
1653 articen[vce] = NOT articen[vce]; /* toggle voice enable */
1654
1655 sprintf(buf, "%c%2d %c", (articen[vce] ? '\176' : ' '), vce + 1,
1656 (articen[vce] ? '\177' : ' '));
1657
1658 GLCcurs(G_ON);
1659 GLCtext(0, (1 + (6 * vce)), buf);
1660 GLCcurs(G_OFF);
1661
1662 if (articen[vce]) { /* turn articulation on if voice is enabled */
1663
1664 for (ap = 0; ap < 14; ap++) {
1665
1666 par = arpar[ap];
1667 sendart(vce, par, lastart[par]);
1668 }
1669
1670 } else { /* ... or turn it off if voice is disabled */
1671
1672 fpu = io_fpu + FPU_OFNC + (vce << 8);
1673
1674 for (j = 1; j < 16; j++)
1675 *(fpu + (j << 4) + FPU_TSF2) = 0;
1676 }
1677}
1678
1679/*
1680
1681*/
1682
1683/*
1684 =============================================================================
1685 l_group() -- set group selection status
1686 =============================================================================
1687*/
1688
1689short
1690l_group(stat, grp)
1691short stat, grp;
1692{
1693 char buf[8];
1694
1695 if (NOT stat)
1696 return;
1697
1698 grpsel[grp] = NOT grpsel[grp]; /* toggle voice enable */
1699
1700 sprintf(buf, "%c%2d %c", (grpsel[grp] ? '\176' : ' '), grp + 1,
1701 (grpsel[grp] ? '\177' : ' '));
1702
1703 GLCcurs(G_ON);
1704 GLCtext(0, (1 + (6 * grp)), buf);
1705 GLCcurs(G_OFF);
1706}
1707
1708/*
1709 =============================================================================
1710 l_other -- set aux function status
1711 =============================================================================
1712*/
1713
1714short
1715l_other(stat, sig)
1716short stat, sig;
1717{
1718 if (NOT stat)
1719 return;
1720
1721 sliders = LS_OTHER;
1722 swpt = t_other;
1723
1724 lcdlbls();
1725}
1726
1727/*
1728
1729*/
1730
1731/*
1732 =============================================================================
1733 l_eq -- set eq mode
1734 =============================================================================
1735*/
1736
1737short
1738l_eq(stat, sig)
1739short stat, sig;
1740{
1741 if (NOT stat)
1742 return;
1743
1744 if (sliders EQ LS_EQ) {
1745
1746 sliders = LS_PRMTR;
1747 swpt = t_prmtr;
1748
1749 } else {
1750
1751 sliders = LS_EQ;
1752 swpt = t_eq;
1753 }
1754
1755 lcdlbls();
1756}
1757
1758/*
1759 =============================================================================
1760 artclr() -- clear the articulation pot values
1761 =============================================================================
1762*/
1763
1764artclr()
1765{
1766 register short i;
1767
1768 for (i = 0; i < 14; i++)
1769 lastart[arpar[i]] = artitab[i];
1770}
1771
1772/*
1773
1774*/
1775
1776/*
1777 =============================================================================
1778 l_init() -- initialize articulation values (reset the sliders)
1779 =============================================================================
1780*/
1781
1782short
1783l_init(stat, sig)
1784short stat, sig;
1785{
1786 register unsigned *fpu;
1787 register short barval, i, j;
1788 char buf[16];
1789
1790 if (NOT stat)
1791 return;
1792
1793 fpu = io_fpu + FPU_OFNC;
1794
1795 switch (sliders) {
1796
1797 case LS_PRMTR:
1798 case LS_VOICE:
1799 case LS_INST:
1800 case LS_LIBR:
1801 case LS_NGRP:
1802 case LS_LOAD:
1803
1804 /* clear all but spares in voices 1..12 */
1805
1806 for (i = 0; i < 12; i++)
1807 for (j = 1; j < 16; j++)
1808 *(fpu + (i << 8) + (j << 4) + FPU_TSF2) = 0;
1809
1810 artclr();
1811
1812 for (i = 0; i < 14; i++) {
1813
1814 BGprmtr[i] = artitab[i];
1815
1816 if (BarType[i]) {
1817
1818 barval = (((artitab[i] >> 5) - 500) << 6) / 252;
1819 BarCset(i, barval);
1820
1821 } else {
1822
1823 barval = artitab[i] / 252;
1824 BarBset(i, barval);
1825 }
1826 }
1827
1828 break;
1829
1830 case LS_OTHER:
1831
1832 /* clear spares in voices 2..12 */
1833
1834 for (i = 1; i < 12; i++)
1835 *(fpu + (i << 8) + FPU_TSF2) = 0;
1836
1837 for (i = 0; i < 14; i++)
1838 BarBset(i, BGother[i] = 0);
1839
1840 break;
1841
1842 case LS_EQ:
1843
1844 for (i = 0; i < 14; i++) {
1845
1846 sendeq(i, gain2eq(0));
1847 BarCset(i, BGeq[i] = 0);
1848 }
1849
1850 break;
1851 }
1852}
1853
1854/*
1855
1856*/
1857
1858/*
1859 =============================================================================
1860 sendart() -- send out an articulation value
1861 =============================================================================
1862*/
1863
1864sendart(vce, par, ival)
1865short vce, par, ival;
1866{
1867 register unsigned *fpu;
1868 register short val, oldi, mult;
1869 short nop;
1870
1871 lastart[par] = ival;
1872
1873 fpu = io_fpu + FPU_OFNC + (vce << 8) + (par << 4);
1874 mult = 0x7FFF;
1875
1876 switch (par) {
1877
1878 case 1: /* freq 1 */
1879 case 3: /* freq 2 */
1880 case 5: /* freq 3 */
1881 case 7: /* freq 4 */
1882
1883 val = addpch(ival, 0);
1884 break;
1885
1886 case 10: /* filter */
1887
1888 val = ((ival >> 5) - 500) << 5;
1889 break;
1890
1891/*
1892
1893*/
1894
1895 case 2: /* level */
1896
1897 val = ival;
1898 mult = 0xFFFF;
1899 break;
1900
1901 case 4: /* location */
1902
1903 val = ((ival >> 5) - 500) << 5;
1904 mult = 0xFFFF;
1905 break;
1906
1907 default:
1908
1909 val = ival;
1910 }
1911
1912 oldi = setipl(FPU_DI);
1913
1914/* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
1915
1916 *(fpu + FPU_TCV2) = val;
1917 ++nop; ++nop; ++nop;
1918 *(fpu + FPU_TSF2) = mult;
1919
1920 setipl(oldi);
1921
1922/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
1923
1924}
1925
1926/*
1927
1928*/
1929
1930/*
1931 =============================================================================
1932 doslide() -- update a changed slider value
1933 =============================================================================
1934*/
1935
1936doslide()
1937{
1938 register short arp, bar, barval, i, slval;
1939
1940 slval = ART_VAL(aval); /* scaled articulation value */
1941 bar = asig - 25; /* bar number */
1942
1943 switch (sliders) {
1944
1945 case LS_PRMTR: /* parameter articulation */
1946 case LS_VOICE:
1947 case LS_INST:
1948 case LS_LIBR:
1949 case LS_NGRP:
1950 case LS_LOAD:
1951
1952 BGprmtr[bar] = slval;
1953 arp = arpar[bar];
1954
1955 for (i = 0; i < 12; i++)
1956 if (articen[i])
1957 sendart(i, arp, slval);
1958
1959 if (BarType[bar]) { /* center-zero bar */
1960
1961 barval = (((slval >> 5) - 500) << 6) / 252;
1962 BarCadj(bar, barval);
1963
1964 } else { /* bottom-zero bar */
1965
1966 barval = slval / 252;
1967 BarBadj(bar, barval);
1968 }
1969
1970 return;
1971/*
1972
1973*/
1974 case LS_OTHER: /* aux, dome, cv control */
1975
1976 switch (asig) {
1977
1978 case 26: /* aux mod */
1979 sendart(9, 0, slval);
1980 break;
1981
1982 case 27: /* depth */
1983 sendart(3, 0, slval);
1984 break;
1985
1986 case 28: /* rate */
1987 sendart(2, 0, slval);
1988 break;
1989
1990 case 29: /* intensity */
1991 sendart(1, 0, slval);
1992 break;
1993
1994 case 30: /* cv1 */
1995 sendart(11, 0, slval);
1996 break;
1997
1998 case 31: /* cv2 */
1999 sendart(10, 0, slval);
2000 break;
2001
2002 case 32: /* cv3 */
2003 sendart(6, 0, slval);
2004 break;
2005
2006 case 33: /* cv4 */
2007 sendart(8, 0, slval);
2008 break;
2009
2010 default:
2011 slval = 0; /* force unused pots to stay zero */
2012 break;
2013 }
2014
2015 BGother[bar] = slval;
2016 barval = slval / 252;
2017 BarBadj(bar, barval);
2018
2019 return;
2020
2021/*
2022
2023*/
2024 case LS_EQ: /* eq control */
2025
2026 barval = (((slval >> 5) - 500) << 6) / 252;
2027 BGeq[bar] = barval;
2028 sendeq(bar, gain2eq(SL2GAIN(slval)));
2029 BarCadj(bar, barval);
2030
2031 return;
2032
2033 default:
2034 return;
2035 }
2036}
2037
2038/*
2039
2040*/
2041
2042/*
2043 =============================================================================
2044 settmpo() -- set the tempo
2045 =============================================================================
2046*/
2047
2048settmpo(val)
2049short val;
2050{
2051 register short timeval;
2052
2053 tmpoval = val;
2054 timeval = ( ( (tmpomlt + 50) * tmpoval) / 100);
2055 timeval = (short)( (192000L / timeval) - 1);
2056 TIME_T2H = timeval >> 8;
2057 TIME_T2L = timeval & 0x00FF;
2058}
2059
2060/*
2061
2062*/
2063
2064/*
2065 =============================================================================
2066 settune() -- send the fine tuning from tuneval to the FPU
2067 =============================================================================
2068*/
2069
2070settune()
2071{
2072 register short oldi, i, grp;
2073 register unsigned *fpu;
2074 register long trval, trmax;
2075 short nop;
2076
2077 trmax = PCHMAX;
2078
2079 oldi = setsr(0x2200);
2080
2081/* +++++++++++++++++++++++ FPU interrupts disabled ++++++++++++++++++++++++++ */
2082
2083 for (i = 0; i < 12; i++) {
2084
2085 if (-1 NE (grp = vce2grp[i])) {
2086
2087 trval = (long)tuneval + ((long)s_trns[grp - 1] << 1);
2088
2089 if (trval > trmax)
2090 trval = trmax;
2091
2092 } else {
2093
2094 trval = (long)tuneval;
2095 }
2096
2097 fpu = io_fpu + FPU_OFNC + (i << 8) + 0x0010; /* freq 1 */
2098
2099 *(fpu + FPU_TCV3) = (unsigned)(0x0000FFFFL & trval);
2100 ++nop; ++nop; ++nop;
2101 *(fpu + FPU_TSF3) = 0x7FFF;
2102 }
2103
2104 setsr(oldi);
2105
2106/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
2107
2108}
Note: See TracBrowser for help on using the repository browser.