source: buchla-68k/orig/RAM/LCDLBLS.C@ c0cb375

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

Imported original source code.

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