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

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

Zero redundant declarations.

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