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

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

Unused variables and parameters.

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