1 | /*
|
---|
2 | =============================================================================
|
---|
3 | ptfield.c -- MIDAS-VII patch display field functions
|
---|
4 | Version 35 -- 1989-11-16 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #define DEBUGXP 0
|
---|
9 |
|
---|
10 | #define USEVECTR 0 /* to force vector cursor control */
|
---|
11 |
|
---|
12 | #include "stddefs.h"
|
---|
13 | #include "hwdefs.h"
|
---|
14 | #include "graphdef.h"
|
---|
15 | #include "vsdd.h"
|
---|
16 | #include "fields.h"
|
---|
17 | #include "curpak.h"
|
---|
18 | #include "patch.h"
|
---|
19 | #include "macros.h"
|
---|
20 |
|
---|
21 | #include "midas.h"
|
---|
22 | #include "ptdisp.h"
|
---|
23 |
|
---|
24 | #if DEBUGXP
|
---|
25 | extern short debugsw;
|
---|
26 |
|
---|
27 | short debugxp = 1;
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | #if USEVECTR
|
---|
31 | short usevect = TRUE;
|
---|
32 |
|
---|
33 | extern short (*cx_key)(), (*cy_key)();
|
---|
34 | #endif
|
---|
35 |
|
---|
36 | extern short (*xy_up)(), (*xy_dn)();
|
---|
37 | extern short (*premove)(), (*pstmove)();
|
---|
38 | extern short (*curtype)();
|
---|
39 |
|
---|
40 | extern unsigned short fromfpu();
|
---|
41 |
|
---|
42 | extern short select(), nokey(), stdctp5();
|
---|
43 | extern short cxkstd(), cykstd(), stdmkey(), stddkey();
|
---|
44 | extern short stopcm(), smxupd(), smyupd();
|
---|
45 | extern short aftercm();
|
---|
46 | extern short ptdkey();
|
---|
47 |
|
---|
48 | extern short astat;
|
---|
49 | extern short chtime;
|
---|
50 | extern short chwait;
|
---|
51 | extern short cmfirst;
|
---|
52 | extern short cmtype;
|
---|
53 | extern short curhold;
|
---|
54 | extern short cvtime;
|
---|
55 | extern short cvwait;
|
---|
56 | extern short ncvwait;
|
---|
57 | extern short ptbflag;
|
---|
58 | extern short ptecpos;
|
---|
59 | extern short ptedef;
|
---|
60 | extern short ptedfok;
|
---|
61 | extern short pteset;
|
---|
62 | extern short ptestm;
|
---|
63 | extern short ptestok;
|
---|
64 | extern short ss_ptsw;
|
---|
65 | extern short ss_sqsw;
|
---|
66 | extern short stccol;
|
---|
67 | extern short stcrow;
|
---|
68 | extern short syrate;
|
---|
69 | extern short tvcwval;
|
---|
70 | extern short vcwval;
|
---|
71 |
|
---|
72 | extern short crate1[];
|
---|
73 |
|
---|
74 | extern char ptdebuf[];
|
---|
75 |
|
---|
76 | extern struct selbox *csbp;
|
---|
77 | extern struct selbox ptboxes[];
|
---|
78 |
|
---|
79 | extern struct patch ptebuf;
|
---|
80 |
|
---|
81 | short ptxkey(); /* forward reference */
|
---|
82 | short ptmkey(); /* forward reference */
|
---|
83 | short ptekey(); /* forward reference */
|
---|
84 |
|
---|
85 | /* |
---|
86 |
|
---|
87 | */
|
---|
88 |
|
---|
89 | char *trdata[] = { "Trans", "Stop ", "Start" };
|
---|
90 | char *ssdata[] = { "Stop ", "Start" };
|
---|
91 |
|
---|
92 | char *stdata[] = { "Srce" , "Mult", "Time", "Valu", "Func" };
|
---|
93 |
|
---|
94 | char *smdata[] = {
|
---|
95 |
|
---|
96 | " ", /* SM_NONE 0 No source - always 0 */
|
---|
97 | "Randm", /* SM_RAND 1 Random source */
|
---|
98 | "GPC/V", /* SM_CTL1 2 Control Voltage 1 / MIDI GPC 1 */
|
---|
99 | "??3??", /* ------- 3 -unused- */
|
---|
100 | "??4??", /* ------- 4 -unused- */
|
---|
101 | "Pitch", /* SM_PTCH 5 Key Pitch */
|
---|
102 | "KeyPr", /* SM_KPRS 6 Key Pressure */
|
---|
103 | "KeyVL", /* SM_KVEL 7 Key Velocity */
|
---|
104 | "Pedal", /* SM_PED1 8 Pedal 1 */
|
---|
105 | "??9??", /* ------- 9 -unused- */
|
---|
106 | "Freq ", /* SM_FREQ 10 Key Frequency */
|
---|
107 | "PchWh", /* SM_HTPW 11 Tablet X / MIDI Pitch Wheel */
|
---|
108 | "ModWh", /* SM_VTMW 12 Tablet Y / MIDI Mod Wheel */
|
---|
109 | "Breth", /* SM_LPBR 13 LongPot / MIDI Breath Controller */
|
---|
110 | };
|
---|
111 |
|
---|
112 | struct curpak pt_flds = {
|
---|
113 |
|
---|
114 | stdctp5, /* curtype */
|
---|
115 | nokey, /* premove */
|
---|
116 | aftercm, /* pstmove */
|
---|
117 | cxkstd, /* cx_key */
|
---|
118 | cykstd, /* cy_key */
|
---|
119 | smxupd, /* cx_upd */
|
---|
120 | smyupd, /* cy_upd */
|
---|
121 | stopcm, /* xy_up */
|
---|
122 | nokey, /* xy_dn */
|
---|
123 | ptxkey, /* x_key */
|
---|
124 | ptekey, /* e_key */
|
---|
125 | ptmkey, /* m_key */
|
---|
126 | ptdkey, /* d_key */
|
---|
127 | nokey, /* not_fld */
|
---|
128 | (struct fet *)NULL, /* curfet */
|
---|
129 | ptboxes, /* csbp */
|
---|
130 | crate1, /* cratex */
|
---|
131 | crate1, /* cratey */
|
---|
132 | CT_SMTH, /* cmtype */
|
---|
133 | CTOX(2), /* cxval */
|
---|
134 | RTOY(DATAROW) /* cyval */
|
---|
135 | };
|
---|
136 |
|
---|
137 | /* |
---|
138 |
|
---|
139 | */
|
---|
140 |
|
---|
141 | /*
|
---|
142 | =============================================================================
|
---|
143 | ptmkey() -- M key processing for the patch display
|
---|
144 | =============================================================================
|
---|
145 | */
|
---|
146 |
|
---|
147 | ptmkey()
|
---|
148 | {
|
---|
149 | register short nc;
|
---|
150 |
|
---|
151 | if (astat) {
|
---|
152 |
|
---|
153 | if (stccol EQ 48) {
|
---|
154 |
|
---|
155 | if (ss_sqsw EQ 0) {
|
---|
156 |
|
---|
157 | (*xy_dn)(); /* handle KEY_DOWN functions */
|
---|
158 |
|
---|
159 | (*premove)(); /* handle PRE-MOVE functions */
|
---|
160 |
|
---|
161 | nc = (*curtype)(); /* get new CURSOR TYPE wanted */
|
---|
162 |
|
---|
163 | cvtime = syrate;
|
---|
164 | ncvwait = curhold;
|
---|
165 |
|
---|
166 | ss_ptsw = -1;
|
---|
167 | cmtype = nc;
|
---|
168 | cvwait = 1;
|
---|
169 | }
|
---|
170 |
|
---|
171 | } else
|
---|
172 | stdmkey();
|
---|
173 |
|
---|
174 | } else {
|
---|
175 |
|
---|
176 | if (stccol EQ 48) {
|
---|
177 |
|
---|
178 | ss_ptsw = 0;
|
---|
179 | cvwait = 1;
|
---|
180 | ncvwait = cvtime;
|
---|
181 | cmfirst = TRUE;
|
---|
182 |
|
---|
183 | if (ss_sqsw EQ 0)
|
---|
184 | (*xy_up)();
|
---|
185 |
|
---|
186 | (*pstmove)(); /* handle POST-MOVE functions */
|
---|
187 |
|
---|
188 | } else
|
---|
189 | stdmkey();
|
---|
190 | }
|
---|
191 | }
|
---|
192 |
|
---|
193 | /* |
---|
194 |
|
---|
195 | */
|
---|
196 |
|
---|
197 | /*
|
---|
198 | =============================================================================
|
---|
199 | ptekey() -- E key processing for the patch display
|
---|
200 | =============================================================================
|
---|
201 | */
|
---|
202 |
|
---|
203 | ptekey()
|
---|
204 | {
|
---|
205 | register short nc;
|
---|
206 |
|
---|
207 | if (astat) {
|
---|
208 |
|
---|
209 | if (stccol EQ 48) {
|
---|
210 |
|
---|
211 | if (ss_sqsw EQ 0) {
|
---|
212 |
|
---|
213 | (*xy_dn)(); /* handle KEY_DOWN functions */
|
---|
214 |
|
---|
215 | (*premove)(); /* handle PRE-MOVE functions */
|
---|
216 |
|
---|
217 | nc = (*curtype)(); /* get new CURSOR TYPE wanted */
|
---|
218 |
|
---|
219 | cvtime = syrate;
|
---|
220 | ncvwait = curhold;
|
---|
221 |
|
---|
222 | ss_ptsw = 1;
|
---|
223 | cmtype = nc;
|
---|
224 | cvwait = 1;
|
---|
225 | }
|
---|
226 |
|
---|
227 | } else
|
---|
228 | select();
|
---|
229 |
|
---|
230 | } else {
|
---|
231 |
|
---|
232 | if (stccol EQ 48) {
|
---|
233 |
|
---|
234 | ss_ptsw = 0;
|
---|
235 | cvwait = 1;
|
---|
236 | ncvwait = cvtime;
|
---|
237 | cmfirst = TRUE;
|
---|
238 |
|
---|
239 | if (ss_sqsw EQ 0)
|
---|
240 | (*xy_up)();
|
---|
241 |
|
---|
242 | (*pstmove)(); /* handle POST-MOVE functions */
|
---|
243 |
|
---|
244 | } else
|
---|
245 | select();
|
---|
246 | }
|
---|
247 | }
|
---|
248 |
|
---|
249 | /* |
---|
250 |
|
---|
251 | */
|
---|
252 |
|
---|
253 | /*
|
---|
254 | =============================================================================
|
---|
255 | ptxkey() -- X key processing for the patch display
|
---|
256 | =============================================================================
|
---|
257 | */
|
---|
258 |
|
---|
259 | ptxkey()
|
---|
260 | {
|
---|
261 | register short i, cp, pp, sp, stm;
|
---|
262 |
|
---|
263 | if (NOT astat) /* only on key closures ... */
|
---|
264 | return;
|
---|
265 |
|
---|
266 | if (inrange(stccol, 2, 13)) { /* definer -- clear definer */
|
---|
267 |
|
---|
268 | if (ptecpos AND NOT ptbflag) { /* refresh data entry stuff */
|
---|
269 |
|
---|
270 | memcpyw(&ptebuf.defnum, &patches[ptecpos].defnum, 6);
|
---|
271 | pteset = TRUE;
|
---|
272 | pte2buf();
|
---|
273 | }
|
---|
274 |
|
---|
275 | ptedef = NULL_DEF;
|
---|
276 | ptedfok = TRUE;
|
---|
277 |
|
---|
278 | memset(&ptdebuf[2], ' ', 12);
|
---|
279 |
|
---|
280 | for (i = 0; i < 48; i++)
|
---|
281 | if (ptdebuf[i] EQ '\0')
|
---|
282 | ptdebuf[i] = ' ';
|
---|
283 |
|
---|
284 | ptdebuf[0] = '\260';
|
---|
285 | ptdebuf[48] = '\0';
|
---|
286 |
|
---|
287 | UpdVid(7, 0, ptdebuf, PTEATR);
|
---|
288 | movectc(stcrow, stccol);
|
---|
289 |
|
---|
290 | /* |
---|
291 |
|
---|
292 | */
|
---|
293 | } else if (inrange(stccol, 15, 26)) { /* stimulus -- clear stimulus */
|
---|
294 |
|
---|
295 | if (ptecpos AND NOT ptbflag) { /* refresh data entry stuff */
|
---|
296 |
|
---|
297 | memcpyw(&ptebuf.defnum, &patches[ptecpos].defnum, 6);
|
---|
298 | pteset = TRUE;
|
---|
299 | pte2buf();
|
---|
300 | }
|
---|
301 |
|
---|
302 | ptestm = NULL_DEF;
|
---|
303 | ptestok = FALSE;
|
---|
304 |
|
---|
305 | memset(&ptdebuf[15], ' ', 12);
|
---|
306 |
|
---|
307 | for (i = 0; i < 48; i++)
|
---|
308 | if (ptdebuf[i] EQ '\0')
|
---|
309 | ptdebuf[i] = ' ';
|
---|
310 |
|
---|
311 | ptdebuf[0] = '\260';
|
---|
312 | ptdebuf[48] = '\0';
|
---|
313 |
|
---|
314 | UpdVid(7, 0, ptdebuf, PTEATR);
|
---|
315 | movectc(stcrow, stccol);
|
---|
316 |
|
---|
317 | } else if (inrange(stccol, 28, 40)) { /* destination -- clear line */
|
---|
318 |
|
---|
319 | voidpb(); /* void the patch buffer */
|
---|
320 |
|
---|
321 | ptdebuf[0] = '\260';
|
---|
322 | ptdebuf[48] = '\0';
|
---|
323 |
|
---|
324 | UpdVid(7, 0, ptdebuf, PTEATR);
|
---|
325 | movectc(stcrow, stccol);
|
---|
326 | /* |
---|
327 |
|
---|
328 | */
|
---|
329 | } else if (inrange(stccol, 42, 46)) { /* datum -- delete the patch */
|
---|
330 |
|
---|
331 | if (ptecpos) {
|
---|
332 |
|
---|
333 | cp = ptecpos; /* setup indices */
|
---|
334 | pp = patches[cp].prevstm;
|
---|
335 | sp = patches[cp].nextstm;
|
---|
336 |
|
---|
337 | stm = patches[cp].stmnum; /* get stimulus used */
|
---|
338 | #if DEBUGXP
|
---|
339 | if (debugsw AND debugxp)
|
---|
340 | printf("ptxkey(): DELETING PATCH pp = %d cp = %d sp = %d\n",
|
---|
341 | pp, cp, sp);
|
---|
342 | #endif
|
---|
343 |
|
---|
344 | if (pp) /* adjust predecessor */
|
---|
345 | patches[pp].nextstm = sp;
|
---|
346 | else /* adjust stmptr */
|
---|
347 | stmptr[TRG_MASK & stm] = sp;
|
---|
348 |
|
---|
349 | if (sp) /* adjust successor */
|
---|
350 | patches[sp].prevstm = pp;
|
---|
351 |
|
---|
352 | if (sp = findnxt(cp)) /* adjust ptecpos */
|
---|
353 | ptecpos = sp;
|
---|
354 | else if (pp = findprv(cp))
|
---|
355 | ptecpos = pp;
|
---|
356 | else
|
---|
357 | ptecpos = 0;
|
---|
358 |
|
---|
359 | pt_del(cp); /* delete the patch entry */
|
---|
360 | /* |
---|
361 |
|
---|
362 | */
|
---|
363 | for (i = 0; i < NDEFSTMS; ++i) { /* adjust defptr list */
|
---|
364 |
|
---|
365 | if (cp = defptr[i]) { /* in use ? */
|
---|
366 |
|
---|
367 | pp = 0; /* initial predecessor */
|
---|
368 |
|
---|
369 | while (cp) { /* check the chain */
|
---|
370 |
|
---|
371 | sp = defents[cp].nextdef; /* successor */
|
---|
372 |
|
---|
373 | if (defents[cp].stm EQ stm) {
|
---|
374 |
|
---|
375 | #if DEBUGXP
|
---|
376 | if (debugsw AND debugxp) {
|
---|
377 |
|
---|
378 | printf("ptxkey(): DELETING DEF trg=$%04.4X stm=$%04.4X\n",
|
---|
379 | i, stm);
|
---|
380 |
|
---|
381 | printf("ptxkey(): DELETING DEF pp=%d cp=%d sp=%d\n",
|
---|
382 | pp, cp, sp);
|
---|
383 | }
|
---|
384 | #endif
|
---|
385 |
|
---|
386 | if (pp) /* adjust predecessor */
|
---|
387 | defents[pp].nextdef = sp;
|
---|
388 | else /* adjust defptr */
|
---|
389 | defptr[i] = sp;
|
---|
390 |
|
---|
391 | dt_del(cp); /* delete def entry */
|
---|
392 |
|
---|
393 | } else {
|
---|
394 |
|
---|
395 | pp = cp; /* update predecessor index */
|
---|
396 | }
|
---|
397 |
|
---|
398 | cp = sp; /* next defent */
|
---|
399 | }
|
---|
400 | }
|
---|
401 | }
|
---|
402 |
|
---|
403 | dptw(); /* update the display */
|
---|
404 | }
|
---|
405 | }
|
---|
406 | }
|
---|
407 |
|
---|
408 | /* |
---|
409 |
|
---|
410 | */
|
---|
411 |
|
---|
412 | /*
|
---|
413 | =============================================================================
|
---|
414 | dspdfst() -- convert a patch DEF or STM value for display
|
---|
415 | =============================================================================
|
---|
416 | */
|
---|
417 |
|
---|
418 | dspdfst(buf, val)
|
---|
419 | char *buf;
|
---|
420 | register unsigned short val;
|
---|
421 | {
|
---|
422 | register unsigned short chan, port, stim;
|
---|
423 |
|
---|
424 | if (val EQ NULL_DEF) { /* handle possible blank definer */
|
---|
425 |
|
---|
426 | strcpy(buf, " ");
|
---|
427 | return;
|
---|
428 | }
|
---|
429 |
|
---|
430 | port = (val >> 11) & 0x0003;
|
---|
431 | chan = (val >> 7) & 0x000F;
|
---|
432 | stim = val & 0x007F;
|
---|
433 |
|
---|
434 | switch (port) { /* use port to decode possible types */
|
---|
435 |
|
---|
436 | case 0: /* MIDI-1 - Keys */
|
---|
437 | case 1: /* MIDI-2 - Keys */
|
---|
438 |
|
---|
439 | sprintf(buf, "%s %03u %u %02u",
|
---|
440 | (val & 0x8000) ? "Rel" : "Key",
|
---|
441 | 1 + stim, 1 + port, 1 + chan);
|
---|
442 |
|
---|
443 | break;
|
---|
444 | /* |
---|
445 |
|
---|
446 | */
|
---|
447 |
|
---|
448 | case 2: /* Local Keys */
|
---|
449 |
|
---|
450 | switch (chan) { /* use channel to further decode */
|
---|
451 |
|
---|
452 | case 0: /* Keys - Local Keyboard */
|
---|
453 |
|
---|
454 | sprintf(buf, "%s %03u L ",
|
---|
455 | (val & 0x8000) ? "Rel" : "Key",
|
---|
456 | 1 + stim);
|
---|
457 |
|
---|
458 | break;
|
---|
459 |
|
---|
460 | case 2: /* Triggers */
|
---|
461 |
|
---|
462 | sprintf(buf, "Trig %02u ", 1 + stim);
|
---|
463 | break;
|
---|
464 |
|
---|
465 | case 3: /* Pulses */
|
---|
466 |
|
---|
467 | sprintf(buf, "Pulse %u ", 1 + stim);
|
---|
468 | break;
|
---|
469 |
|
---|
470 | default: /* spurious type -- shouldn't happen */
|
---|
471 |
|
---|
472 | sprintf(buf, "%s?? %03u L %02u",
|
---|
473 | (val & 0x8000) ? "r" : "c",
|
---|
474 | 1 + stim, 1 + chan);
|
---|
475 | break;
|
---|
476 |
|
---|
477 | }
|
---|
478 |
|
---|
479 | break;
|
---|
480 |
|
---|
481 | default: /* spurious port -- should never happen */
|
---|
482 |
|
---|
483 | sprintf(buf, "??? %03u %u %02u", 1 + stim, 1 + port, 1 + chan);
|
---|
484 | break;
|
---|
485 | }
|
---|
486 | }
|
---|
487 |
|
---|
488 | /* |
---|
489 |
|
---|
490 | */
|
---|
491 |
|
---|
492 | /*
|
---|
493 | =============================================================================
|
---|
494 | dfpdat() -- convert FPU datum for display
|
---|
495 | =============================================================================
|
---|
496 | */
|
---|
497 |
|
---|
498 | char *
|
---|
499 | dfpdat(pp)
|
---|
500 | register struct patch *pp;
|
---|
501 | {
|
---|
502 | static char buf[32];
|
---|
503 | unsigned short sgn, vp1, vp2;
|
---|
504 | short val;
|
---|
505 |
|
---|
506 | val = pp->padat2;
|
---|
507 |
|
---|
508 | switch (pp->padat1) {
|
---|
509 |
|
---|
510 | case PSA_SRC: /* source */
|
---|
511 |
|
---|
512 | strcpy(buf, smdata[val]);
|
---|
513 | break;
|
---|
514 |
|
---|
515 | case PSA_MLT: /* multiplier */
|
---|
516 |
|
---|
517 | fr2dec(val, ebuf);
|
---|
518 |
|
---|
519 | buf[0] = ebuf[3];
|
---|
520 | buf[1] = ebuf[0];
|
---|
521 | buf[2] = '.';
|
---|
522 | buf[3] = ebuf[1];
|
---|
523 | buf[4] = ebuf[2];
|
---|
524 | buf[5] = '\0';
|
---|
525 | break;
|
---|
526 | /* |
---|
527 |
|
---|
528 | */
|
---|
529 | case PSA_VAL: /* value */
|
---|
530 |
|
---|
531 | val >>= 5;
|
---|
532 |
|
---|
533 | if (val < 0) {
|
---|
534 |
|
---|
535 | val = -val;
|
---|
536 | sgn = '-';
|
---|
537 |
|
---|
538 | } else {
|
---|
539 |
|
---|
540 | sgn = '+';
|
---|
541 | }
|
---|
542 |
|
---|
543 | vp1 = val / 100;
|
---|
544 | vp2 = val - (vp1 * 100);
|
---|
545 |
|
---|
546 | if (vp1 > 9) {
|
---|
547 |
|
---|
548 | vp1 = 0;
|
---|
549 |
|
---|
550 | if (sgn EQ '+')
|
---|
551 | sgn = '\240';
|
---|
552 | else
|
---|
553 | sgn = '\241';
|
---|
554 | }
|
---|
555 |
|
---|
556 | sprintf(buf, "%c%u.%02u", sgn, vp1, vp2);
|
---|
557 | break;
|
---|
558 | /* |
---|
559 |
|
---|
560 | */
|
---|
561 | case PSA_TIM: /* time */
|
---|
562 |
|
---|
563 | vp1 = fromfpu(val);
|
---|
564 |
|
---|
565 | sprintf(buf, "%5u", vp1);
|
---|
566 | break;
|
---|
567 |
|
---|
568 | case PSA_FNC: /* function / control */
|
---|
569 |
|
---|
570 | if ((PE_SPEC & pp->paspec) EQ PA_AUX)
|
---|
571 | sprintf(buf, "%s", (val & 0x0001) ? "On " : "Off ");
|
---|
572 | else
|
---|
573 | sprintf(buf, "%s", (val & 0x0001) ? "Start" : "Stop ");
|
---|
574 |
|
---|
575 | break;
|
---|
576 |
|
---|
577 | default:
|
---|
578 |
|
---|
579 | sprintf(buf, "$%04.4X", val);
|
---|
580 | break;
|
---|
581 | }
|
---|
582 |
|
---|
583 | return(buf);
|
---|
584 | }
|
---|
585 |
|
---|
586 | /* |
---|
587 |
|
---|
588 | */
|
---|
589 |
|
---|
590 | /*
|
---|
591 | =============================================================================
|
---|
592 | pafpu1() -- convert patch for display -- aaaaa ssss tn ddddd
|
---|
593 |
|
---|
594 | Level, Filtr, Fil Q, Loctn, Dynmc
|
---|
595 | =============================================================================
|
---|
596 | */
|
---|
597 |
|
---|
598 | pafpu1(bf, ad, gt, gn, pp)
|
---|
599 | char *bf;
|
---|
600 | char *ad;
|
---|
601 | unsigned short gt, gn;
|
---|
602 | register struct patch *pp;
|
---|
603 | {
|
---|
604 | sprintf(bf, "%s %s %c%c %s", ad, stdata[pp->padat1], gt, gn, dfpdat(pp));
|
---|
605 | }
|
---|
606 |
|
---|
607 | /*
|
---|
608 | =============================================================================
|
---|
609 | pafpu2() -- convert patch for display -- aaa n ssss tn ddddd
|
---|
610 |
|
---|
611 | Index, Freq
|
---|
612 | =============================================================================
|
---|
613 | */
|
---|
614 |
|
---|
615 | pafpu2(bf, ad, os, gt, gn, pp)
|
---|
616 | char *bf;
|
---|
617 | char *ad;
|
---|
618 | unsigned short os, gt, gn;
|
---|
619 | register struct patch *pp;
|
---|
620 | {
|
---|
621 | sprintf(bf, "%s %d %s %c%c %s", ad, os, stdata[pp->padat1], gt, gn, dfpdat(pp));
|
---|
622 | }
|
---|
623 |
|
---|
624 | /*
|
---|
625 | =============================================================================
|
---|
626 | pafpu3() -- convert patch for display -- aaaaa ssss ddddd
|
---|
627 |
|
---|
628 | Aux, Rate, Inten, Depth, Vlt
|
---|
629 | =============================================================================
|
---|
630 | */
|
---|
631 |
|
---|
632 | pafpu3(bf, ad, pp)
|
---|
633 | char *bf;
|
---|
634 | char *ad;
|
---|
635 | register struct patch *pp;
|
---|
636 | {
|
---|
637 | sprintf(bf, "%s %s %s", ad, stdata[pp->padat1], dfpdat(pp));
|
---|
638 | }
|
---|
639 |
|
---|
640 | /* |
---|
641 |
|
---|
642 | */
|
---|
643 |
|
---|
644 | /*
|
---|
645 | =============================================================================
|
---|
646 | dspdest() -- convert patch destination and datum for display
|
---|
647 | =============================================================================
|
---|
648 | */
|
---|
649 |
|
---|
650 | dspdest(buf, pp)
|
---|
651 | char *buf;
|
---|
652 | register struct patch *pp;
|
---|
653 | {
|
---|
654 | unsigned short chan, osc, port, stim, vg, vgt, vgn, vp1, vp2, sgn;
|
---|
655 | short val;
|
---|
656 | char buf2[16], *rtype;
|
---|
657 |
|
---|
658 | port = (pp->pasuba >> 11) & 0x0003; /* for trg types */
|
---|
659 | chan = (pp->pasuba >> 7) & 0x000F;
|
---|
660 | stim = pp->pasuba & 0x007F;
|
---|
661 |
|
---|
662 | vg = (pp->pasuba >> 8) & 0x00FF; /* for vg types */
|
---|
663 | osc = (pp->pasuba & 0x00FF) + 1;
|
---|
664 |
|
---|
665 | if (vg > 11) {
|
---|
666 |
|
---|
667 | vgt = 'G';
|
---|
668 | vgn = vg - 11;
|
---|
669 |
|
---|
670 | } else {
|
---|
671 |
|
---|
672 | vgt = 'V';
|
---|
673 | vgn = vg + 1;
|
---|
674 | }
|
---|
675 |
|
---|
676 | vgn = vgn + ((vgn > 9) ? '\242' : '0');
|
---|
677 |
|
---|
678 | /* |
---|
679 |
|
---|
680 | */
|
---|
681 | switch (PE_SPEC & pp->paspec) {
|
---|
682 |
|
---|
683 | case PA_KEY: /* key action */
|
---|
684 |
|
---|
685 | sprintf(buf, "K %03u %u %02u %s",
|
---|
686 | 1 + stim, 1 + port, 1 + chan,
|
---|
687 | trdata[pp->padat2 & 0x0003]);
|
---|
688 |
|
---|
689 | break;
|
---|
690 |
|
---|
691 | case PA_TRG:
|
---|
692 |
|
---|
693 | sprintf(buf, "Trigger %02u %s",
|
---|
694 | 1 + stim,
|
---|
695 | ssdata[pp->padat2 & 0x0001]);
|
---|
696 |
|
---|
697 | break;
|
---|
698 |
|
---|
699 | case PA_PLS:
|
---|
700 |
|
---|
701 | sprintf(buf, "Pulse %u %s",
|
---|
702 | 1 + stim,
|
---|
703 | trdata[pp->padat2 & 0x0003]);
|
---|
704 |
|
---|
705 | break;
|
---|
706 | /* |
---|
707 |
|
---|
708 | */
|
---|
709 | case PA_LED:
|
---|
710 |
|
---|
711 | if (pp->pasuba & 0x0001) {
|
---|
712 |
|
---|
713 | sprintf(buf, "LED %c %c%c%c%c",
|
---|
714 | 'A' + pp->pasuba,
|
---|
715 | '0' + ((pp->padat1 >> 14) & 0x0003),
|
---|
716 | '0' + ((pp->padat1 >> 12) & 0x0003),
|
---|
717 | '0' + ((pp->padat1 >> 10) & 0x0003),
|
---|
718 | '0' + ((pp->padat1 >> 8) & 0x0003));
|
---|
719 |
|
---|
720 | } else {
|
---|
721 |
|
---|
722 | sprintf(buf, "LED %c %c%c%c",
|
---|
723 | 'A' + pp->pasuba,
|
---|
724 | '0' + ((pp->padat1 >> 14) & 0x0003),
|
---|
725 | '0' + ((pp->padat1 >> 12) & 0x0003),
|
---|
726 | '0' + ((pp->padat1 >> 10) & 0x0003));
|
---|
727 | }
|
---|
728 |
|
---|
729 | break;
|
---|
730 |
|
---|
731 | case PA_SLIN:
|
---|
732 |
|
---|
733 | sprintf(buf, "Seq %02u Lin %03u",
|
---|
734 | 1 + pp->pasuba,
|
---|
735 | pp->padat1);
|
---|
736 |
|
---|
737 | break;
|
---|
738 |
|
---|
739 | case PA_SCTL:
|
---|
740 |
|
---|
741 | sprintf(buf, "Seq %02u Ctl %s",
|
---|
742 | 1 + pp->pasuba,
|
---|
743 | ssdata[pp->padat2 & 0x0001]);
|
---|
744 |
|
---|
745 | break;
|
---|
746 |
|
---|
747 | case PA_TUNE:
|
---|
748 |
|
---|
749 | sprintf(buf, "Tune Table %u",
|
---|
750 | pp->padat1);
|
---|
751 |
|
---|
752 | break;
|
---|
753 | /* |
---|
754 |
|
---|
755 | */
|
---|
756 | case PA_RSET:
|
---|
757 |
|
---|
758 | rtype = "Set";
|
---|
759 | goto doregs;
|
---|
760 |
|
---|
761 | case PA_RADD:
|
---|
762 |
|
---|
763 | rtype = "Add";
|
---|
764 |
|
---|
765 | doregs:
|
---|
766 |
|
---|
767 | if (pp->padat1 & 0x0001) {
|
---|
768 |
|
---|
769 | sprintf(buf, "Reg %02u %s R%02u",
|
---|
770 | 1 + pp->pasuba, rtype,
|
---|
771 | 1 + pp->padat2);
|
---|
772 |
|
---|
773 | } else {
|
---|
774 |
|
---|
775 | if ((val = pp->padat2) < 0) {
|
---|
776 |
|
---|
777 | sgn = '-';
|
---|
778 | val = - val;
|
---|
779 |
|
---|
780 | } else {
|
---|
781 |
|
---|
782 | sgn = '+';
|
---|
783 | }
|
---|
784 |
|
---|
785 | sprintf(buf, "Reg %02u %s %c%02u",
|
---|
786 | 1 + pp->pasuba, rtype,
|
---|
787 | sgn, val);
|
---|
788 | }
|
---|
789 |
|
---|
790 | break;
|
---|
791 |
|
---|
792 | case PA_INST:
|
---|
793 |
|
---|
794 | sprintf(buf, "Instrument %c%c %02u",
|
---|
795 | vgt, vgn, pp->padat1);
|
---|
796 |
|
---|
797 | break;
|
---|
798 | /* |
---|
799 |
|
---|
800 | */
|
---|
801 | case PA_OSC:
|
---|
802 |
|
---|
803 | val = pp->padat2 >> 1;
|
---|
804 |
|
---|
805 | switch (pp->padat1) {
|
---|
806 |
|
---|
807 | case PSO_INT: /* interval */
|
---|
808 |
|
---|
809 | if (val < 0) {
|
---|
810 |
|
---|
811 | sgn = '-';
|
---|
812 | val = -val;
|
---|
813 |
|
---|
814 | } else {
|
---|
815 |
|
---|
816 | sgn = '+';
|
---|
817 | }
|
---|
818 |
|
---|
819 | sprintf(buf, "Osc %u Int %c%c %c%04u",
|
---|
820 | osc, vgt, vgn, sgn, val);
|
---|
821 |
|
---|
822 | break;
|
---|
823 |
|
---|
824 | case PSO_RAT: /* ratio */
|
---|
825 |
|
---|
826 | int2rat(val);
|
---|
827 |
|
---|
828 | sprintf(buf, "Osc %u Rat %c%c %s",
|
---|
829 | osc, vgt, vgn, ebuf);
|
---|
830 |
|
---|
831 | break;
|
---|
832 |
|
---|
833 | case PSO_FRQ: /* frequency */
|
---|
834 |
|
---|
835 | vp1 = val / 10;
|
---|
836 | vp2 = val - (vp1 * 10);
|
---|
837 |
|
---|
838 | sprintf(buf, "Osc %u Frq %c%c %02u.%u",
|
---|
839 | osc, vgt, vgn, vp1, vp2);
|
---|
840 |
|
---|
841 | break;
|
---|
842 | /* |
---|
843 |
|
---|
844 | */
|
---|
845 | case PSO_PCH: /* pitch */
|
---|
846 |
|
---|
847 | cnvc2p(ebuf, val);
|
---|
848 |
|
---|
849 | sprintf(buf, "Osc %u Pch %c%c %s",
|
---|
850 | osc, vgt, vgn, ebuf);
|
---|
851 |
|
---|
852 | break;
|
---|
853 |
|
---|
854 | default:
|
---|
855 |
|
---|
856 | break;
|
---|
857 | }
|
---|
858 |
|
---|
859 | break;
|
---|
860 | /* |
---|
861 |
|
---|
862 | */
|
---|
863 | case PA_WAVA:
|
---|
864 |
|
---|
865 | sgn = 'A';
|
---|
866 | goto dowaves;
|
---|
867 |
|
---|
868 | case PA_WAVB:
|
---|
869 |
|
---|
870 | sgn = 'B';
|
---|
871 |
|
---|
872 | dowaves:
|
---|
873 |
|
---|
874 | sprintf(buf, "Waveshape%c %c%c %02u",
|
---|
875 | sgn, vgt, vgn, pp->padat1);
|
---|
876 |
|
---|
877 | break;
|
---|
878 |
|
---|
879 | case PA_CNFG:
|
---|
880 |
|
---|
881 | sprintf(buf, "Configure %c%c %02u",
|
---|
882 | vgt, vgn, pp->padat1);
|
---|
883 |
|
---|
884 | break;
|
---|
885 | /* |
---|
886 |
|
---|
887 | */
|
---|
888 | case PA_LEVL:
|
---|
889 |
|
---|
890 | pafpu1(buf, "Level", vgt, vgn, pp);
|
---|
891 | break;
|
---|
892 |
|
---|
893 | case PA_INDX:
|
---|
894 |
|
---|
895 | pafpu2(buf, "Ind", osc, vgt, vgn, pp);
|
---|
896 | break;
|
---|
897 |
|
---|
898 | case PA_FREQ:
|
---|
899 |
|
---|
900 | pafpu2(buf, "Frq", osc, vgt, vgn, pp);
|
---|
901 | break;
|
---|
902 |
|
---|
903 | case PA_FILT:
|
---|
904 |
|
---|
905 | pafpu1(buf, "Filtr", vgt, vgn, pp);
|
---|
906 | break;
|
---|
907 |
|
---|
908 | case PA_FILQ:
|
---|
909 |
|
---|
910 | pafpu1(buf, "Fil Q", vgt, vgn, pp);
|
---|
911 | break;
|
---|
912 |
|
---|
913 | case PA_LOCN:
|
---|
914 |
|
---|
915 | pafpu1(buf, "Loctn", vgt, vgn, pp);
|
---|
916 | break;
|
---|
917 |
|
---|
918 | case PA_DYNM:
|
---|
919 |
|
---|
920 | pafpu1(buf, "Dynmc", vgt, vgn, pp);
|
---|
921 | break;
|
---|
922 | /* |
---|
923 |
|
---|
924 | */
|
---|
925 | case PA_AUX:
|
---|
926 |
|
---|
927 | pafpu3(buf, "Aux ", pp);
|
---|
928 | break;
|
---|
929 |
|
---|
930 | case PA_RATE:
|
---|
931 |
|
---|
932 | pafpu3(buf, "Rate ", pp);
|
---|
933 | break;
|
---|
934 |
|
---|
935 | case PA_INTN:
|
---|
936 |
|
---|
937 | pafpu3(buf, "Inten", pp);
|
---|
938 | break;
|
---|
939 |
|
---|
940 | case PA_DPTH:
|
---|
941 |
|
---|
942 | pafpu3(buf, "Depth", pp);
|
---|
943 | break;
|
---|
944 |
|
---|
945 | case PA_VOUT:
|
---|
946 |
|
---|
947 | sprintf(buf2, "Vlt %u", pp->pasuba);
|
---|
948 | pafpu3(buf, buf2, pp);
|
---|
949 | break;
|
---|
950 |
|
---|
951 | default:
|
---|
952 |
|
---|
953 | break;
|
---|
954 | }
|
---|
955 | }
|
---|
956 |
|
---|
957 | /* |
---|
958 |
|
---|
959 | */
|
---|
960 |
|
---|
961 | /*
|
---|
962 | =============================================================================
|
---|
963 | ptfield() -- setup field routines for the patch editor
|
---|
964 | =============================================================================
|
---|
965 | */
|
---|
966 |
|
---|
967 | ptfield()
|
---|
968 | {
|
---|
969 | curset(&pt_flds);
|
---|
970 |
|
---|
971 | #if USEVECTR
|
---|
972 | if (usevect) {
|
---|
973 |
|
---|
974 | cx_key = cxkstd;
|
---|
975 | cy_key = cykstd;
|
---|
976 | }
|
---|
977 | #endif
|
---|
978 |
|
---|
979 | }
|
---|