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

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

Added include files for global functions and variables.

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