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

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

Fixed lcdlbls.c.

  • Property mode set to 100644
File size: 37.4 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, 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 = (int8_t)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 = (int8_t)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 int16_t n;
1023 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] & (int16_t)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 = (int8_t)ival;
1038
1039 } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
1040
1041 ep->e_type = EV_INST;
1042 ep->e_data1 = (int8_t)n;
1043 ep->e_data2 = (int8_t)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 struct sment *smf, *smp;
1165 volatile uint16_t *fpu;
1166 int32_t ltmp;
1167 int16_t val;
1168 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) = (uint16_t)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 struct sment *smf, *smp;
1233 volatile uint16_t *fpu;
1234 int32_t ltmp;
1235 int16_t val;
1236 int16_t gs;
1237 int16_t oldi;
1238 uint16_t vmask;
1239 int16_t var;
1240
1241 gs = (grp << 4) | src; /* calculate grp/src index */
1242
1243 if (-1 NE (var = src2var[src])) { /* see if its a variable */
1244
1245 vmask = vmasks[anrs[var][grp]]; /* setup resolution mask */
1246
1247 /* see if we have a change in the selected significant bits */
1248
1249 if (((uint16_t)(val = valents[gs].val) & vmask) EQ ((uint16_t)ival & vmask)) {
1250
1251 /* make sure we always see a change to zero */
1252
1253 if (NOT ((ival EQ 0) AND val)) /* if not becoming zero */
1254 return(FALSE); /* ... it didn't change enough */
1255 }
1256 }
1257
1258 fpu = io_fpu + FPU_OFNC; /* point to FPU */
1259
1260 valents[gs].val = ival; /* update value in table */
1261
1262 smf = (struct sment *)&valents[gs]; /* point at value table */
1263 smp = smf;
1264
1265
1266 while (smf NE (smp = smp->nxt)) { /* update functions */
1267
1268 switch (smp->vp & 0x000F) {
1269
1270 case 1: /* frq 1 */
1271 case 3: /* frq 2 */
1272 case 5: /* frq 3 */
1273 case 7: /* frq 4 */
1274
1275 val = ival >> 3;
1276 break;
1277
1278 case 10: /* filtr */
1279
1280 ltmp = ((int32_t)ival >> 1) + ((int32_t)ival >> 2);
1281
1282 if (ltmp > (int32_t)VALMAX)
1283 ltmp = (int32_t)VALMAX;
1284 else if (ltmp < (int32_t)VALMIN)
1285 ltmp = (int32_t)VALMIN;
1286
1287 val = (int16_t)ltmp;
1288 break;
1289
1290 default:
1291
1292 val = ival;
1293 }
1294
1295 oldi = setipl(FPU_DI);
1296
1297/* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
1298
1299 *(fpu + (smp->vp << 4) + FPU_TCV1) = (uint16_t)val;
1300
1301 setipl(oldi);
1302
1303/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
1304
1305 }
1306
1307 return(TRUE);
1308}
1309
1310/*
1311 =============================================================================
1312 setsv() -- unconditionally send out new source value
1313 =============================================================================
1314*/
1315
1316void setsv(int16_t grp, int16_t src, int16_t ival)
1317{
1318 struct sment *smf, *smp;
1319 volatile uint16_t *fpu;
1320 int32_t ltmp;
1321 int16_t val;
1322 int16_t gs;
1323 int16_t oldi;
1324
1325 gs = (grp << 4) | src; /* calculate grp/src index */
1326 fpu = io_fpu + FPU_OFNC; /* point to FPU */
1327
1328 valents[gs].val = ival; /* update value in table */
1329
1330 smf = (struct sment *)&valents[gs]; /* point at value table */
1331 smp = smf;
1332
1333
1334 while (smf NE (smp = smp->nxt)) { /* update functions */
1335
1336 switch (smp->vp & 0x000F) {
1337
1338 case 1: /* frq 1 */
1339 case 3: /* frq 2 */
1340 case 5: /* frq 3 */
1341 case 7: /* frq 4 */
1342
1343 val = ival >> 3;
1344 break;
1345
1346 case 10: /* filtr */
1347
1348 ltmp = ((int32_t)ival >> 1) + ((int32_t)ival >> 2);
1349
1350 if (ltmp > (int32_t)VALMAX)
1351 ltmp = (int32_t)VALMAX;
1352 else if (ltmp < (int32_t)VALMIN)
1353 ltmp = (int32_t)VALMIN;
1354
1355 val = (int16_t)ltmp;
1356 break;
1357
1358 default:
1359
1360 val = ival;
1361 }
1362
1363 oldi = setipl(FPU_DI);
1364
1365/* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
1366
1367 *(fpu + (smp->vp << 4) + FPU_TCV1) = (uint16_t)val;
1368
1369 setipl(oldi);
1370
1371/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
1372
1373 }
1374}
1375
1376/*
1377 =============================================================================
1378 l_prmtr() -- set parameter articulation status
1379 =============================================================================
1380*/
1381
1382void l_prmtr(int16_t stat, int16_t _2)
1383{
1384 (void)_2;
1385
1386 if (NOT stat)
1387 return;
1388
1389 switch (sliders) {
1390
1391 case LS_PRMTR:
1392 case LS_OTHER:
1393 case LS_EQ:
1394
1395 sliders = LS_VOICE;
1396 swpt = &t_voice;
1397 break;
1398
1399 case LS_VOICE:
1400 default:
1401
1402 sliders = LS_PRMTR;
1403 swpt = &t_prmtr;
1404 break;
1405 }
1406
1407 lcdlbls();
1408 setleds();
1409}
1410
1411/*
1412 =============================================================================
1413 l_voice() -- set voice selection status
1414 =============================================================================
1415*/
1416
1417void l_voice(int16_t stat, int16_t vce)
1418{
1419 int16_t ap, j, par;
1420 volatile uint16_t *fpu;
1421
1422 int8_t buf[8];
1423
1424 if (NOT stat)
1425 return;
1426
1427 articen[vce] = NOT articen[vce]; /* toggle voice enable */
1428
1429 sprintf(buf, "%c%2d %c", (articen[vce] ? '\176' : ' '), vce + 1,
1430 (articen[vce] ? '\177' : ' '));
1431
1432 GLCcurs(G_ON);
1433 GLCtext(0, (1 + (6 * vce)), buf);
1434 GLCcurs(G_OFF);
1435
1436 if (articen[vce]) { /* turn articulation on if voice is enabled */
1437
1438 for (ap = 0; ap < 14; ap++) {
1439
1440 par = arpar[ap];
1441 sendart(vce, par, lastart[par]);
1442 }
1443
1444 } else { /* ... or turn it off if voice is disabled */
1445
1446 fpu = io_fpu + FPU_OFNC + (vce << 8);
1447
1448 for (j = 1; j < 16; j++)
1449 *(fpu + (j << 4) + FPU_TSF2) = 0;
1450 }
1451}
1452
1453/*
1454 =============================================================================
1455 l_group() -- set group selection status
1456 =============================================================================
1457*/
1458
1459void l_group(int16_t stat, int16_t grp)
1460{
1461 int8_t buf[8];
1462
1463 if (NOT stat)
1464 return;
1465
1466 grpsel[grp] = NOT grpsel[grp]; /* toggle voice enable */
1467
1468 sprintf(buf, "%c%2d %c", (grpsel[grp] ? '\176' : ' '), grp + 1,
1469 (grpsel[grp] ? '\177' : ' '));
1470
1471 GLCcurs(G_ON);
1472 GLCtext(0, (1 + (6 * grp)), buf);
1473 GLCcurs(G_OFF);
1474}
1475
1476/*
1477 =============================================================================
1478 l_other -- set aux function status
1479 =============================================================================
1480*/
1481
1482void l_other(int16_t stat, int16_t _2)
1483{
1484 (void)_2;
1485
1486 if (NOT stat)
1487 return;
1488
1489 sliders = LS_OTHER;
1490 swpt = &t_other;
1491
1492 lcdlbls();
1493}
1494
1495/*
1496 =============================================================================
1497 l_eq -- set eq mode
1498 =============================================================================
1499*/
1500
1501void l_eq(int16_t stat, int16_t _2)
1502{
1503 (void)_2;
1504
1505 if (NOT stat)
1506 return;
1507
1508 if (sliders EQ LS_EQ) {
1509
1510 sliders = LS_PRMTR;
1511 swpt = &t_prmtr;
1512
1513 } else {
1514
1515 sliders = LS_EQ;
1516 swpt = &t_eq;
1517 }
1518
1519 lcdlbls();
1520}
1521
1522/*
1523 =============================================================================
1524 artclr() -- clear the articulation pot values
1525 =============================================================================
1526*/
1527
1528void artclr(void)
1529{
1530 register int16_t i;
1531
1532 for (i = 0; i < 14; i++)
1533 lastart[arpar[i]] = artitab[i];
1534}
1535
1536/*
1537 =============================================================================
1538 l_init() -- initialize articulation values (reset the sliders)
1539 =============================================================================
1540*/
1541
1542void l_init(int16_t stat, int16_t _2)
1543{
1544 volatile uint16_t *fpu;
1545 int16_t barval, i, j;
1546
1547 (void)_2;
1548
1549 if (NOT stat)
1550 return;
1551
1552 fpu = io_fpu + FPU_OFNC;
1553
1554 switch (sliders) {
1555
1556 case LS_PRMTR:
1557 case LS_VOICE:
1558 case LS_INST:
1559 case LS_LIBR:
1560 case LS_NGRP:
1561 case LS_LOAD:
1562
1563 /* clear all but spares in voices 1..12 */
1564
1565 for (i = 0; i < 12; i++)
1566 for (j = 1; j < 16; j++)
1567 *(fpu + (i << 8) + (j << 4) + FPU_TSF2) = 0;
1568
1569 artclr();
1570
1571 for (i = 0; i < 14; i++) {
1572
1573 BGprmtr[i] = artitab[i];
1574
1575 if (BarType[i]) {
1576
1577 barval = (((artitab[i] >> 5) - 500) << 6) / 252;
1578 BarCset(i, barval);
1579
1580 } else {
1581
1582 barval = artitab[i] / 252;
1583 BarBset(i, barval);
1584 }
1585 }
1586
1587 break;
1588
1589 case LS_OTHER:
1590
1591 /* clear spares in voices 2..12 */
1592
1593 for (i = 1; i < 12; i++)
1594 *(fpu + (i << 8) + FPU_TSF2) = 0;
1595
1596 for (i = 0; i < 14; i++)
1597 BarBset(i, BGother[i] = 0);
1598
1599 break;
1600
1601 case LS_EQ:
1602
1603 for (i = 0; i < 14; i++) {
1604
1605 sendeq((int8_t)i, gain2eq(0));
1606 BarCset(i, BGeq[i] = 0);
1607 }
1608
1609 break;
1610 }
1611}
1612
1613/*
1614 =============================================================================
1615 sendart() -- send out an articulation value
1616 =============================================================================
1617*/
1618
1619void sendart(int16_t vce, int16_t par, int16_t ival)
1620{
1621 volatile uint16_t *fpu;
1622 int16_t val, oldi;
1623 uint16_t mult;
1624 int16_t nop;
1625
1626 lastart[par] = ival;
1627
1628 fpu = io_fpu + FPU_OFNC + (vce << 8) + (par << 4);
1629 mult = 0x7FFF;
1630
1631 switch (par) {
1632
1633 case 1: /* freq 1 */
1634 case 3: /* freq 2 */
1635 case 5: /* freq 3 */
1636 case 7: /* freq 4 */
1637
1638 val = addpch(ival, 0);
1639 break;
1640
1641 case 10: /* filter */
1642
1643 val = ((ival >> 5) - 500) << 5;
1644 break;
1645
1646 case 2: /* level */
1647
1648 val = ival;
1649 mult = 0xFFFF;
1650 break;
1651
1652 case 4: /* location */
1653
1654 val = ((ival >> 5) - 500) << 5;
1655 mult = 0xFFFF;
1656 break;
1657
1658 default:
1659
1660 val = ival;
1661 }
1662
1663 oldi = setipl(FPU_DI);
1664
1665/* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
1666
1667 *(fpu + FPU_TCV2) = (uint16_t)val;
1668 ++nop; ++nop; ++nop;
1669 *(fpu + FPU_TSF2) = mult;
1670
1671 setipl(oldi);
1672
1673/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
1674
1675}
1676
1677/*
1678 =============================================================================
1679 doslide() -- update a changed slider value
1680 =============================================================================
1681*/
1682
1683void doslide(void)
1684{
1685 register int16_t arp, bar, barval, i, slval;
1686
1687 slval = ART_VAL(aval); /* scaled articulation value */
1688 bar = asig - 25; /* bar number */
1689
1690 switch (sliders) {
1691
1692 case LS_PRMTR: /* parameter articulation */
1693 case LS_VOICE:
1694 case LS_INST:
1695 case LS_LIBR:
1696 case LS_NGRP:
1697 case LS_LOAD:
1698
1699 BGprmtr[bar] = slval;
1700 arp = arpar[bar];
1701
1702 for (i = 0; i < 12; i++)
1703 if (articen[i])
1704 sendart(i, arp, slval);
1705
1706 if (BarType[bar]) { /* center-zero bar */
1707
1708 barval = (((slval >> 5) - 500) << 6) / 252;
1709 BarCadj(bar, barval);
1710
1711 } else { /* bottom-zero bar */
1712
1713 barval = slval / 252;
1714 BarBadj(bar, barval);
1715 }
1716
1717 return;
1718
1719 case LS_OTHER: /* aux, dome, cv control */
1720
1721 switch (asig) {
1722
1723 case 26: /* aux mod */
1724 sendart(9, 0, slval);
1725 break;
1726
1727 case 27: /* depth */
1728 sendart(3, 0, slval);
1729 break;
1730
1731 case 28: /* rate */
1732 sendart(2, 0, slval);
1733 break;
1734
1735 case 29: /* intensity */
1736 sendart(1, 0, slval);
1737 break;
1738
1739 case 30: /* cv1 */
1740 sendart(11, 0, slval);
1741 break;
1742
1743 case 31: /* cv2 */
1744 sendart(10, 0, slval);
1745 break;
1746
1747 case 32: /* cv3 */
1748 sendart(6, 0, slval);
1749 break;
1750
1751 case 33: /* cv4 */
1752 sendart(8, 0, slval);
1753 break;
1754
1755 default:
1756 slval = 0; /* force unused pots to stay zero */
1757 break;
1758 }
1759
1760 BGother[bar] = slval;
1761 barval = slval / 252;
1762 BarBadj(bar, barval);
1763
1764 return;
1765
1766
1767 case LS_EQ: /* eq control */
1768
1769 barval = (((slval >> 5) - 500) << 6) / 252;
1770 BGeq[bar] = barval;
1771 sendeq((int8_t)bar, gain2eq(SL2GAIN(slval)));
1772 BarCadj(bar, barval);
1773
1774 return;
1775
1776 default:
1777 return;
1778 }
1779}
1780
1781/*
1782 =============================================================================
1783 settmpo() -- set the tempo
1784 =============================================================================
1785*/
1786
1787void settmpo(int16_t val)
1788{
1789 register int16_t timeval;
1790
1791 tmpoval = val;
1792 timeval = ( ( (tmpomlt + 50) * tmpoval) / 100);
1793 timeval = (int16_t)( (192000L / timeval) - 1);
1794 TIME_T2H = (uint8_t)(timeval >> 8);
1795 TIME_T2L = (uint8_t)(timeval & 0x00FF);
1796}
1797
1798/*
1799 =============================================================================
1800 settune() -- send the fine tuning from tuneval to the FPU
1801 =============================================================================
1802*/
1803
1804void settune(void)
1805{
1806 uint16_t oldi;
1807 int16_t i, grp;
1808 volatile uint16_t *fpu;
1809 int32_t trval, trmax;
1810 int16_t nop;
1811
1812 trmax = PCHMAX;
1813
1814 oldi = setsr(0x2200);
1815
1816/* +++++++++++++++++++++++ FPU interrupts disabled ++++++++++++++++++++++++++ */
1817
1818 for (i = 0; i < 12; i++) {
1819
1820 if (-1 NE (grp = vce2grp[i])) {
1821
1822 trval = (int32_t)tuneval + ((int32_t)s_trns[grp - 1] << 1);
1823
1824 if (trval > trmax)
1825 trval = trmax;
1826
1827 } else {
1828
1829 trval = (int32_t)tuneval;
1830 }
1831
1832 fpu = io_fpu + FPU_OFNC + (i << 8) + 0x0010; /* freq 1 */
1833
1834 *(fpu + FPU_TCV3) = (uint16_t)(0x0000FFFFL & trval);
1835 ++nop; ++nop; ++nop;
1836 *(fpu + FPU_TSF3) = 0x7FFF;
1837 }
1838
1839 setsr(oldi);
1840
1841/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
1842
1843}
1844
Note: See TracBrowser for help on using the repository browser.