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

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

Make tables unsigned.

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