1 | /*
|
---|
2 | =============================================================================
|
---|
3 | instdsp.c -- instrument definition display driver and support functions
|
---|
4 | Version 181 -- 1988-10-06 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #define D_EXECKI 0 /* debug execins() */
|
---|
9 |
|
---|
10 | #include "ram.h"
|
---|
11 |
|
---|
12 | #define LSPCH 2 /* pitch source scale factor */
|
---|
13 | #define MAXRAND (0x00FFFFFFL) /* largest random number */
|
---|
14 |
|
---|
15 | int16_t idbox[][8] = { /* display box parameters */
|
---|
16 |
|
---|
17 | { 1, 1, 84, 26, CFBX00, CBBX00, 0, 1}, /* 0: Freq 1 */
|
---|
18 | { 86, 1, 169, 26, CFBX01, CBBX01, 0, 11}, /* 1: Freq 2 */
|
---|
19 | {171, 1, 254, 26, CFBX02, CBBX02, 0, 22}, /* 2: Freq 3 */
|
---|
20 | {256, 1, 339, 26, CFBX03, CBBX03, 0, 33}, /* 3: Freq 4 */
|
---|
21 | {341, 1, 424, 26, CFBX04, CBBX04, 0, 44}, /* 4: Filter / Resonance */
|
---|
22 | {426, 1, 509, 26, CFBX05, CBBX05, 0, 54}, /* 5: Location */
|
---|
23 |
|
---|
24 | { 1, 29, 84, 54, CFBX06, CBBX06, 2, 1}, /* 6: Index 1 */
|
---|
25 | { 86, 29, 169, 54, CFBX07, CBBX07, 2, 11}, /* 7: Index 2 */
|
---|
26 | {171, 29, 254, 54, CFBX08, CBBX08, 2, 22}, /* 8: Index 3 */
|
---|
27 | {256, 29, 339, 54, CFBX09, CBBX09, 2, 33}, /* 9: Index 4 */
|
---|
28 | {341, 29, 424, 54, CFBX10, CBBX10, 2, 44}, /* 10: Index 5 */
|
---|
29 | {426, 29, 509, 54, CFBX11, CBBX11, 2, 54}, /* 11: Index 6 */
|
---|
30 |
|
---|
31 | { 1, 56, 509, 208, CFBX12, CBBX12, 4, 54}, /* 12: Level */
|
---|
32 |
|
---|
33 | { 1, 210, 110, 236, CFBX13, CBBX13, 15, 1}, /* 13: Source- Mlt */
|
---|
34 | {112, 210, 142, 236, CFBX14, CBBX14, 15, 15}, /* 14: Pt */
|
---|
35 | {144, 210, 206, 236, CFBX15, CBBX15, 15, 19}, /* 15: Time */
|
---|
36 | {208, 210, 366, 236, CFBX16, CBBX16, 15, 27}, /* 16: Value */
|
---|
37 | {368, 210, 509, 236, CFBX17, CBBX17, 15, 47}, /* 17: Action */
|
---|
38 |
|
---|
39 | { 1, 238, 131, 348, CFBX18, CBBX18, 17, 2}, /* 18: Configuration */
|
---|
40 | {133, 238, 267, 251, CFBX19, CBBX19, 17, 17}, /* 19: Voice & Inst */
|
---|
41 | {269, 238, 379, 306, CFBX20, CBBX20, 17, 35}, /* 20: Oscillators */
|
---|
42 | {381, 238, 509, 348, CFBX21, CBBX21, 17, 48}, /* 21: Waveshape */
|
---|
43 |
|
---|
44 | {133, 308, 379, 348, CFBX22, CBBX22, 22, 17}, /* 22: (messages) */
|
---|
45 |
|
---|
46 | {133, 252, 267, 306, CFBX23, CBBX23, 18, 17} /* 23: Name & comments */
|
---|
47 | };
|
---|
48 |
|
---|
49 | /* instrument function to FPU function table */
|
---|
50 |
|
---|
51 | int16_t fnoff[NFINST] = {
|
---|
52 |
|
---|
53 | 1, /* 0: Freq 1 */
|
---|
54 | 3, /* 1: Freq 2 */
|
---|
55 | 5, /* 2: Freq 3 */
|
---|
56 | 7, /* 3: Freq 4 */
|
---|
57 | 10, /* 4: Filter / Resonance */
|
---|
58 | 4, /* 5: Location */
|
---|
59 | 9, /* 6: Index 1 */
|
---|
60 | 11, /* 7: Index 2 */
|
---|
61 | 12, /* 8: Index 3 */
|
---|
62 | 13, /* 9: Index 4 */
|
---|
63 | 14, /* 10: Index 5 */
|
---|
64 | 15, /* 11: Index 6 */
|
---|
65 | 2 /* 12: Level */
|
---|
66 | };
|
---|
67 |
|
---|
68 | int16_t inspal[16][3] = { /* instrument display color palette */
|
---|
69 |
|
---|
70 | {0, 0, 0}, /* 0 */
|
---|
71 | {3, 3, 3}, /* 1 */
|
---|
72 | {2, 2, 2}, /* 2 */
|
---|
73 | {3, 0, 0}, /* 3 */
|
---|
74 | {0, 3, 2}, /* 4 */
|
---|
75 | {0, 0, 1}, /* 5 */
|
---|
76 | {0, 1, 1}, /* 6 */
|
---|
77 | {1, 0, 1}, /* 7 */
|
---|
78 | {3, 2, 0}, /* 8 */
|
---|
79 | {1, 1, 2}, /* 9 */
|
---|
80 | {2, 3, 0}, /* 10 */
|
---|
81 | {2, 3, 3}, /* 11 */
|
---|
82 | {3, 0, 2}, /* 12 */
|
---|
83 | {0, 2, 3}, /* 13 */
|
---|
84 | {0, 3, 0}, /* 14 */
|
---|
85 | {3, 3, 0} /* 15 */
|
---|
86 | };
|
---|
87 |
|
---|
88 | int8_t *idbxlbl[] = { /* display box labels */
|
---|
89 |
|
---|
90 | " Frq 1", /* 0 */
|
---|
91 | " Frq 2", /* 1 */
|
---|
92 | " Frq 3", /* 2 */
|
---|
93 | " Frq 4", /* 3 */
|
---|
94 | " Filtr", /* 4 */
|
---|
95 | " Loctn", /* 5 */
|
---|
96 | " Ind 1", /* 6 */
|
---|
97 | " Ind 2", /* 7 */
|
---|
98 | " Ind 3", /* 8 */
|
---|
99 | " Ind 4", /* 9 */
|
---|
100 | " Ind 5", /* 10 */
|
---|
101 | " Ind 6", /* 11 */
|
---|
102 | " Level", /* 12 */
|
---|
103 | "Source Mult", /* 13 */
|
---|
104 | "Pt", /* 14 */
|
---|
105 | "Time ", /* 15 */
|
---|
106 | "Value Source Mult", /* 16 */
|
---|
107 | "Conditioned Acts", /* 17 */
|
---|
108 | " Config #", /* 18 */
|
---|
109 | "Voice Inst", /* 19 */
|
---|
110 | "Oscillators", /* 20 */
|
---|
111 | "Wavshpe", /* 21 */
|
---|
112 | "", /* 22 */
|
---|
113 | "" /* 23 */
|
---|
114 | };
|
---|
115 |
|
---|
116 | int8_t idhlbl[] = /* main function time axis label */
|
---|
117 | " \324\302 \325\305 \326 \301 \302 \304 \310 \321\306 \323\302";
|
---|
118 |
|
---|
119 |
|
---|
120 | int8_t *osclbl[] = { /* oscillator mode labels */
|
---|
121 | /* NOTE: must match values in instdsp.h */
|
---|
122 |
|
---|
123 | "Int", /* 0: OC_INT - Interval */
|
---|
124 | "Rat", /* 1: OC_RAT - Ratio */
|
---|
125 | "Frq", /* 2: OC_FRQ - Frequency */
|
---|
126 | "Pch" /* 3: OC_PCH - Pitch */
|
---|
127 | };
|
---|
128 |
|
---|
129 | int32_t rngdiv[] = { /* divisors for ranges of 0..9 */
|
---|
130 |
|
---|
131 | MAXRAND, /* 0..0 */
|
---|
132 | MAXRAND / 2, /* 0..1 */
|
---|
133 | MAXRAND / 3, /* 0..2 */
|
---|
134 | MAXRAND / 4, /* 0..3 */
|
---|
135 | MAXRAND / 5, /* 0..4 */
|
---|
136 | MAXRAND / 6, /* 0..5 */
|
---|
137 | MAXRAND / 7, /* 0..6 */
|
---|
138 | MAXRAND / 8, /* 0..7 */
|
---|
139 | MAXRAND / 9, /* 0..8 */
|
---|
140 | MAXRAND / 10 /* 0..9 */
|
---|
141 | };
|
---|
142 |
|
---|
143 | /*
|
---|
144 | =============================================================================
|
---|
145 | drawpt() -- draw a point as a cross
|
---|
146 | =============================================================================
|
---|
147 | */
|
---|
148 |
|
---|
149 | void drawpt(int16_t px, int16_t py, int16_t pc)
|
---|
150 | {
|
---|
151 | register int16_t tmp;
|
---|
152 |
|
---|
153 | tmp = px - 1;
|
---|
154 |
|
---|
155 | if (tmp > 7)
|
---|
156 | idpoint(tmp, py, pc);
|
---|
157 |
|
---|
158 | tmp = px + 1;
|
---|
159 |
|
---|
160 | if (tmp < 509)
|
---|
161 | idpoint(tmp, py, pc);
|
---|
162 |
|
---|
163 | tmp = py - 1;
|
---|
164 |
|
---|
165 | if (tmp > 55)
|
---|
166 | idpoint(px, tmp, pc);
|
---|
167 |
|
---|
168 | tmp = py + 1;
|
---|
169 |
|
---|
170 | if (tmp < 196)
|
---|
171 | idpoint(px, tmp, pc);
|
---|
172 |
|
---|
173 | idpoint(px, py, pc);
|
---|
174 | }
|
---|
175 |
|
---|
176 | /*
|
---|
177 | =============================================================================
|
---|
178 | drawfn() -- draw a function
|
---|
179 | =============================================================================
|
---|
180 | */
|
---|
181 |
|
---|
182 | void drawfn(int16_t fn, int16_t how, int16_t pen, int16_t wn)
|
---|
183 | {
|
---|
184 | struct idfnhdr *fp;
|
---|
185 | struct instdef *ip;
|
---|
186 | register struct instpnt *pt1, *pt2;
|
---|
187 | register int16_t i, npt1, npt2, xp;
|
---|
188 | int16_t np, ptx, pty, ptc;
|
---|
189 |
|
---|
190 | ip = &vbufs[curvce];
|
---|
191 | fp = &ip->idhfnc[fn];
|
---|
192 | point = idpoint;
|
---|
193 |
|
---|
194 | np = fp->idfpif; /* number of points in the function */
|
---|
195 | xp = subj; /* edit point */
|
---|
196 |
|
---|
197 | npt1 = 0; /* left endpoint of line */
|
---|
198 | npt2 = 1; /* right endpoint of line */
|
---|
199 |
|
---|
200 | pt1 = &ip->idhpnt[fp->idfpt1]; /* left endpoint of line */
|
---|
201 | pt2 = pt1 + 1; /* right endpoint of line */
|
---|
202 |
|
---|
203 | ptx = ttox(timeto(fn, npt1), wn);
|
---|
204 | pty = vtoy((pt1->ipval >> 5), wn);
|
---|
205 |
|
---|
206 | ptc = how ? ID_SELD :
|
---|
207 | ((pt1->ipact OR pt1->ipvsrc) ?
|
---|
208 | ID_ACTP : ID_CPNT);
|
---|
209 |
|
---|
210 | if (np EQ 1) { /* single point ? */
|
---|
211 |
|
---|
212 | if (wn EQ 12)
|
---|
213 | drawpt(ptx, pty, ptc);
|
---|
214 | else
|
---|
215 | idpoint(ptx, pty, ptc);
|
---|
216 |
|
---|
217 | return;
|
---|
218 | }
|
---|
219 |
|
---|
220 | if (how AND (xp EQ 0))
|
---|
221 | if (wn EQ 12)
|
---|
222 | drawpt(ptx, pty, ID_SELD);
|
---|
223 | else
|
---|
224 | idpoint(ptx, pty, ID_SELD);
|
---|
225 |
|
---|
226 | for (i = 1; i < np; i++) {
|
---|
227 |
|
---|
228 | ptx = ttox(timeto(fn, npt2), wn);
|
---|
229 | pty = vtoy((pt2->ipval >> 5), wn);
|
---|
230 |
|
---|
231 | ptc = (pt2->ipact OR pt2->ipvsrc) ?
|
---|
232 | ID_ACTP : ID_CPNT;
|
---|
233 |
|
---|
234 | if (how AND (xp EQ (i - 1))) {
|
---|
235 |
|
---|
236 |
|
---|
237 | if (wn EQ 12)
|
---|
238 | drawpt(ptx, pty, ptc);
|
---|
239 | else
|
---|
240 | idpoint(ptx, pty, ptc);
|
---|
241 |
|
---|
242 | } else if (how AND (xp EQ i)) {
|
---|
243 |
|
---|
244 | ptc = ID_SELD;
|
---|
245 |
|
---|
246 | if (wn EQ 12)
|
---|
247 | drawpt(ptx, pty, ptc);
|
---|
248 | else
|
---|
249 | idpoint(ptx, pty, ptc);
|
---|
250 |
|
---|
251 | } else {
|
---|
252 |
|
---|
253 | lseg(ttox(timeto(fn, npt1), wn),
|
---|
254 | vtoy((pt1->ipval >> 5), wn),
|
---|
255 | ptx, pty, pen);
|
---|
256 |
|
---|
257 | if (wn EQ 12) {
|
---|
258 |
|
---|
259 | drawpt(ttox(timeto(fn, npt1), wn),
|
---|
260 | vtoy((pt1->ipval >> 5), wn),
|
---|
261 | (pt1->ipact OR pt1->ipvsrc) ?
|
---|
262 | ID_ACTP : ID_CPNT);
|
---|
263 |
|
---|
264 | drawpt(ptx, pty, ptc);
|
---|
265 |
|
---|
266 | } else {
|
---|
267 |
|
---|
268 | idpoint(ttox(timeto(fn, npt1), wn),
|
---|
269 | vtoy((pt1->ipval >> 5), wn),
|
---|
270 | (pt1->ipact OR pt1->ipvsrc) ?
|
---|
271 | ID_ACTP : ID_CPNT);
|
---|
272 |
|
---|
273 | idpoint(ptx, pty, ptc);
|
---|
274 | }
|
---|
275 | }
|
---|
276 |
|
---|
277 | npt1++;
|
---|
278 | npt2++;
|
---|
279 | pt1++;
|
---|
280 | pt2++;
|
---|
281 | }
|
---|
282 |
|
---|
283 | return;
|
---|
284 | }
|
---|
285 |
|
---|
286 | /*
|
---|
287 | =============================================================================
|
---|
288 | addpch() -- add an offset to a pitch function value
|
---|
289 | =============================================================================
|
---|
290 | */
|
---|
291 |
|
---|
292 | int16_t addpch(int16_t p1, int16_t p2)
|
---|
293 | {
|
---|
294 | register int32_t pl;
|
---|
295 |
|
---|
296 | pl = ((((int32_t)p1 >> 5) - 500L) << LSPCH) + (int32_t)p2;
|
---|
297 |
|
---|
298 | if (pl > PITCHMAX)
|
---|
299 | pl = PITCHMAX;
|
---|
300 |
|
---|
301 | return((int16_t)pl);
|
---|
302 | }
|
---|
303 |
|
---|
304 | /*
|
---|
305 | =============================================================================
|
---|
306 | irand() -- develop a random number in a given range
|
---|
307 | =============================================================================
|
---|
308 | */
|
---|
309 |
|
---|
310 | int16_t irand(int16_t range)
|
---|
311 | {
|
---|
312 | if (range LE 0) /* limit things to 'reasonable' values */
|
---|
313 | return(0);
|
---|
314 |
|
---|
315 | if (range > 9) /* limit things to 'reasonable' values */
|
---|
316 | range = 9;
|
---|
317 |
|
---|
318 | return((int16_t)(rand24() / rngdiv[range]));
|
---|
319 | }
|
---|
320 |
|
---|
321 | /*
|
---|
322 | =============================================================================
|
---|
323 | xgetran() -- develop a random number
|
---|
324 | =============================================================================
|
---|
325 | */
|
---|
326 |
|
---|
327 | int16_t xgetran(int16_t mlt)
|
---|
328 | {
|
---|
329 | register int16_t sltmp;
|
---|
330 |
|
---|
331 | sltmp = (int16_t)rand24();
|
---|
332 |
|
---|
333 | if (mlt < 0)
|
---|
334 | sltmp += (int16_t)rand24();
|
---|
335 |
|
---|
336 | return(sltmp);
|
---|
337 | }
|
---|
338 |
|
---|
339 | /*
|
---|
340 | =============================================================================
|
---|
341 | dosync() -- update sync and configuration register
|
---|
342 | =============================================================================
|
---|
343 | */
|
---|
344 |
|
---|
345 | void dosync(int16_t vce)
|
---|
346 | {
|
---|
347 | uint16_t sync;
|
---|
348 | struct instdef *ip;
|
---|
349 |
|
---|
350 | ip = &vbufs[vce];
|
---|
351 | sync = (uint16_t)ip->idhcfg << 8;
|
---|
352 |
|
---|
353 | if (ip->idhos1c & OC_SYN)
|
---|
354 | sync |= 0x2000;
|
---|
355 |
|
---|
356 | if (ip->idhos2c & OC_SYN)
|
---|
357 | sync |= 0x4000;
|
---|
358 |
|
---|
359 | if (ip->idhos3c & OC_SYN)
|
---|
360 | sync |= 0x8000;
|
---|
361 |
|
---|
362 | *(io_fpu + vce + FPU_OCFG) = sync;
|
---|
363 | }
|
---|
364 |
|
---|
365 | /*
|
---|
366 | =============================================================================
|
---|
367 | oscdsp() -- display an oscillator frequency specification
|
---|
368 | =============================================================================
|
---|
369 | */
|
---|
370 |
|
---|
371 | void oscdsp(int16_t row, int16_t val, int16_t n, int8_t *lbl, int16_t frq)
|
---|
372 | {
|
---|
373 | register int16_t fh, fl;
|
---|
374 |
|
---|
375 | tsplot4(instob, 64, idbox[n][4], row, 34, lbl, 14);
|
---|
376 | tsplot4(instob, 64, idbox[n][4], row, 36, osclbl[val & 3], 14);
|
---|
377 |
|
---|
378 | switch (val & 3) {
|
---|
379 |
|
---|
380 | case OC_INT: /* interval */
|
---|
381 |
|
---|
382 | sprintf(idbuf, "%c%04d", (frq < 0 ? '-' : '+'),
|
---|
383 | ((frq < 0 ? -frq : frq) >> 1));
|
---|
384 |
|
---|
385 | break;
|
---|
386 |
|
---|
387 | case OC_RAT: /* ratio */
|
---|
388 |
|
---|
389 | int2rat(frq >> 1);
|
---|
390 |
|
---|
391 | ebflag = FALSE;
|
---|
392 |
|
---|
393 | idbuf[0] = ebuf[0];
|
---|
394 | idbuf[1] = ebuf[1];
|
---|
395 | idbuf[2] = ebuf[2];
|
---|
396 | idbuf[3] = '\0';
|
---|
397 |
|
---|
398 | break;
|
---|
399 |
|
---|
400 | case OC_FRQ: /* frequency */
|
---|
401 |
|
---|
402 | fh = (frq >> 1) / 10;
|
---|
403 | fl = (frq >> 1) - (fh * 10);
|
---|
404 |
|
---|
405 | sprintf(idbuf, "%02d.%d ", fh, fl);
|
---|
406 | break;
|
---|
407 |
|
---|
408 | case OC_PCH:
|
---|
409 |
|
---|
410 | cnvc2p(idbuf, (frq >> 1));
|
---|
411 | idbuf[0] = (int8_t)(idbuf[0] + '0');
|
---|
412 | idbuf[1] = (int8_t)(idbuf[1] + 'A');
|
---|
413 | idbuf[2] = sfdsp[idbuf[2]];
|
---|
414 | idbuf[3] = (int8_t)(idbuf[3] + '0');
|
---|
415 | idbuf[4] = (int8_t)(idbuf[4] + '0');
|
---|
416 | idbuf[5] = '\0';
|
---|
417 | break;
|
---|
418 | }
|
---|
419 |
|
---|
420 | tsplot4(instob, 64, idbox[n][4], row, 40, idbuf, 14);
|
---|
421 |
|
---|
422 | if (row NE 21)
|
---|
423 | tsplot4(instob, 64, idbox[n][4], row, 46,
|
---|
424 | ((val & OC_SYN) ? "S" : "s"), 14);
|
---|
425 | }
|
---|
426 |
|
---|
427 | /*
|
---|
428 | =============================================================================
|
---|
429 | pltws() -- plot a small waveshape display
|
---|
430 | =============================================================================
|
---|
431 | */
|
---|
432 |
|
---|
433 | void pltws(uint16_t ws[], int16_t pen)
|
---|
434 | {
|
---|
435 | register int16_t i, x, y;
|
---|
436 |
|
---|
437 | for (i = 1; i < 254; i++) {
|
---|
438 |
|
---|
439 | x = 382 + (i >> 1);
|
---|
440 | y = 348 - ((int16_t)(ws[i] ^ 0x8000) / 676);
|
---|
441 |
|
---|
442 | idpoint(x, y, pen);
|
---|
443 | }
|
---|
444 | }
|
---|
445 |
|
---|
446 | /*
|
---|
447 | =============================================================================
|
---|
448 | dswin() -- display a window
|
---|
449 | =============================================================================
|
---|
450 | */
|
---|
451 |
|
---|
452 | void dswin(int16_t n)
|
---|
453 | {
|
---|
454 | int16_t th, tl, vh, vl, vv;
|
---|
455 | int8_t *s1;
|
---|
456 | int32_t tt, sc;
|
---|
457 | uint16_t cx;
|
---|
458 | register int16_t pnt, par;
|
---|
459 | register struct instdef *ip;
|
---|
460 | register struct idfnhdr *fp;
|
---|
461 | register struct instpnt *pp;
|
---|
462 |
|
---|
463 | if (wcflag NE -1)
|
---|
464 | return;
|
---|
465 |
|
---|
466 | if (idimsw AND (n NE 19) AND (n < 22))
|
---|
467 | return;
|
---|
468 |
|
---|
469 | ip = &vbufs[curvce];
|
---|
470 |
|
---|
471 | fp = &ip->idhfnc[n LE 12 ? n : curfunc];
|
---|
472 |
|
---|
473 | curpnt = subj + fp->idfpt1;
|
---|
474 | pp = &ip->idhpnt[curpnt];
|
---|
475 |
|
---|
476 | cx = exp_c(idbox[n][5]);
|
---|
477 |
|
---|
478 | /* first, fill the box with the background color */
|
---|
479 |
|
---|
480 | if (v_regs[5] & 0x0180)
|
---|
481 | vbank(0);
|
---|
482 |
|
---|
483 | vbfill4(instob, 128, idbox[n][0], idbox[n][1], idbox[n][2], idbox[n][3], cx);
|
---|
484 |
|
---|
485 | if (n < 12) /* draw the function if it's a label window */
|
---|
486 | drawfn(n, 0, ID_CLIN, n);
|
---|
487 |
|
---|
488 | /* put in the box label */
|
---|
489 |
|
---|
490 | if (n GT 12) {
|
---|
491 |
|
---|
492 | tsplot4(instob, 64, idbox[n][4], idbox[n][6], idbox[n][7],
|
---|
493 | idbxlbl[n], 14);
|
---|
494 |
|
---|
495 | } else {
|
---|
496 |
|
---|
497 | tsplot4(instob, 64,
|
---|
498 | ((ip->idhfnc[n].idftmd & I_TM_KEY) ? idbox[n][4] : ID_INST),
|
---|
499 | idbox[n][6], idbox[n][7], idbxlbl[n], 14);
|
---|
500 | }
|
---|
501 |
|
---|
502 |
|
---|
503 | switch (n) { /* final text - overlays above stuff */
|
---|
504 |
|
---|
505 | case 12: /* level */
|
---|
506 |
|
---|
507 | /* x labels */
|
---|
508 |
|
---|
509 | tsplot4(instob, 64, TGRID, 14, 0, idhlbl, 14);
|
---|
510 |
|
---|
511 | /* y labels */
|
---|
512 |
|
---|
513 | tsplot4(instob, 64, TGRID, 14, 0, "\300", 14);
|
---|
514 | tsplot4(instob, 64, TGRID, 12, 0, "\302", 14);
|
---|
515 | tsplot4(instob, 64, TGRID, 10, 0, "\304", 14);
|
---|
516 | tsplot4(instob, 64, TGRID, 8, 0, "\306", 14);
|
---|
517 | tsplot4(instob, 64, TGRID, 6, 0, "\310", 14);
|
---|
518 | tsplot4(instob, 64, TGRID, 4, 0, "\312", 14);
|
---|
519 |
|
---|
520 | lseg( 7, 56, 7, 196, LGRID); /* draw the grid */
|
---|
521 | lseg( 7, 196, 509, 196, LGRID);
|
---|
522 |
|
---|
523 | drawfn(12, 0, ID_CLIN, 12); /* draw the function */
|
---|
524 |
|
---|
525 | return;
|
---|
526 |
|
---|
527 | case 13: /* source - multiplier */
|
---|
528 |
|
---|
529 | dsimlt(bfs, fp->idfsrc, fp->idfmlt);
|
---|
530 |
|
---|
531 | tsplot4(instob, 64, idbox[n][4],
|
---|
532 | idbox[n][6]+1, idbox[n][7], bfs, 14);
|
---|
533 | return;
|
---|
534 |
|
---|
535 | case 14: /* point number */
|
---|
536 |
|
---|
537 | sprintf(bfs, "%02d", subj);
|
---|
538 |
|
---|
539 | tsplot4(instob, 64, idbox[n][4], idbox[n][6]+1, idbox[n][7], bfs, 14);
|
---|
540 |
|
---|
541 | return;
|
---|
542 |
|
---|
543 | case 15: /* time */
|
---|
544 |
|
---|
545 | sc = 1000L;
|
---|
546 | tt = timeto(curfunc, subj);
|
---|
547 | th = (int16_t)(tt / sc);
|
---|
548 | tl = (int16_t)(tt - (th * sc));
|
---|
549 |
|
---|
550 | sprintf(bfs, "%02d.%03d", th, tl);
|
---|
551 | tsplot4(instob, 64, idbox[n][4], idbox[n][6] + 1,
|
---|
552 | idbox[n][7], bfs, 14);
|
---|
553 |
|
---|
554 | return;
|
---|
555 |
|
---|
556 | case 16: /* value */
|
---|
557 |
|
---|
558 | vv = pp->ipval >> 5;
|
---|
559 | vh = vv / 100;
|
---|
560 | vl = vv - (vh * 100);
|
---|
561 |
|
---|
562 | sprintf(bfs, "%02d.%02d ", vh, vl);
|
---|
563 |
|
---|
564 | dsimlt(&bfs[6], pp->ipvsrc, pp->ipvmlt);
|
---|
565 |
|
---|
566 | tsplot4(instob, 64, idbox[n][4], idbox[n][6] + 1,
|
---|
567 | idbox[n][7], bfs, 14);
|
---|
568 |
|
---|
569 | return;
|
---|
570 |
|
---|
571 |
|
---|
572 | case 17: /* action */
|
---|
573 |
|
---|
574 | pnt = pp->ippar1;
|
---|
575 | par = pp->ippar2;
|
---|
576 |
|
---|
577 | switch (pp->ipact) {
|
---|
578 |
|
---|
579 | case AC_NULL:
|
---|
580 |
|
---|
581 | s1 = " ";
|
---|
582 | break;
|
---|
583 |
|
---|
584 | case AC_SUST:
|
---|
585 |
|
---|
586 | sprintf(bfs, "Pause if key %c ", SP_DNA);
|
---|
587 | s1 = bfs;
|
---|
588 | break;
|
---|
589 |
|
---|
590 | case AC_ENBL:
|
---|
591 |
|
---|
592 | sprintf(bfs, "Stop if key %c ", SP_UPA);
|
---|
593 | s1 = bfs;
|
---|
594 | break;
|
---|
595 |
|
---|
596 | case AC_JUMP:
|
---|
597 |
|
---|
598 | sprintf(bfs, "GoTo %02d forever ", pnt);
|
---|
599 | s1 = bfs;
|
---|
600 | break;
|
---|
601 |
|
---|
602 |
|
---|
603 | case AC_LOOP:
|
---|
604 |
|
---|
605 | sprintf(bfs, "GoTo %02d %02d times", pnt, par);
|
---|
606 |
|
---|
607 | if (bfs[8] EQ '9') /* random */
|
---|
608 | bfs[8] = 'R';
|
---|
609 |
|
---|
610 | s1 = bfs;
|
---|
611 | break;
|
---|
612 |
|
---|
613 | case AC_KYUP:
|
---|
614 |
|
---|
615 | sprintf(bfs, "GoTo %02d if key %c",
|
---|
616 | pnt, SP_UPA);
|
---|
617 | s1 = bfs;
|
---|
618 | break;
|
---|
619 |
|
---|
620 | case AC_KYDN:
|
---|
621 |
|
---|
622 | sprintf(bfs, "GoTo %02d if key %c",
|
---|
623 | pnt, SP_DNA);
|
---|
624 | s1 = bfs;
|
---|
625 | break;
|
---|
626 |
|
---|
627 | default:
|
---|
628 |
|
---|
629 | s1 = "????????????????";
|
---|
630 | break;
|
---|
631 | }
|
---|
632 |
|
---|
633 | tsplot4(instob, 64, idbox[n][4], idbox[n][6] + 1,
|
---|
634 | idbox[n][7], s1, 14);
|
---|
635 |
|
---|
636 | return;
|
---|
637 |
|
---|
638 | case 18: /* configuration */
|
---|
639 |
|
---|
640 | showcfg(ip->idhcfg);
|
---|
641 | return;
|
---|
642 |
|
---|
643 | case 19: /* voice & instrument */
|
---|
644 |
|
---|
645 | sprintf(idbuf, "%02d", curvce + 1);
|
---|
646 | tsplot4(instob, 64, idbox[n][4], 17, 23, idbuf, 14);
|
---|
647 |
|
---|
648 | sprintf(idbuf, "%02d", curinst);
|
---|
649 | tsplot4(instob, 64, (instmod[curvce] ? ID_CHGD :idbox[n][4]),
|
---|
650 | 17, 31, idbuf, 14);
|
---|
651 |
|
---|
652 | return;
|
---|
653 |
|
---|
654 | case 20: /* oscillators */
|
---|
655 |
|
---|
656 | oscdsp(18, ip->idhos1c, n, "1", ip->idhos1v);
|
---|
657 | oscdsp(19, ip->idhos2c, n, "2", ip->idhos2v);
|
---|
658 | oscdsp(20, ip->idhos3c, n, "3", ip->idhos3v);
|
---|
659 | oscdsp(21, ip->idhos4c, n, "4", ip->idhos4v);
|
---|
660 |
|
---|
661 | return;
|
---|
662 |
|
---|
663 | case 21: /* waveshapes */
|
---|
664 |
|
---|
665 | sprintf(idbuf, "A%02d", ip->idhwsa + 1);
|
---|
666 | tsplot4(instob, 64, WSAFC, 17, 56, idbuf, 14);
|
---|
667 | pltws(ip->idhwvaf, WSAFC);
|
---|
668 |
|
---|
669 | sprintf(idbuf, "B%02d", ip->idhwsb + 1);
|
---|
670 | tsplot4(instob, 64, WSBFC, 17, 60, idbuf, 14);
|
---|
671 | pltws(ip->idhwvbf, WSBFC);
|
---|
672 |
|
---|
673 | return;
|
---|
674 |
|
---|
675 | case 22: /* message window */
|
---|
676 |
|
---|
677 | tsplot4(instob, 64, idbox[n][4], 22, 17, vlbptr[0], 14);
|
---|
678 | tsplot4(instob, 64, idbox[n][4], 23, 17, vlbptr[1], 14);
|
---|
679 | tsplot4(instob, 64, idbox[n][4], 24, 17, vlbptr[2], 14);
|
---|
680 |
|
---|
681 | if (idsrcsw) {
|
---|
682 |
|
---|
683 | point = idpoint;
|
---|
684 |
|
---|
685 | lseg(196, 308, 196, 348, CBORD);
|
---|
686 | lseg(260, 308, 260, 348, CBORD);
|
---|
687 | lseg(324, 308, 324, 348, CBORD);
|
---|
688 | }
|
---|
689 |
|
---|
690 | return;
|
---|
691 |
|
---|
692 | case 23: /* Name and comments */
|
---|
693 |
|
---|
694 | tsplot4(instob, 64, idbox[n][4], 18, 17, ip->idhname, 14);
|
---|
695 | tsplot4(instob, 64, idbox[n][4], 19, 17, ip->idhcom1, 14);
|
---|
696 | tsplot4(instob, 64, idbox[n][4], 20, 17, ip->idhcom2, 14);
|
---|
697 | tsplot4(instob, 64, idbox[n][4], 21, 17, ip->idhcom3, 14);
|
---|
698 |
|
---|
699 | return;
|
---|
700 | }
|
---|
701 | }
|
---|
702 |
|
---|
703 | /*
|
---|
704 | =============================================================================
|
---|
705 | allwins() -- display all windows
|
---|
706 | =============================================================================
|
---|
707 | */
|
---|
708 |
|
---|
709 | void allwins(void)
|
---|
710 | {
|
---|
711 | register int16_t i;
|
---|
712 |
|
---|
713 | for (i = 0; i < 24; i++)
|
---|
714 | dswin(i);
|
---|
715 | }
|
---|
716 |
|
---|
717 | /*
|
---|
718 | =============================================================================
|
---|
719 | idpoint() -- plot a point for the lseg function
|
---|
720 | =============================================================================
|
---|
721 | */
|
---|
722 |
|
---|
723 | void idpoint(int16_t x, int16_t y, int16_t pen)
|
---|
724 | {
|
---|
725 | if (v_regs[5] & 0x0180)
|
---|
726 | vbank(0);
|
---|
727 |
|
---|
728 | vputp(idoct, x, y, pen);
|
---|
729 | }
|
---|
730 |
|
---|
731 | /*
|
---|
732 | =============================================================================
|
---|
733 | idbord() -- draw the border for the instrument display
|
---|
734 | =============================================================================
|
---|
735 | */
|
---|
736 |
|
---|
737 | void idbord(void)
|
---|
738 | {
|
---|
739 | point = idpoint;
|
---|
740 |
|
---|
741 | lseg( 0, 0, 510, 0, CBORD); /* outer border */
|
---|
742 | lseg(510, 0, 510, 349, CBORD);
|
---|
743 | lseg(510, 349, 0, 349, CBORD);
|
---|
744 | lseg( 0, 349, 0, 0, CBORD);
|
---|
745 |
|
---|
746 | lseg( 0, 27, 510, 27, CBORD); /* label widows - H lines */
|
---|
747 | lseg( 0, 55, 510, 55, CBORD);
|
---|
748 |
|
---|
749 | lseg( 85, 1, 85, 54, CBORD); /* label windows - V lines */
|
---|
750 | lseg(170, 1, 170, 54, CBORD);
|
---|
751 | lseg(255, 1, 255, 54, CBORD);
|
---|
752 | lseg(340, 1, 340, 54, CBORD);
|
---|
753 | lseg(425, 1, 425, 54, CBORD);
|
---|
754 |
|
---|
755 | lseg( 0, 209, 510, 209, CBORD); /* S/M, Time, Val - H lines */
|
---|
756 | lseg( 0, 237, 510, 237, CBORD);
|
---|
757 |
|
---|
758 | lseg(111, 210, 111, 236, CBORD); /* S/M, Time, Val - V lines */
|
---|
759 | lseg(143, 210, 143, 236, CBORD);
|
---|
760 | lseg(207, 210, 207, 236, CBORD);
|
---|
761 | lseg(367, 210, 367, 236, CBORD);
|
---|
762 |
|
---|
763 | lseg(132, 238, 132, 349, CBORD); /* Voice, Osc, Vars */
|
---|
764 | lseg(380, 238, 380, 349, CBORD);
|
---|
765 | lseg(132, 307, 380, 307, CBORD);
|
---|
766 | lseg(268, 238, 268, 306, CBORD);
|
---|
767 | }
|
---|
768 |
|
---|
769 | /*
|
---|
770 | =============================================================================
|
---|
771 | idvlblc() -- clear the message window
|
---|
772 | =============================================================================
|
---|
773 | */
|
---|
774 |
|
---|
775 | void idvlblc(void)
|
---|
776 | {
|
---|
777 | vlbtype = 0; /* nothing in the message window */
|
---|
778 |
|
---|
779 | vlbptr[0] = vlbptr[1] = vlbptr[2] = " ";
|
---|
780 | }
|
---|
781 |
|
---|
782 | /*
|
---|
783 | =============================================================================
|
---|
784 | idvlbld() -- put the labels in the message window
|
---|
785 | =============================================================================
|
---|
786 | */
|
---|
787 |
|
---|
788 | void idvlbld(void)
|
---|
789 | {
|
---|
790 | vlbtype = 1; /* variable labels */
|
---|
791 |
|
---|
792 | /* "123456789012345678901234567890" */
|
---|
793 |
|
---|
794 | vlbptr[0] = "PchW/HT Pch/Frq Random GPC/V1";
|
---|
795 | vlbptr[1] = "ModW/VT Key Vel Pedal 1 ";
|
---|
796 | vlbptr[2] = "Brth/LP Key Prs ";
|
---|
797 | }
|
---|
798 |
|
---|
799 | /*
|
---|
800 | =============================================================================
|
---|
801 | idvtyp() -- display the virtual typewriter in the message window
|
---|
802 | =============================================================================
|
---|
803 | */
|
---|
804 |
|
---|
805 | void idvtyp(void)
|
---|
806 | {
|
---|
807 | vlbtype = 2; /* virtual typewriter */
|
---|
808 |
|
---|
809 | vlbptr[0] = vtlin1;
|
---|
810 | vlbptr[1] = vtlin2;
|
---|
811 | vlbptr[2] = vtlin3;
|
---|
812 | }
|
---|
813 |
|
---|
814 | /*
|
---|
815 | =============================================================================
|
---|
816 | idcpfch() -- display the copy / fetch menu in the message window
|
---|
817 | =============================================================================
|
---|
818 | */
|
---|
819 |
|
---|
820 | void idcpfch(void)
|
---|
821 | {
|
---|
822 | vlbtype = 3; /* copy / fetch menu */
|
---|
823 |
|
---|
824 | /* "123456789012345678901234567890" */
|
---|
825 |
|
---|
826 | vlbptr[0] = "Fetch from library Escape ";
|
---|
827 | vlbptr[1] = "Copy to library ";
|
---|
828 | vlbptr[2] = " ";
|
---|
829 | }
|
---|
830 |
|
---|
831 | /*
|
---|
832 | =============================================================================
|
---|
833 | instdsp() -- put up the instrument display
|
---|
834 | =============================================================================
|
---|
835 | */
|
---|
836 |
|
---|
837 | void instdsp(void)
|
---|
838 | {
|
---|
839 | instob = &v_score[0]; /* setup object pointer */
|
---|
840 | idoct = &v_obtab[INSTOBJ]; /* setup object control table pointer */
|
---|
841 | obj0 = &v_curs0[0]; /* setup cursor object pointer */
|
---|
842 | obj2 = &v_tcur[0]; /* setup typewriter cursor pointer */
|
---|
843 |
|
---|
844 | idnamsw = FALSE; /* typewriter not up */
|
---|
845 | idsrcsw = FALSE; /* source menu not up */
|
---|
846 | idcfsw = FALSE; /* copy / fetch menu not up */
|
---|
847 | idimsw = FALSE; /* instrument menu not up */
|
---|
848 | submenu = FALSE; /* submenu cursor not enabled */
|
---|
849 | wcflag = -1; /* no menu page up */
|
---|
850 | wcpage = 0; /* initial ws/cf page */
|
---|
851 |
|
---|
852 | setinst(); /* setup editing variables */
|
---|
853 |
|
---|
854 | dswap(); /* initialize display */
|
---|
855 |
|
---|
856 | vbank(0); /* clear the display */
|
---|
857 | memsetw(instob, 0, 32767);
|
---|
858 | memsetw(instob+32767L, 0, 12033);
|
---|
859 |
|
---|
860 | SetObj(INSTOBJ, 0, 0, instob, 512, 350, 0, 0, INSTFL, -1);
|
---|
861 | SetObj(0, 0, 1, obj0, 16, 16, ICURX, ICURY, OBFL_00, -1);
|
---|
862 | SetObj(TTCURS, 0, 1, obj2, 16, 16, 0, 0, TTCCFL, -1);
|
---|
863 |
|
---|
864 | arcurs(ID_NCUR); /* setup arrow cursor object */
|
---|
865 | itcini(ID_TCUR); /* setup text cursor object */
|
---|
866 | ttcini(ID_TCUR); /* setup typewriter cursor object */
|
---|
867 |
|
---|
868 | vbank(0);
|
---|
869 | idbord(); /* draw the border */
|
---|
870 | idvlblc(); /* no initial label */
|
---|
871 | allwins(); /* fill in the windows */
|
---|
872 |
|
---|
873 | SetPri(INSTOBJ, INSTPRI);
|
---|
874 | SetPri(0, GCPRI); /* display the graphic cursor */
|
---|
875 |
|
---|
876 | setgc(ICURX, ICURY);
|
---|
877 |
|
---|
878 | vsndpal(inspal); /* set the palette */
|
---|
879 | }
|
---|
880 |
|
---|
881 | /*
|
---|
882 | =============================================================================
|
---|
883 | reshowi() -- redisplay the instrument
|
---|
884 | =============================================================================
|
---|
885 | */
|
---|
886 |
|
---|
887 | void reshowi(void)
|
---|
888 | {
|
---|
889 | idfield(); /* fix up field table, etc. */
|
---|
890 |
|
---|
891 | wcflag = -1; /* no menu page up */
|
---|
892 | wcpage = 0; /* first page of waveshapes */
|
---|
893 |
|
---|
894 | dswap(); /* initialize display */
|
---|
895 |
|
---|
896 | vbank(0); /* clear the display */
|
---|
897 | memsetw(instob, 0, 32767);
|
---|
898 | memsetw(instob+32767L, 0, 12033);
|
---|
899 |
|
---|
900 | SetObj(INSTOBJ, 0, 0, instob, 512, 350, 0, 0, INSTFL, -1);
|
---|
901 | SetObj(0, 0, 1, obj0, 16, 16, ICURX, ICURY, OBFL_00, -1);
|
---|
902 | SetObj(TTCURS, 0, 1, obj2, 16, 16, 0, 0, TTCCFL, -1);
|
---|
903 |
|
---|
904 | arcurs(ID_NCUR); /* setup arrow cursor object */
|
---|
905 | itcini(ID_TCUR); /* setup text cursor object */
|
---|
906 | ttcini(ID_TCUR); /* setup typewriter cursor object */
|
---|
907 |
|
---|
908 | vbank(0);
|
---|
909 | idbord(); /* draw the border */
|
---|
910 | idvlblc(); /* no initial label */
|
---|
911 | allwins(); /* fill in the windows */
|
---|
912 |
|
---|
913 | SetPri(INSTOBJ, INSTPRI);
|
---|
914 | SetPri(0, GCPRI); /* enable the cursor */
|
---|
915 |
|
---|
916 | if (cyval > curslim)
|
---|
917 | settc(stcrow, stccol);
|
---|
918 | else
|
---|
919 | setgc(cxval, cyval);
|
---|
920 |
|
---|
921 | vsndpal(inspal); /* set the palette */
|
---|
922 | }
|
---|
923 |
|
---|