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

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

Make function pointers more consistent.

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