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

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

Fixed no-op delays.

  • 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/* 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() -- forward processing to l_load()
581 =============================================================================
582*/
583
584void _l_load(void)
585{
586 l_load(1, 0);
587}
588
589/*
590 =============================================================================
591 l_load() -- process "Load" key
592 =============================================================================
593*/
594
595void l_load(int16_t stat, int16_t _2)
596{
597 (void)_2;
598
599 if (NOT stat)
600 return;
601
602 pcancel(3); /* cancel panel selections */
603 lcancel(3); /* cancel librarian selections */
604
605 point = GLCplot; /* setup to plot on LCD */
606 GLCcurs(G_ON);
607
608 if (loadsw) { /* if load is selected, deselect */
609
610 d_key = olddkey;
611 e_key = oldekey;
612 m_key = oldmkey;
613 x_key = oldxkey;
614
615 pkctrl = oldpk;
616 sliders = oldsl;
617 swpt = oldsw;
618
619 loadsw = FALSE;
620
621 lcdlbls();
622
623 } else { /* setup for load mode */
624
625 clkset(0); /* stop the clock */
626
627 if (ltagged) { /* cancel tag mode */
628
629 dslslot(tagslot, LCFBX01, loadrow);
630 ltagged = FALSE;
631 }
632
633 if ((pkctrl EQ PK_PFRM) OR (pkctrl EQ PK_NOTE))
634 oldpk = pkctrl;
635
636 if (sliders NE LS_LOAD)
637 oldsl = sliders;
638
639 pkctrl = PK_LOAD;
640 sliders = LS_LOAD;
641 oldsw = swpt;
642 swpt = &t_load;
643
644 olddkey = d_key;
645 oldxkey = x_key;
646 oldekey = e_key;
647 oldmkey = m_key;
648 d_key = loadkey;
649 x_key = _l_load;
650 e_key = _l_load;
651 m_key = _l_load;
652
653 loadsw = TRUE;
654
655 lcdlbls();
656 lseg(LOAD_XL, LOAD_Y, LOAD_XR, LOAD_Y, 1);
657 }
658
659 GLCcurs(G_OFF);
660 setleds();
661}
662
663/*
664 =============================================================================
665 lcdlbls() -- put up the labels on the LCD display
666 =============================================================================
667*/
668
669void lcdlbls(void)
670{
671 register int16_t i, barval;
672 int8_t buf[8];
673 int8_t dsp[86];
674
675 point = GLCplot; /* set up to plot on the LCD */
676
677 GLCinit(); /* clear the LCD display */
678 GLCcurs(G_ON);
679
680 /* label the switches */
681
682 switch (sliders) {
683
684 case LS_PRMTR: /* parameter articulation */
685 case LS_OTHER: /* other stuff */
686 case LS_EQ: /* equalization */
687
688 GLCtext(0, 1, swtlbls[sliders]);
689
690 switch (gomode) {
691
692 case GO_SECT:
693
694 GLCtext(0, 31, "Sectn");
695 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 1);
696 break;
697
698 case GO_SCOR:
699
700 GLCtext(0, 31, "Score");
701 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 1);
702 break;
703
704 default:
705
706 GLCtext(0, 31, "Go To");
707 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
708 break;
709 }
710
711 break;
712
713 case LS_VOICE: /* voice selection */
714
715 dsp[0] = '\0';
716
717 for (i = 0; i < 12; i++) {
718
719 sprintf(buf, "%c%2d %c ",
720 (articen[i] ? '\176' : ' '), i + 1,
721 (articen[i] ? '\177' : ' '));
722
723 strcat(dsp, buf);
724 }
725
726 strcat(dsp, "Voice Init ");
727
728 GLCtext(0, 1, dsp);
729 break;
730
731 case LS_INST: /* instrument selection */
732
733 dsp[0] = '\0';
734
735 for (i = 0; i < 12; i++) {
736
737 sprintf(buf, "%c%2d %c ",
738 (grpsel[i] ? '\176' : ' '), i + 1,
739 (grpsel[i] ? '\177' : ' '));
740
741 strcat(dsp, buf);
742 }
743
744 if (ismode EQ IS_HORC)
745 strcat(dsp, " +20 "); /* hi orc */
746 else
747 strcat(dsp, " +00 "); /* lo orc */
748
749 strcat(dsp, " Deflt");
750
751 GLCtext(0, 1, dsp);
752 break;
753
754 case LS_LIBR:
755 case LS_NGRP:
756 case LS_LOAD:
757
758 GLCtext(0, 1, swtlbls[sliders]);
759 break;
760 }
761
762
763 GLCtext(7, 1, potlbls[sliders]); /* label the pots */
764
765 for (i = 0; i < 13; i++)
766 lseg(39 + (i * 36), 0, 39 + (i * 36), 63, 1);
767
768 switch (sliders) { /* draw the slider bars */
769
770 case LS_PRMTR: /* parameter articulation */
771 case LS_VOICE: /* voice articulation enable */
772 case LS_INST: /* instrument select */
773 case LS_LIBR: /* library select */
774 case LS_NGRP: /* group select */
775 case LS_LOAD: /* load select */
776
777 for (i = 0; i < 14; i++) {
778
779 if (BarType[i]) {
780
781 barval = (((BGprmtr[i] >> 5) - 500) << 6) / 252;
782 BarCset(i, barval);
783
784 } else {
785
786 barval = BGprmtr[i] / 252;
787 BarBset(i, barval);
788 }
789 }
790
791 break;
792
793 case LS_OTHER:
794
795 for (i = 0; i < 14; i++)
796 BarBset(i, (BGother[i] / 252));
797
798 break;
799
800 case LS_EQ:
801
802 for (i = 0; i < 14; i++)
803 BarCset(i, BGeq[i]);
804
805 break;
806
807 default:
808
809 break;
810 }
811
812 GLCcurs(G_OFF);
813 dsrpmod();
814 dclkmd();
815 ulamp();
816}
817
818/*
819 =============================================================================
820 selasg() -- select assignment table
821 =============================================================================
822*/
823
824void selasg(int16_t n)
825{
826 register struct s_entry *ep;
827
828 getasg(curasg = n); /* set the assignment */
829
830 if (recsw) { /* if we're recording ... */
831
832 if (E_NULL NE (ep = findev(p_cur, t_cur, EV_ASGN, -1, -1))) {
833
834 ep->e_data1 = (int8_t)n; /* update old event */
835
836 } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
837
838 ep->e_type = EV_ASGN; /* create new event */
839 ep->e_data1 = (int8_t)n;
840 ep->e_time = t_cur;
841 p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
842 eh_ins(ep, EH_ASGN);
843
844 if (ndisp EQ 2) { /* if the score is up ... */
845
846 ctrsw = TRUE;
847 se_disp(ep, D_FWD, gdstbc, 1);
848 scupd();
849 }
850 }
851 }
852
853 asmode = 0; /* drop out of assignment mode */
854 pkctrl = oldpk; /* restore previous mode */
855 swpt = oldsw;
856
857 point = GLCplot; /* update the LCD */
858 GLCcurs(G_ON);
859 lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 0);
860 GLCtext(0, 1, swtlbls[sliders]);
861 GLCcurs(G_OFF);
862
863 mpcupd(); /* update the video display ... */
864 setleds(); /* ... and the LEDs */
865}
866
867/*
868 =============================================================================
869 l_adfl() -- select default assignment table
870 =============================================================================
871*/
872
873void l_adfl(int16_t stat, int16_t _2)
874{
875 (void)_2;
876
877 if (NOT stat)
878 return;
879
880 selasg(0);
881}
882
883/*
884 =============================================================================
885 l_asgn() -- select assignment
886 =============================================================================
887*/
888
889void l_asgn(int16_t stat, int16_t _2)
890{
891 (void)_2;
892
893 if (NOT stat) /* only do this on key closure */
894 return;
895
896 point = GLCplot; /* set up to plot on the LCD */
897 GLCcurs(G_ON);
898
899 if (ismode NE IS_NULL) { /* cancel instrument select mode */
900
901 ismode = IS_NULL;
902 pkctrl = oldpk;
903 sliders = oldsl;
904 swpt = oldsw;
905 lcdlbls();
906 }
907
908 if (gomode NE GO_NULL) { /* cancel Go To mode */
909
910 gomode = GO_NULL;
911 pkctrl = oldpk;
912 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
913 }
914
915 switch (asmode) {
916
917 case 0: /* initial actuation */
918
919 if ((pkctrl EQ PK_PFRM) OR (pkctrl EQ PK_NOTE))
920 oldpk = pkctrl;
921
922 asmode = (curasg ? ((curasg - 1) / 20) : 0) + 1;
923 pkctrl = PK_ASGN;
924 memcpy(aswtbl, swpt, sizeof t_prmtr);
925 oldsw = swpt;
926 swpt = &aswtbl;
927 aswtbl[13] = l_adfl;
928 lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 1);
929 GLCtext(0, 79, "Deflt");
930 break;
931
932 case 1: /* +00 -- 01..20 to +20 */
933 case 2: /* +20 -- 21..40 to +40 */
934 case 3: /* +40 -- 41..60 to +60 */
935 case 4: /* +60 -- 61..80 to +80 */
936
937 ++asmode;
938 break;
939
940 case 5: /* +80 -- 81..99 to +00 */
941
942 asmode = 1;
943 break;
944
945 }
946
947 GLCtext(0, 43, aslbls[asmode]);
948 GLCcurs(G_OFF);
949 setleds();
950}
951
952/*
953 =============================================================================
954 l_inst() -- set select instrument mode
955 =============================================================================
956*/
957
958void l_inst(int16_t stat, int16_t _2)
959{
960 (void)_2;
961
962 if (NOT stat)
963 return;
964
965 point = GLCplot; /* set up to plot on the LCD */
966 GLCcurs(G_ON);
967
968 if (asmode) { /* cancel assignment mode */
969
970 asmode = 0;
971 pkctrl = oldpk;
972 swpt = oldsw;
973 lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 0);
974 }
975
976 if (gomode NE GO_NULL) { /* cancel Go To mode */
977
978 gomode = GO_NULL;
979 pkctrl = oldpk;
980 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
981 }
982
983 GLCcurs(G_OFF);
984
985 switch (ismode) {
986
987 case IS_NULL: /* select +00 -- low orchestra */
988
989 if ((pkctrl EQ PK_PFRM) OR (pkctrl EQ PK_NOTE))
990 oldpk = pkctrl;
991
992 if (sliders NE LS_INST)
993 oldsl = sliders;
994
995 oldsw = swpt;
996 swpt = &t_inst;
997 pkctrl = PK_INST;
998 ismode = IS_LORC;
999 sliders = LS_INST;
1000 lcdlbls();
1001 break;
1002
1003 case IS_LORC: /* select +20 -- high orchestra */
1004
1005 ismode = IS_HORC;
1006 GLCcurs(G_ON);
1007 GLCtext(0, 73, " +20 ");
1008 GLCcurs(G_OFF);
1009 break;
1010
1011 case IS_HORC: /* deselect */
1012 default:
1013
1014 ismode = IS_NULL;
1015 pkctrl = oldpk;
1016 sliders = oldsl;
1017 swpt = oldsw;
1018 lcdlbls();
1019 break;
1020 }
1021
1022 setleds();
1023}
1024
1025/*
1026 =============================================================================
1027 selins() -- select an instrument
1028 =============================================================================
1029*/
1030
1031void selins(int16_t ival)
1032{
1033 int16_t n;
1034 struct s_entry *ep;
1035
1036 for (n = 0; n < 12; n++) {
1037
1038 if (FALSE EQ grpsel[n])
1039 continue;
1040
1041 ins2grp[n] = ival | (ins2grp[n] & (int16_t)0xFF00);
1042 setv2gi(n);
1043
1044 if (recsw AND grpstat[n] AND (2 EQ grpmode[n])) {
1045
1046 if (E_NULL NE (ep = findev(p_cur, t_cur, EV_INST, n, -1))) {
1047
1048 ep->e_data2 = (int8_t)ival;
1049
1050 } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
1051
1052 ep->e_type = EV_INST;
1053 ep->e_data1 = (int8_t)n;
1054 ep->e_data2 = (int8_t)ival;
1055 ep->e_time = t_cur;
1056 p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
1057 eh_ins(ep, EH_INST);
1058
1059 if (ndisp EQ 2) {
1060
1061 ctrsw = TRUE;
1062 se_disp(ep, D_FWD, gdstbc, 1);
1063 scupd();
1064 }
1065 }
1066 }
1067 }
1068
1069 setinst();
1070
1071
1072 ismode = IS_NULL;
1073 pkctrl = oldpk;
1074 sliders = oldsl;
1075 swpt = oldsw;
1076 lcdlbls();
1077 setleds();
1078 mpcupd();
1079}
1080
1081/*
1082 =============================================================================
1083 l_dflt() -- select default isntrument
1084 =============================================================================
1085*/
1086
1087void l_dflt(int16_t stat, int16_t _2)
1088{
1089 (void)_2;
1090
1091 if (NOT stat)
1092 return;
1093
1094 selins(0);
1095}
1096
1097/*
1098 =============================================================================
1099 l_goto() -- go to (section / score)
1100 =============================================================================
1101*/
1102
1103void l_goto(int16_t stat, int16_t _2)
1104{
1105 (void)_2;
1106
1107 if (NOT stat) /* only do this on key closure */
1108 return;
1109
1110 point = GLCplot; /* set up to plot on the LCD */
1111 GLCcurs(G_ON);
1112
1113 if (asmode) { /* cancel assignment mode */
1114
1115 asmode = 0;
1116 pkctrl = oldpk;
1117 swpt = oldsw;
1118 lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 0);
1119 }
1120
1121 if (ismode NE IS_NULL) { /* cancel instrument select mode */
1122
1123 ismode = IS_NULL;
1124 sliders = oldsl;
1125 pkctrl = oldpk;
1126 swpt = oldsw;
1127 lcdlbls();
1128 }
1129
1130 recsw = FALSE; /* force play mode */
1131 dsrpmod();
1132
1133 switch (gomode) { /* select Go To mode */
1134
1135 case GO_NULL:
1136
1137 if ((pkctrl EQ PK_PFRM) OR (pkctrl EQ PK_NOTE))
1138 oldpk = pkctrl;
1139
1140 pkctrl = PK_GOTO;
1141 gomode = GO_SECT;
1142 GLCtext(0, 31, "Sectn");
1143 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 1);
1144 break;
1145
1146 case GO_SECT:
1147
1148 gomode = GO_SCOR;
1149 GLCtext(0, 31, "Score");
1150 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 1);
1151 break;
1152
1153 case GO_SCOR:
1154 default:
1155
1156 pkctrl = oldpk;
1157 gomode = GO_NULL;
1158 GLCtext(0, 31, "Go To");
1159 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
1160 break;
1161 }
1162
1163 GLCcurs(G_OFF);
1164 setleds();
1165}
1166
1167/*
1168 =============================================================================
1169 newpps() -- send out new polyphonic pressure source value
1170 =============================================================================
1171*/
1172
1173void newpps(int16_t trg, int16_t grp, int16_t src, int16_t ival)
1174{
1175 struct sment *smf, *smp;
1176 volatile uint16_t *fpu;
1177 int32_t ltmp;
1178 int16_t val;
1179 int16_t vce;
1180 int16_t gs, oldi;
1181
1182 gs = (grp << 4) | src; /* calculate group/source index */
1183 fpu = io_fpu + FPU_OFNC; /* point at FPU base */
1184 valents[gs].val = ival; /* update value in table */
1185 smp = smf = (struct sment *)&valents[gs];
1186
1187
1188 while (smf NE (smp = smp->nxt)) { /* for each function ... */
1189
1190 vce = (smp->vp >> 4) & 0x0F; /* extract voice number */
1191
1192 if (vce2trg[vce] EQ trg) { /* for each key that matches ... */
1193
1194 switch (smp->vp & 0x000F) {
1195
1196 case 1: /* frq 1 */
1197 case 3: /* frq 2 */
1198 case 5: /* frq 3 */
1199 case 7: /* frq 4 */
1200
1201 val = ival >> 3;
1202 break;
1203
1204 case 10: /* filtr */
1205
1206 ltmp = ((int32_t)ival >> 1) + ((int32_t)ival >> 2);
1207
1208 if (ltmp > (int32_t)VALMAX)
1209 ltmp = (int32_t)VALMAX;
1210 else if (ltmp < (int32_t)VALMIN)
1211 ltmp = (int32_t)VALMIN;
1212
1213 val = (int16_t)ltmp;
1214 break;
1215
1216 default:
1217
1218 val = ival;
1219 }
1220
1221 oldi = setipl(FPU_DI);
1222
1223/* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
1224
1225 *(fpu + (smp->vp << 4) + FPU_TCV1) = (uint16_t)val;
1226
1227 setipl(oldi);
1228
1229/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
1230
1231 }
1232 }
1233}
1234
1235/*
1236 =============================================================================
1237 newsv() -- send out new source value if it's changed
1238 =============================================================================
1239*/
1240
1241int16_t newsv(int16_t grp, int16_t src, int16_t ival)
1242{
1243 struct sment *smf, *smp;
1244 volatile uint16_t *fpu;
1245 int32_t ltmp;
1246 int16_t val;
1247 int16_t gs;
1248 int16_t oldi;
1249 uint16_t vmask;
1250 int16_t var;
1251
1252 gs = (grp << 4) | src; /* calculate grp/src index */
1253
1254 if (-1 NE (var = src2var[src])) { /* see if its a variable */
1255
1256 vmask = vmasks[anrs[var][grp]]; /* setup resolution mask */
1257
1258 /* see if we have a change in the selected significant bits */
1259
1260 if (((uint16_t)(val = valents[gs].val) & vmask) EQ ((uint16_t)ival & vmask)) {
1261
1262 /* make sure we always see a change to zero */
1263
1264 if (NOT ((ival EQ 0) AND val)) /* if not becoming zero */
1265 return(FALSE); /* ... it didn't change enough */
1266 }
1267 }
1268
1269 fpu = io_fpu + FPU_OFNC; /* point to FPU */
1270
1271 valents[gs].val = ival; /* update value in table */
1272
1273 smf = (struct sment *)&valents[gs]; /* point at value table */
1274 smp = smf;
1275
1276
1277 while (smf NE (smp = smp->nxt)) { /* update functions */
1278
1279 switch (smp->vp & 0x000F) {
1280
1281 case 1: /* frq 1 */
1282 case 3: /* frq 2 */
1283 case 5: /* frq 3 */
1284 case 7: /* frq 4 */
1285
1286 val = ival >> 3;
1287 break;
1288
1289 case 10: /* filtr */
1290
1291 ltmp = ((int32_t)ival >> 1) + ((int32_t)ival >> 2);
1292
1293 if (ltmp > (int32_t)VALMAX)
1294 ltmp = (int32_t)VALMAX;
1295 else if (ltmp < (int32_t)VALMIN)
1296 ltmp = (int32_t)VALMIN;
1297
1298 val = (int16_t)ltmp;
1299 break;
1300
1301 default:
1302
1303 val = ival;
1304 }
1305
1306 oldi = setipl(FPU_DI);
1307
1308/* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
1309
1310 *(fpu + (smp->vp << 4) + FPU_TCV1) = (uint16_t)val;
1311
1312 setipl(oldi);
1313
1314/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
1315
1316 }
1317
1318 return(TRUE);
1319}
1320
1321/*
1322 =============================================================================
1323 setsv() -- unconditionally send out new source value
1324 =============================================================================
1325*/
1326
1327void setsv(int16_t grp, int16_t src, int16_t ival)
1328{
1329 struct sment *smf, *smp;
1330 volatile uint16_t *fpu;
1331 int32_t ltmp;
1332 int16_t val;
1333 int16_t gs;
1334 int16_t oldi;
1335
1336 gs = (grp << 4) | src; /* calculate grp/src index */
1337 fpu = io_fpu + FPU_OFNC; /* point to FPU */
1338
1339 valents[gs].val = ival; /* update value in table */
1340
1341 smf = (struct sment *)&valents[gs]; /* point at value table */
1342 smp = smf;
1343
1344
1345 while (smf NE (smp = smp->nxt)) { /* update functions */
1346
1347 switch (smp->vp & 0x000F) {
1348
1349 case 1: /* frq 1 */
1350 case 3: /* frq 2 */
1351 case 5: /* frq 3 */
1352 case 7: /* frq 4 */
1353
1354 val = ival >> 3;
1355 break;
1356
1357 case 10: /* filtr */
1358
1359 ltmp = ((int32_t)ival >> 1) + ((int32_t)ival >> 2);
1360
1361 if (ltmp > (int32_t)VALMAX)
1362 ltmp = (int32_t)VALMAX;
1363 else if (ltmp < (int32_t)VALMIN)
1364 ltmp = (int32_t)VALMIN;
1365
1366 val = (int16_t)ltmp;
1367 break;
1368
1369 default:
1370
1371 val = ival;
1372 }
1373
1374 oldi = setipl(FPU_DI);
1375
1376/* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
1377
1378 *(fpu + (smp->vp << 4) + FPU_TCV1) = (uint16_t)val;
1379
1380 setipl(oldi);
1381
1382/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
1383
1384 }
1385}
1386
1387/*
1388 =============================================================================
1389 l_prmtr() -- set parameter articulation status
1390 =============================================================================
1391*/
1392
1393void l_prmtr(int16_t stat, int16_t _2)
1394{
1395 (void)_2;
1396
1397 if (NOT stat)
1398 return;
1399
1400 switch (sliders) {
1401
1402 case LS_PRMTR:
1403 case LS_OTHER:
1404 case LS_EQ:
1405
1406 sliders = LS_VOICE;
1407 swpt = &t_voice;
1408 break;
1409
1410 case LS_VOICE:
1411 default:
1412
1413 sliders = LS_PRMTR;
1414 swpt = &t_prmtr;
1415 break;
1416 }
1417
1418 lcdlbls();
1419 setleds();
1420}
1421
1422/*
1423 =============================================================================
1424 l_voice() -- set voice selection status
1425 =============================================================================
1426*/
1427
1428void l_voice(int16_t stat, int16_t vce)
1429{
1430 int16_t ap, j, par;
1431 volatile uint16_t *fpu;
1432
1433 int8_t buf[8];
1434
1435 if (NOT stat)
1436 return;
1437
1438 articen[vce] = NOT articen[vce]; /* toggle voice enable */
1439
1440 sprintf(buf, "%c%2d %c", (articen[vce] ? '\176' : ' '), vce + 1,
1441 (articen[vce] ? '\177' : ' '));
1442
1443 GLCcurs(G_ON);
1444 GLCtext(0, (1 + (6 * vce)), buf);
1445 GLCcurs(G_OFF);
1446
1447 if (articen[vce]) { /* turn articulation on if voice is enabled */
1448
1449 for (ap = 0; ap < 14; ap++) {
1450
1451 par = arpar[ap];
1452 sendart(vce, par, lastart[par]);
1453 }
1454
1455 } else { /* ... or turn it off if voice is disabled */
1456
1457 fpu = io_fpu + FPU_OFNC + (vce << 8);
1458
1459 for (j = 1; j < 16; j++)
1460 *(fpu + (j << 4) + FPU_TSF2) = 0;
1461 }
1462}
1463
1464/*
1465 =============================================================================
1466 l_group() -- set group selection status
1467 =============================================================================
1468*/
1469
1470void l_group(int16_t stat, int16_t grp)
1471{
1472 int8_t buf[8];
1473
1474 if (NOT stat)
1475 return;
1476
1477 grpsel[grp] = NOT grpsel[grp]; /* toggle voice enable */
1478
1479 sprintf(buf, "%c%2d %c", (grpsel[grp] ? '\176' : ' '), grp + 1,
1480 (grpsel[grp] ? '\177' : ' '));
1481
1482 GLCcurs(G_ON);
1483 GLCtext(0, (1 + (6 * grp)), buf);
1484 GLCcurs(G_OFF);
1485}
1486
1487/*
1488 =============================================================================
1489 l_other -- set aux function status
1490 =============================================================================
1491*/
1492
1493void l_other(int16_t stat, int16_t _2)
1494{
1495 (void)_2;
1496
1497 if (NOT stat)
1498 return;
1499
1500 sliders = LS_OTHER;
1501 swpt = &t_other;
1502
1503 lcdlbls();
1504}
1505
1506/*
1507 =============================================================================
1508 l_eq -- set eq mode
1509 =============================================================================
1510*/
1511
1512void l_eq(int16_t stat, int16_t _2)
1513{
1514 (void)_2;
1515
1516 if (NOT stat)
1517 return;
1518
1519 if (sliders EQ LS_EQ) {
1520
1521 sliders = LS_PRMTR;
1522 swpt = &t_prmtr;
1523
1524 } else {
1525
1526 sliders = LS_EQ;
1527 swpt = &t_eq;
1528 }
1529
1530 lcdlbls();
1531}
1532
1533/*
1534 =============================================================================
1535 artclr() -- clear the articulation pot values
1536 =============================================================================
1537*/
1538
1539void artclr(void)
1540{
1541 register int16_t i;
1542
1543 for (i = 0; i < 14; i++)
1544 lastart[arpar[i]] = artitab[i];
1545}
1546
1547/*
1548 =============================================================================
1549 l_init() -- initialize articulation values (reset the sliders)
1550 =============================================================================
1551*/
1552
1553void l_init(int16_t stat, int16_t _2)
1554{
1555 volatile uint16_t *fpu;
1556 int16_t barval, i, j;
1557
1558 (void)_2;
1559
1560 if (NOT stat)
1561 return;
1562
1563 fpu = io_fpu + FPU_OFNC;
1564
1565 switch (sliders) {
1566
1567 case LS_PRMTR:
1568 case LS_VOICE:
1569 case LS_INST:
1570 case LS_LIBR:
1571 case LS_NGRP:
1572 case LS_LOAD:
1573
1574 /* clear all but spares in voices 1..12 */
1575
1576 for (i = 0; i < 12; i++)
1577 for (j = 1; j < 16; j++)
1578 *(fpu + (i << 8) + (j << 4) + FPU_TSF2) = 0;
1579
1580 artclr();
1581
1582 for (i = 0; i < 14; i++) {
1583
1584 BGprmtr[i] = artitab[i];
1585
1586 if (BarType[i]) {
1587
1588 barval = (((artitab[i] >> 5) - 500) << 6) / 252;
1589 BarCset(i, barval);
1590
1591 } else {
1592
1593 barval = artitab[i] / 252;
1594 BarBset(i, barval);
1595 }
1596 }
1597
1598 break;
1599
1600 case LS_OTHER:
1601
1602 /* clear spares in voices 2..12 */
1603
1604 for (i = 1; i < 12; i++)
1605 *(fpu + (i << 8) + FPU_TSF2) = 0;
1606
1607 for (i = 0; i < 14; i++)
1608 BarBset(i, BGother[i] = 0);
1609
1610 break;
1611
1612 case LS_EQ:
1613
1614 for (i = 0; i < 14; i++) {
1615
1616 sendeq((int8_t)i, gain2eq(0));
1617 BarCset(i, BGeq[i] = 0);
1618 }
1619
1620 break;
1621 }
1622}
1623
1624/*
1625 =============================================================================
1626 sendart() -- send out an articulation value
1627 =============================================================================
1628*/
1629
1630void sendart(int16_t vce, int16_t par, int16_t ival)
1631{
1632 volatile uint16_t *fpu;
1633 int16_t val, oldi;
1634 uint16_t mult;
1635 volatile int16_t nop = 0;
1636
1637 lastart[par] = ival;
1638
1639 fpu = io_fpu + FPU_OFNC + (vce << 8) + (par << 4);
1640 mult = 0x7FFF;
1641
1642 switch (par) {
1643
1644 case 1: /* freq 1 */
1645 case 3: /* freq 2 */
1646 case 5: /* freq 3 */
1647 case 7: /* freq 4 */
1648
1649 val = addpch(ival, 0);
1650 break;
1651
1652 case 10: /* filter */
1653
1654 val = ((ival >> 5) - 500) << 5;
1655 break;
1656
1657 case 2: /* level */
1658
1659 val = ival;
1660 mult = 0xFFFF;
1661 break;
1662
1663 case 4: /* location */
1664
1665 val = ((ival >> 5) - 500) << 5;
1666 mult = 0xFFFF;
1667 break;
1668
1669 default:
1670
1671 val = ival;
1672 }
1673
1674 oldi = setipl(FPU_DI);
1675
1676/* ++++++++++++++++++++++++++++ FPU interrupts disabled +++++++++++++++++++++ */
1677
1678 *(fpu + FPU_TCV2) = (uint16_t)val;
1679 ++nop; ++nop; ++nop;
1680 *(fpu + FPU_TSF2) = mult;
1681
1682 setipl(oldi);
1683
1684/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
1685
1686}
1687
1688/*
1689 =============================================================================
1690 doslide() -- update a changed slider value
1691 =============================================================================
1692*/
1693
1694void doslide(void)
1695{
1696 register int16_t arp, bar, barval, i, slval;
1697
1698 slval = ART_VAL(aval); /* scaled articulation value */
1699 bar = asig - 25; /* bar number */
1700
1701 switch (sliders) {
1702
1703 case LS_PRMTR: /* parameter articulation */
1704 case LS_VOICE:
1705 case LS_INST:
1706 case LS_LIBR:
1707 case LS_NGRP:
1708 case LS_LOAD:
1709
1710 BGprmtr[bar] = slval;
1711 arp = arpar[bar];
1712
1713 for (i = 0; i < 12; i++)
1714 if (articen[i])
1715 sendart(i, arp, slval);
1716
1717 if (BarType[bar]) { /* center-zero bar */
1718
1719 barval = (((slval >> 5) - 500) << 6) / 252;
1720 BarCadj(bar, barval);
1721
1722 } else { /* bottom-zero bar */
1723
1724 barval = slval / 252;
1725 BarBadj(bar, barval);
1726 }
1727
1728 return;
1729
1730 case LS_OTHER: /* aux, dome, cv control */
1731
1732 switch (asig) {
1733
1734 case 26: /* aux mod */
1735 sendart(9, 0, slval);
1736 break;
1737
1738 case 27: /* depth */
1739 sendart(3, 0, slval);
1740 break;
1741
1742 case 28: /* rate */
1743 sendart(2, 0, slval);
1744 break;
1745
1746 case 29: /* intensity */
1747 sendart(1, 0, slval);
1748 break;
1749
1750 case 30: /* cv1 */
1751 sendart(11, 0, slval);
1752 break;
1753
1754 case 31: /* cv2 */
1755 sendart(10, 0, slval);
1756 break;
1757
1758 case 32: /* cv3 */
1759 sendart(6, 0, slval);
1760 break;
1761
1762 case 33: /* cv4 */
1763 sendart(8, 0, slval);
1764 break;
1765
1766 default:
1767 slval = 0; /* force unused pots to stay zero */
1768 break;
1769 }
1770
1771 BGother[bar] = slval;
1772 barval = slval / 252;
1773 BarBadj(bar, barval);
1774
1775 return;
1776
1777
1778 case LS_EQ: /* eq control */
1779
1780 barval = (((slval >> 5) - 500) << 6) / 252;
1781 BGeq[bar] = barval;
1782 sendeq((int8_t)bar, gain2eq(SL2GAIN(slval)));
1783 BarCadj(bar, barval);
1784
1785 return;
1786
1787 default:
1788 return;
1789 }
1790}
1791
1792/*
1793 =============================================================================
1794 settmpo() -- set the tempo
1795 =============================================================================
1796*/
1797
1798void settmpo(int16_t val)
1799{
1800 register int16_t timeval;
1801
1802 tmpoval = val;
1803 timeval = ( ( (tmpomlt + 50) * tmpoval) / 100);
1804 timeval = (int16_t)( (192000L / timeval) - 1);
1805 TIME_T2H = (uint8_t)(timeval >> 8);
1806 TIME_T2L = (uint8_t)(timeval & 0x00FF);
1807}
1808
1809/*
1810 =============================================================================
1811 settune() -- send the fine tuning from tuneval to the FPU
1812 =============================================================================
1813*/
1814
1815void settune(void)
1816{
1817 uint16_t oldi;
1818 int16_t i, grp;
1819 volatile uint16_t *fpu;
1820 int32_t trval, trmax;
1821 volatile int16_t nop = 0;
1822
1823 trmax = PCHMAX;
1824
1825 oldi = setsr(0x2200);
1826
1827/* +++++++++++++++++++++++ FPU interrupts disabled ++++++++++++++++++++++++++ */
1828
1829 for (i = 0; i < 12; i++) {
1830
1831 if (-1 NE (grp = vce2grp[i])) {
1832
1833 trval = (int32_t)tuneval + ((int32_t)s_trns[grp - 1] << 1);
1834
1835 if (trval > trmax)
1836 trval = trmax;
1837
1838 } else {
1839
1840 trval = (int32_t)tuneval;
1841 }
1842
1843 fpu = io_fpu + FPU_OFNC + (i << 8) + 0x0010; /* freq 1 */
1844
1845 *(fpu + FPU_TCV3) = (uint16_t)(0x0000FFFFL & trval);
1846 ++nop; ++nop; ++nop;
1847 *(fpu + FPU_TSF3) = 0x7FFF;
1848 }
1849
1850 setsr(oldi);
1851
1852/* ++++++++++++++++++++++++++++ Interrupts restored +++++++++++++++++++++++++ */
1853
1854}
1855
Note: See TracBrowser for help on using the repository browser.