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