source: buchla-68k/orig/RAM/ASGDSP.C@ 66b48e7

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

Imported original source code.

  • Property mode set to 100755
File size: 24.6 KB
Line 
1/*
2 =============================================================================
3 asgdsp.c -- MIDAS assignment editor
4 Version 50 -- 1988-10-04 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define DEBUGIT 0
9
10#include "stddefs.h"
11#include "memory.h"
12
13#include "hwdefs.h"
14#include "graphdef.h"
15#include "vsdd.h"
16#include "vsddsw.h"
17#include "vsddvars.h"
18#include "charset.h"
19#include "fields.h"
20
21#include "midas.h"
22#include "asgdsp.h"
23
24#define PSG_ADDR 0
25#define PSG_READ 0
26#define PSG_WRIT 2
27
28#define PSG_IOEN 7
29#define PSG_IDLE 0xBF
30
31#define PSG_PRTB 15 /* PSG Port B */
32
33#define AUX_BIT 0x02 /* aux control bit in PSG port B */
34
35#define AK_WIDTH 115 /* width, in words, of keyboard icon */
36
37/* 4 bit pixel patterns */
38
39#define AKW_0 0x0000
40#define AKW_1 0xF000
41#define AKW_2 0x0F00
42#define AKW_3 0xFF00
43#define AKW_4 0x00F0
44#define AKW_5 0xF0F0
45#define AKW_6 0x0FF0
46#define AKW_7 0xFFF0
47#define AKW_8 0x000F
48#define AKW_9 0xF00F
49#define AKW_A 0x0F0F
50#define AKW_B 0xFF0F
51#define AKW_C 0x00FF
52#define AKW_D 0xF0FF
53#define AKW_E 0x0FFF
54#define AKW_F 0xFFFF
55
56/*
57
58*/
59
60/* things defined elsewhere */
61
62extern int (*point)();
63extern unsigned exp_c();
64
65extern short stcrow, stccol, cxval, cyval;
66extern short curtun, tunmod;
67
68#if DEBUGIT
69extern short debugsw;
70#endif
71
72extern unsigned *obj0, *obj2;
73
74extern char bfs[];
75extern char *adbxlb[];
76extern char caname[];
77
78extern short adbox[][8];
79
80extern short admctl; /* assignment menu control */
81extern short adnamsw; /* vitrual typewriter switch */
82extern short asgfks; /* first key selected */
83extern short asghit; /* row hit / assignment in progress */
84extern short asgmod; /* assignment number or table modified */
85extern short auxctl; /* aux control flag */
86extern short curasg; /* current assignment table */
87extern short curmop; /* current MIDI output port */
88extern short curvce; /* current voice being edited */
89extern short prgchan; /* MIDI program change channel (port 1) */
90extern short ps_dpth; /* phase shifter -- depth */
91extern short ps_intn; /* phase shifter -- intensity */
92extern short ps_rate; /* phase shifter -- rate */
93extern short submenu; /* submenu flag */
94
95extern short grpdyn[12]; /* group dynamics table (0..9) */
96extern short ins2grp[12]; /* instrument to group table (00..NINST-1) */
97extern short mctlnum[4]; /* MIDI controller number table (-1, 00..99) */
98extern short s_inst[12]; /* instrument assignments */
99extern short vce2grp[12]; /* voice to group table (-1, 1..12)*/
100
101extern short grp2prt[12][2]; /* group to port and channel table */
102 /* port [0] = 0..4, channel [1] = -1, 1..16 */
103
104extern short key2grp[88]; /* port 1 key to group assignment table */
105 /* bit n = group n */
106
107extern struct asgent asgtab[NASGS]; /* assignment table library */
108
109extern unsigned *asgob;
110
111extern struct octent *adoct;
112
113/*
114
115*/
116
117char *gprep[] = {" ", "1", "2", "L"};
118
119char *asgsrc[] = { /* source labels */
120
121 "1 Pch/Hor",
122 "2 Mod/Vrt",
123 "3 Brth/LP",
124 "4 GPC/CV1",
125 "5 Pedal 1",
126 "6 Key Prs"
127};
128
129/* keys are 5 pixels wide on top, except the last one, which is 8 pixels wide */
130
131short asgkble[88] = { /* key left edge offsets */
132
133 /* piano MIDI */
134
135 1, 6, 11, /* 1..3 21..23 */
136 17, 22, 27, 32, 37, /* 4..8 24..28 */
137 43, 48, 53, 58, 63, 68, 73, /* 9..15 29..35 */
138 79, 84, 89, 94, 99, /* 16..20 36..40 */
139 105, 110, 115, 120, 125, 130, 135, /* 21..27 41..47 */
140 141, 146, 151, 156, 161, /* 28..32 48..52 */
141 167, 172, 177, 182, 187, 192, 197, /* 33..39 53..59 */
142 203, 208, 213, 218, 223, /* 40..44 60..64 */
143 229, 234, 239, 244, 249, 254, 259, /* 45..51 65..71 */
144 265, 270, 275, 280, 285, /* 52..56 72..76 */
145 291, 296, 301, 306, 311, 316, 321, /* 57..63 77..83 */
146 327, 332, 337, 342, 347, /* 64..68 84..88 */
147 353, 358, 363, 368, 373, 378, 383, /* 69..75 89..95 */
148 389, 394, 399, 404, 409, /* 76..80 96..100 */
149 415, 420, 425, 430, 435, 440, 445, /* 81..87 101..107 */
150 451 /* 88 108 */
151};
152
153/*
154
155*/
156
157short asgkbtp[AK_WIDTH] = { /* keyboard icon top lines */
158
159 AKW_7, AKW_C, AKW_1, AKW_F,
160 AKW_7, AKW_C, AKW_1, AKW_F,
161 AKW_0, AKW_7, AKW_D, AKW_F,
162 AKW_0, AKW_7, AKW_C, AKW_1,
163 AKW_F, AKW_0, AKW_7, AKW_D,
164 AKW_F, AKW_0, AKW_7, AKW_C,
165 AKW_1, AKW_F,
166
167 AKW_7, AKW_C, AKW_1, AKW_F,
168 AKW_0, AKW_7, AKW_C, AKW_1,
169 AKW_F, AKW_7, AKW_C, AKW_1,
170 AKW_F, AKW_0, AKW_7, AKW_D,
171 AKW_F, AKW_0, AKW_7, AKW_C,
172 AKW_1, AKW_F, AKW_0, AKW_7,
173 AKW_D, AKW_F, AKW_0, AKW_7,
174 AKW_C, AKW_1, AKW_F,
175
176 AKW_7, AKW_C, AKW_1, AKW_F,
177 AKW_0, AKW_7, AKW_C, AKW_1,
178 AKW_F, AKW_7, AKW_C, AKW_1,
179 AKW_F, AKW_0, AKW_7, AKW_D,
180 AKW_F, AKW_0, AKW_7, AKW_C,
181 AKW_1, AKW_F, AKW_0, AKW_7,
182 AKW_D, AKW_F, AKW_0, AKW_7,
183 AKW_C, AKW_1, AKW_F,
184
185 AKW_7, AKW_C, AKW_1, AKW_F,
186 AKW_0, AKW_7, AKW_C, AKW_1,
187 AKW_F, AKW_7, AKW_C, AKW_1,
188 AKW_F, AKW_0, AKW_7, AKW_D,
189 AKW_F, AKW_0, AKW_7, AKW_C,
190 AKW_1, AKW_F, AKW_0, AKW_7,
191 AKW_D, AKW_F, AKW_E
192};
193
194/*
195
196*/
197
198short asgkbbt[AK_WIDTH] = { /* keyboard icon bottom lines */
199
200 AKW_7, AKW_F, AKW_7, AKW_F,
201 AKW_7, AKW_F, AKW_7, AKW_F,
202 AKW_B, AKW_F, AKW_D, AKW_F,
203 AKW_E, AKW_F, AKW_F, AKW_7,
204 AKW_F, AKW_B, AKW_F, AKW_D,
205 AKW_F, AKW_E, AKW_F, AKW_E,
206 AKW_F, AKW_F,
207
208 AKW_7, AKW_F, AKW_B, AKW_F,
209 AKW_D, AKW_F, AKW_E, AKW_F,
210 AKW_F, AKW_7, AKW_F, AKW_B,
211 AKW_F, AKW_B, AKW_F, AKW_D,
212 AKW_F, AKW_E, AKW_F, AKW_F,
213 AKW_7, AKW_F, AKW_B, AKW_F,
214 AKW_D, AKW_F, AKW_E, AKW_F,
215 AKW_E, AKW_F, AKW_F,
216
217 AKW_7, AKW_F, AKW_B, AKW_F,
218 AKW_D, AKW_F, AKW_E, AKW_F,
219 AKW_F, AKW_7, AKW_F, AKW_B,
220 AKW_F, AKW_B, AKW_F, AKW_D,
221 AKW_F, AKW_E, AKW_F, AKW_F,
222 AKW_7, AKW_F, AKW_B, AKW_F,
223 AKW_D, AKW_F, AKW_E, AKW_F,
224 AKW_E, AKW_F, AKW_F,
225
226 AKW_7, AKW_F, AKW_B, AKW_F,
227 AKW_D, AKW_F, AKW_E, AKW_F,
228 AKW_F, AKW_7, AKW_F, AKW_B,
229 AKW_F, AKW_B, AKW_F, AKW_D,
230 AKW_F, AKW_E, AKW_F, AKW_F,
231 AKW_7, AKW_F, AKW_B, AKW_F,
232 AKW_D, AKW_F, AKW_E
233};
234
235/*
236
237*/
238
239short asgpal[16][3] = { /* assignment editor color palette */
240
241 {0, 0, 0}, /* 0 */
242 {3, 3, 3}, /* 1 */
243 {0, 0, 2}, /* 2 */
244 {1, 0, 1}, /* 3 */
245 {0, 1, 2}, /* 4 */
246 {0, 1, 1}, /* 5 (was 0, 1, 0) */
247 {1, 1, 2}, /* 6 */
248 {0, 0, 1}, /* 7 */
249 {2, 2, 2}, /* 8 */
250 {0, 0, 0}, /* 9 */
251 {2, 2, 2}, /* 10 (was 1, 1, 0) */
252 {2, 3, 3}, /* 11 */
253 {3, 3, 0}, /* 12 */
254 {3, 0, 0}, /* 13 */
255 {0, 0, 0}, /* 14 */
256 {0, 2, 3} /* 15 (was 0, 3, 2) */
257};
258
259short dyntab[10] = { /* dynamics translation table */
260
261 0, /* 0 */
262 ( 120 << 5), /* 1 */
263 ( 180 << 5), /* 2 */
264 ( 250 << 5), /* 3 */
265 ( 320 << 5), /* 4 */
266 ( 400 << 5), /* 5 */
267 ( 500 << 5), /* 6 */
268 ( 630 << 5), /* 7 */
269 ( 790 << 5), /* 8 */
270 (1000 << 5) /* 9 */
271};
272
273/*
274
275*/
276
277/*
278 =============================================================================
279 advacur() -- advance the assignment display text cursor
280 =============================================================================
281*/
282
283advacur()
284{
285 register short newcol;
286
287 if (infield(stcrow, stccol, curfet))
288 cfetp = infetp;
289 else
290 return;
291
292 newcol = stccol + 1;
293
294 if (newcol LE cfetp->frcol)
295 itcpos(stcrow, newcol);
296
297 cxval = stccol << 3;
298 cyval = stcrow * 14;
299}
300
301/*
302 =============================================================================
303 bspacur() -- backspace the assignment display text cursor
304 =============================================================================
305*/
306
307bspacur()
308{
309 register short newcol;
310
311 if (infield(stcrow, stccol, curfet))
312 cfetp = infetp;
313 else
314 return;
315
316 newcol = stccol - 1;
317
318 if (newcol GE cfetp->flcol)
319 itcpos(stcrow, newcol);
320
321 cxval = stccol << 3;
322 cyval = stcrow * 14;
323}
324
325/*
326
327*/
328
329/*
330 =============================================================================
331 keycpyw() -- copy words into the keyboard object
332 =============================================================================
333*/
334
335keycpyw(dest, src, len, wk, bk)
336register unsigned *dest, *src;
337register short len;
338unsigned wk, bk;
339{
340 register unsigned wkey, bkey, theword;
341 register short i;
342
343 wkey = exp_c(wk);
344 bkey = exp_c(bk);
345
346 for (i = 0; i < len; i++) {
347
348 theword = *src++;
349 *dest++ = (theword & wkey) | ((~theword) & bkey);
350 }
351}
352
353/*
354
355*/
356
357/*
358 =============================================================================
359 asgkb() -- draw the assignment keyboard icon
360 =============================================================================
361*/
362
363asgkb()
364{
365 register unsigned *p;
366 register unsigned akline;
367 register short i, j;
368
369 akline = exp_c(AK_LINE);
370 p = asgob + (long)AKSTART;
371
372 for (j = 0; j < 12; j++) {
373
374 memsetw(p, akline, AK_WIDTH);
375 p += 128L;
376
377 for (i = 0; i < 13; i++) {
378
379 keycpyw(p, asgkbtp, AK_WIDTH, AK_WKEYT, AK_BKEYT);
380 p += 128L;
381 }
382 }
383
384 memsetw(p, akline, AK_WIDTH);
385 p += 128L;
386
387 for (i = 0; i < 14; i++) {
388
389 keycpyw(p, asgkbtp, AK_WIDTH, AK_WKEYB, AK_BKEYB);
390 p += 128L;
391 }
392
393 for (i = 0; i < 11; i++) {
394
395 keycpyw(p, asgkbbt, AK_WIDTH, AK_WKEYB, AK_BKEYB);
396 p += 128L;
397 }
398
399 memsetw(p, akline, AK_WIDTH);
400}
401
402/*
403
404*/
405
406/*
407 =============================================================================
408 drawk2g() -- display key assignments for a group
409 =============================================================================
410*/
411
412drawk2g(grp)
413register short grp;
414{
415 register short i;
416 register short n;
417 register short key;
418 register short line;
419 register char *bfsp;
420 register unsigned *lp;
421
422 n = 7; /* key to group window */
423
424 line = (14 * grp) + AK_BASE;
425 lp = asgob + ((long)line << 7) + 6L;
426
427 for (i = 0; i < 4; i++) {
428
429 keycpyw(lp, asgkbtp, AK_WIDTH, AK_WKEYT, AK_BKEYT);
430 lp += 128L;
431 }
432
433 if (grp2prt[grp][0] EQ 1) {
434
435 for (key = 0; key < 88; key++)
436 if (key2grp[key] & (0x0001 << grp))
437 vbfill4(asgob, 128, asgkble[key] + 24, line,
438 asgkble[key] + (key EQ 87 ? 31 : 28),
439 line + 3, exp_c(AK_SELC));
440
441 sprintf(bfs, "%c", (grp > 8) ? (grp + 163) : (grp + '1'));
442 bfsp = bfs;
443
444 } else {
445
446 bfsp = " ";
447 }
448
449 vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
450 adbox[n][6] + 1 + grp, adbox[n][7], bfsp, 14);
451
452 vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
453 adbox[n][6] + 1 + grp, adbox[n][7] + 61, bfsp, 14);
454}
455
456/*
457
458*/
459
460/*
461 =============================================================================
462 adpoint() -- plot a point for the lseg function
463 =============================================================================
464*/
465
466adpoint(x, y, pen)
467short x, y, pen;
468{
469 if (v_regs[5] & 0x0180)
470 vbank(0);
471
472 vputp(adoct, x, y, exp_c(pen));
473}
474
475/*
476 =============================================================================
477 numblk() -- return a number string or a blank string
478 =============================================================================
479*/
480
481char *
482numblk(buf, n)
483char *buf;
484short n;
485{
486 if (n EQ -1) {
487
488 strcpy(buf, " ");
489 return(buf);
490
491 } else {
492
493 sprintf(buf, "%02.2d", n);
494 return(buf);
495 }
496}
497
498/*
499
500*/
501
502/*
503 =============================================================================
504 adswin() -- display a window
505 =============================================================================
506*/
507
508adswin(n)
509register short n;
510{
511 register short cx, i;
512 register char *bfsp;
513 char buf1[4], buf2[4];
514
515 if ((n EQ 7) AND (admctl NE -1))
516 return;
517
518 cx = exp_c(adbox[n][5]);
519 point = adpoint;
520
521 /* first, fill the box with the background color */
522
523 vbank(0);
524 vbfill4(asgob, 128, adbox[n][0], adbox[n][1], adbox[n][2],
525 adbox[n][3], cx);
526
527 /* put in the box label */
528
529 tsplot4(asgob, 64, adbox[n][4], adbox[n][6], adbox[n][7],
530 adbxlb[n], 14);
531
532/*
533
534*/
535 switch (n) { /* final text - overlays above stuff */
536
537 case 0: /* assignment table number and name */
538
539 sprintf(bfs, "%02.2d", curasg);
540 tsplot4(asgob, 64, (asgmod ? AK_MODC : adbox[n][4]),
541 adbox[n][6], adbox[n][7] + 8, bfs, 14);
542
543 sprintf(bfs, "%-10.10s", caname);
544 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 1,
545 adbox[n][7], bfs, 14);
546
547 return;
548
549 case 2: /* output MIDI port number */
550
551 tsplot4(asgob, 64, adbox[n][4], adbox[n][6], adbox[n][7] + 9,
552 gprep[curmop], 14);
553
554 return;
555
556 case 3: /* MIDI program change channel (always on port 1) */
557
558 sprintf(bfs, "%02.2d", prgchan);
559 tsplot4(asgob, 64, adbox[n][4], adbox[n][6], adbox[n][7] + 8,
560 bfs, 14);
561
562 return;
563/*
564
565*/
566 case 4: /* groups to voices */
567
568 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 1, adbox[n][7],
569 "of Groups", 14);
570
571 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 2, adbox[n][7],
572 "to Voices", 14);
573
574 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 3, adbox[n][7],
575 "V Gr V Gr", 14);
576
577 lseg(CTOX(13), RTOY(3) + 13,
578 CTOX(13) + 7, RTOY(3) + 13, adbox[n][4]);
579
580 lseg(CTOX(15), RTOY(3) + 13,
581 CTOX(16) + 7, RTOY(3) + 13, adbox[n][4]);
582
583 lseg(CTOX(19), RTOY(3) + 13,
584 CTOX(19) + 7, RTOY(3) + 13, adbox[n][4]);
585
586 lseg(CTOX(21), RTOY(3) + 13,
587 CTOX(22) + 7, RTOY(3) + 13, adbox[n][4]);
588
589 for (i = 0; i < 6; i++) {
590
591 sprintf(bfs, "%c %s", i + '1',
592 numblk(buf1, vce2grp[i]));
593
594 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + i + 4,
595 adbox[n][7], bfs, 14);
596
597 sprintf(bfs, "%c %s", (i > 2 ? (i + 169) : (i + '7')),
598 numblk(buf2, vce2grp[i + 6]));
599
600 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + i + 4,
601 adbox[n][7] + 6, bfs, 14);
602 }
603
604 return;
605/*
606
607*/
608 case 5: /* MIDI controller number assignments */
609
610 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 1, adbox[n][7],
611 "Sources and", 14);
612
613 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 2, adbox[n][7],
614 "Controllers", 14);
615
616 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 3, adbox[n][7],
617 "# Source CN", 14);
618
619 lseg(CTOX(25), RTOY(3) + 13,
620 CTOX(25) + 7, RTOY(3) + 13, adbox[n][4]);
621
622 lseg(CTOX(27), RTOY(3) + 13,
623 CTOX(33) + 7, RTOY(3) + 13, adbox[n][4]);
624
625 lseg(CTOX(35), RTOY(3) + 13,
626 CTOX(36) + 7, RTOY(3) + 13, adbox[n][4]);
627
628 for (i = 0; i < 6; i++)
629 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + i + 4,
630 adbox[n][7], asgsrc[i], 14);
631
632 for (i = 0; i < 4; i++) {
633
634 sprintf(bfs, "%s", numblk(buf1, (mctlnum[i] & 0x00FF)));
635
636 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + i + 5,
637 adbox[n][7] + 10, bfs, 14);
638
639 if ((mctlnum[i] NE -1) AND (mctlnum[i] & CTAG1)) {
640
641 bfs[0] = '2' + i;
642 bfs[1] = '\0';
643
644 tsplot4(asgob, 64, AK_MODC, adbox[n][6] + i + 5,
645 adbox[n][7], bfs, 14);
646 }
647 }
648
649 return;
650/*
651
652*/
653 case 6: /* instruments, dynamics, MIDI ports and channels to groups */
654
655 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 1, adbox[n][7],
656 "Dynamics, MIDI Ports and", 14);
657
658 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 2, adbox[n][7],
659 "Channels to Groups", 14);
660
661 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 3, adbox[n][7],
662 "G In D I Ch G In D I Ch", 14);
663
664 lseg(CTOX(39), RTOY(3) + 13,
665 CTOX(39) + 7, RTOY(3) + 13, adbox[n][4]);
666
667 lseg(CTOX(41), RTOY(3) + 13,
668 CTOX(42) + 7, RTOY(3) + 13, adbox[n][4]);
669
670 lseg(CTOX(44), RTOY(3) + 13,
671 CTOX(44) + 7, RTOY(3) + 13, adbox[n][4]);
672
673 lseg(CTOX(46), RTOY(3) + 13,
674 CTOX(46) + 7, RTOY(3) + 13, adbox[n][4]);
675
676 lseg(CTOX(48), RTOY(3) + 13,
677 CTOX(49) + 7, RTOY(3) + 13, adbox[n][4]);
678
679
680 lseg(CTOX(52), RTOY(3) + 13,
681 CTOX(52) + 7, RTOY(3) + 13, adbox[n][4]);
682
683 lseg(CTOX(54), RTOY(3) + 13,
684 CTOX(55) + 7, RTOY(3) + 13, adbox[n][4]);
685
686 lseg(CTOX(57), RTOY(3) + 13,
687 CTOX(57) + 7, RTOY(3) + 13, adbox[n][4]);
688
689 lseg(CTOX(59), RTOY(3) + 13,
690 CTOX(59) + 7, RTOY(3) + 13, adbox[n][4]);
691
692 lseg(CTOX(61), RTOY(3) + 13,
693 CTOX(62) + 7, RTOY(3) + 13, adbox[n][4]);
694
695/*
696
697*/
698 for (i = 0; i < 6; i++) {
699
700 sprintf(bfs, "%c %02.2d %d %s %s %c %02.2d %d %s %s",
701
702 i + '1',
703 (ins2grp[i] & 0x00FF), grpdyn[i],
704 gprep[grp2prt[i][0]],
705 numblk(buf1, grp2prt[i][1]),
706
707 ((i > 2) ? (i + 169) : (i + '7')),
708 (ins2grp[i + 6] & 0x00FF), grpdyn[i + 6],
709 gprep[grp2prt[i + 6][0]],
710 numblk(buf2, grp2prt[i + 6][1]));
711
712 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + i + 4,
713 adbox[n][7], bfs, 14);
714
715 if (GTAG1 & ins2grp[i]) {
716
717 bfs[1] = '\0';
718
719 tsplot4(asgob, 64, AK_MODC, adbox[n][6] + i + 4,
720 adbox[n][7], bfs, 14);
721 }
722
723 if (GTAG1 & ins2grp[i + 6]) {
724
725 bfs[14] = '\0';
726
727 tsplot4(asgob, 64, AK_MODC, adbox[n][6] + i + 4,
728 adbox[n][7] + 13, &bfs[13], 14);
729 }
730 }
731
732 return;
733/*
734
735*/
736 case 7: /* port 1 key to group assignments */
737
738 lseg( 8, 153, 15, 153, exp_c(adbox[n][4])); /* underlines */
739 lseg(496, 153, 503, 153, exp_c(adbox[n][4]));
740
741 asgkb(); /* icon */
742
743 for (i = 0; i < 12; i++) /* assignments */
744 drawk2g(i);
745
746 return;
747
748 case 8: /* aux control */
749
750 tsplot4(asgob, 64, (auxctl ? AK_MODC : adbox[n][4]),
751 adbox[n][6], adbox[n][7], "Aux", 14);
752
753 return;
754
755 case 9: /* tuning table */
756
757 tsplot4(asgob, 64, adbox[n][4], adbox[n][6], adbox[n][7],
758 "Tun", 14);
759
760 sprintf(bfs, "%d", curtun);
761 tsplot4(asgob, 64, (tunmod ? AK_MODC : adbox[n][4]),
762 adbox[n][6], adbox[n][7] + 4, bfs, 14);
763
764 return;
765
766 case 10: /* phase shifter variables -- intensity, rate depth */
767
768 sprintf(bfs, "Intnsty %02.2d", ps_intn);
769 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 1, adbox[n][7],
770 bfs, 14);
771
772 sprintf(bfs, "ModRate %02.2d", ps_rate);
773 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 2, adbox[n][7],
774 bfs, 14);
775
776 sprintf(bfs, "ModDpth %02.2d", ps_dpth);
777 tsplot4(asgob, 64, adbox[n][4], adbox[n][6] + 3, adbox[n][7],
778 bfs, 14);
779
780 return;
781 }
782}
783
784/*
785
786*/
787
788/*
789 =============================================================================
790 initat() -- initialize assignment table
791 =============================================================================
792*/
793
794initat(n)
795short n;
796{
797 register struct asgent *ap;
798 register short i;
799
800 ap = &asgtab[n];
801 ap->a_mop = 0; /* output to NULL */
802 ap->a_tun = 0; /* tuning = default */
803 ap->a_aux = 0; /* aux ctl = OFF */
804 ap->a_intn = 70; /* intensity */
805 ap->a_rate = 0; /* rate */
806 ap->a_dpth = 70; /* depth */
807
808 for (i = 0; i < 12; i++) { /* groups 1..12 */
809
810 ap->a_i2grp[i] = 0; /* instrument */
811 ap->a_gpdyn[i] = 9; /* dynamics */
812 }
813
814 for (i = 0; i < 8; i++) /* voices 1..8 to group 1 */
815 ap->a_v2grp[i] = 1;
816
817 for (i = 8; i < 12; i++) /* voices 9..12 to group 2 */
818 ap->a_v2grp[i] = 2;
819
820 ap->a_mctln[0] = 1; /* modulation wheel */
821 ap->a_mctln[1] = 2; /* breath controller */
822 ap->a_mctln[2] = 80; /* general controller 1 */
823 ap->a_mctln[3] = 4; /* pedal controller 1 */
824
825 ap->a_g2prt[0][0] = 1; /* group 1: port 1 input */
826 ap->a_g2prt[0][1] = 1; /* group 1: channel 1 in and out */
827 ap->a_g2prt[1][0] = 3; /* group 2: local input */
828 ap->a_g2prt[1][1] = 1; /* group 2: channel 1 in and out*/
829
830 for (i = 2; i < 12; i++) { /* groups 3..12 */
831
832 ap->a_g2prt[i][0] = 0; /* no input port */
833 ap->a_g2prt[i][1] = -1; /* no channel */
834 }
835
836 memsetw(ap->a_k2grp, 0x0001, 88); /* all keys in group 1 */
837
838 memcpy(ap->a_name, n ? "{unused} " : "{Default} ", 16);
839}
840
841/*
842
843*/
844
845/*
846 =============================================================================
847 setaux() -- set aux control
848 =============================================================================
849*/
850
851setaux(aux)
852register short aux;
853{
854 register short psgdata;
855 register char *psg;
856
857 auxctl = aux;
858 psg = &io_tone;
859
860 *(psg + PSG_ADDR) = PSG_IOEN; /* setup PSG I/O controls */
861 *(psg + PSG_WRIT) = PSG_IDLE;
862
863 *(psg + PSG_ADDR) = PSG_PRTB; /* read current psg data */
864 psgdata = *(psg + PSG_READ) & ~AUX_BIT;
865
866 *(psg + PSG_ADDR) = PSG_PRTB; /* send out updated aux data */
867 *(psg + PSG_WRIT) = psgdata | (aux ? 0 : AUX_BIT);
868}
869
870/*
871
872*/
873
874/*
875 =============================================================================
876 getasg() -- get an assignment table from the library
877 =============================================================================
878*/
879
880getasg(n)
881short n;
882{
883 register struct asgent *ap;
884 register short i, grp, vce;
885
886 ap = &asgtab[n];
887 curmop = ap->a_mop;
888 gettun(ap->a_tun);
889 setaux(ap->a_aux);
890 ps_intn = ap->a_intn;
891 ps_rate = ap->a_rate;
892 ps_dpth = ap->a_dpth;
893 memcpyw(ins2grp, ap->a_i2grp, sizeof ins2grp / 2);
894 memcpyw(grpdyn, ap->a_gpdyn, sizeof grpdyn / 2);
895 memcpyw(vce2grp, ap->a_v2grp, sizeof vce2grp / 2);
896 memcpyw(mctlnum, ap->a_mctln, sizeof mctlnum / 2);
897 memcpyw(grp2prt, ap->a_g2prt, sizeof grp2prt / 2);
898 memcpyw(key2grp, ap->a_k2grp, sizeof key2grp / 2);
899 memcpy(caname, ap->a_name, 16);
900
901 for (i = 0; i < 12; i++) /* fix old tables */
902 if (grp2prt[i][0] EQ 4)
903 grp2prt[i][0] = 3;
904
905 sendval(1, 0, (ps_intn * 10) << 5);
906 sendval(2, 0, (ps_rate * 10) << 5);
907 sendval(3, 0, (ps_dpth * 10) << 5);
908
909 for (vce = 0; vce < 12; vce++) {
910
911 grp = vce2grp[vce];
912
913 if (grp NE -1) {
914
915 s_inst[vce] = ins2grp[grp - 1] & 0x00FF;
916 execins(vce, s_inst[vce], 1);
917 sendval(vce, 8, dyntab[grpdyn[grp - 1]]);
918 }
919 }
920
921 newvce(curvce);
922 asgmod = FALSE;
923}
924
925/*
926
927*/
928
929/*
930 =============================================================================
931 putasg() -- put an assignment table into the library
932 =============================================================================
933*/
934
935putasg(n)
936short n;
937{
938 register struct asgent *ap;
939 register short i;
940
941 for (i = 0; i < 12; i++) /* fix old tables */
942 if (grp2prt[i][0] EQ 4)
943 grp2prt[i][0] = 3;
944
945 ap = &asgtab[n];
946 ap->a_mop = curmop;
947 ap->a_tun = curtun;
948 ap->a_aux = auxctl;
949 ap->a_intn = ps_intn;
950 ap->a_rate = ps_rate;
951 ap->a_dpth = ps_dpth;
952 memcpyw(ap->a_i2grp, ins2grp, sizeof ins2grp / 2);
953 memcpyw(ap->a_gpdyn, grpdyn, sizeof grpdyn / 2);
954 memcpyw(ap->a_v2grp, vce2grp, sizeof vce2grp / 2);
955 memcpyw(ap->a_mctln, mctlnum, sizeof mctlnum / 2);
956 memcpyw(ap->a_g2prt, grp2prt, sizeof grp2prt / 2);
957 memcpyw(ap->a_k2grp, key2grp, sizeof key2grp / 2);
958 memcpy(ap->a_name, caname, 16);
959 asgmod = FALSE;
960}
961
962/*
963
964*/
965
966/*
967 =============================================================================
968 awins() -- display all assignment editor windows
969 =============================================================================
970*/
971
972awins()
973{
974 register short i;
975
976 for (i = 0; i < 11; i++)
977 adswin(i);
978}
979
980/*
981 =============================================================================
982 inital() -- initialize assignment library
983 =============================================================================
984*/
985
986inital()
987{
988 register short n;
989
990 for (n = 0; n < NASGS; n++)
991 initat(n);
992
993 getasg(0);
994 prgchan = 1;
995}
996
997/*
998
999*/
1000
1001/*
1002 =============================================================================
1003 adbord() -- draw the border for the display
1004 =============================================================================
1005*/
1006
1007adbord()
1008{
1009 point = adpoint;
1010
1011 lseg( 0, 0, 511, 0, AK_BORD); /* outer border */
1012 lseg(511, 0, 511, 349, AK_BORD);
1013 lseg(511, 349, 0, 349, AK_BORD);
1014 lseg( 0, 349, 0, 0, AK_BORD);
1015
1016 lseg( 0, 41, 95, 41, AK_BORD); /* windows - H lines */
1017 lseg( 0, 55, 95, 55, AK_BORD);
1018 lseg( 0, 69, 95, 69, AK_BORD);
1019 lseg( 0, 83, 95, 83, AK_BORD);
1020 lseg( 0, 139, 511, 139, AK_BORD);
1021
1022 lseg( 39, 69, 39, 83, AK_BORD); /* windows - V lines */
1023 lseg( 95, 0, 95, 139, AK_BORD);
1024 lseg(191, 0, 191, 139, AK_BORD);
1025 lseg(303, 0, 303, 139, AK_BORD);
1026}
1027
1028/*
1029
1030*/
1031
1032/*
1033 =============================================================================
1034 asgdsp() -- put up the assignment display
1035 =============================================================================
1036*/
1037
1038asgdsp()
1039{
1040 asgob = v_score; /* setup object pointer */
1041 obj0 = v_curs0; /* setup cursor object pointer */
1042 obj2 = v_tcur; /* setup typewriter object pointer */
1043 adoct = &v_obtab[ASGOBJ]; /* setup object control table pointer */
1044
1045 adnamsw = FALSE; /* virtual typewriter not up */
1046 submenu = FALSE; /* no submenu cursor up */
1047 admctl = -1; /* no submenu up */
1048
1049 dswap(); /* initialize display */
1050
1051 vbank(0); /* clear the display */
1052 memsetw(asgob, 0, 32767);
1053 memsetw(asgob+32767L, 0, 12033);
1054
1055 SetObj(ASGOBJ, 0, 0, asgob, 512, 350, 0, 0, ASGNFL, -1);
1056 SetObj( 0, 0, 1, obj0, 16, 16, CTOX(9), RTOY(0), OBFL_00, -1);
1057 SetObj(TTCURS, 0, 1, obj2, 16, 16, 0, 0, TTCCFL, -1);
1058
1059 arcurs(AK_CURS); /* setup arrow cursor object */
1060 itcini(AK_CURS); /* setup text cursor object */
1061 ttcini(AK_CURS); /* setup virtual typewriter cursor object */
1062
1063 adbord(); /* draw the border */
1064 awins(); /* fill in the windows */
1065
1066 SetPri(ASGOBJ, ASGPRI); /* enable screen object */
1067
1068 settc(0, 9); /* display text cursor */
1069
1070 vsndpal(asgpal); /* set the palette */
1071}
Note: See TracBrowser for help on using the repository browser.