1 | /*
|
---|
2 | =============================================================================
|
---|
3 | tundsp.c -- MIDAS tuning table editor
|
---|
4 | Version 23 -- 1988-11-28 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "hwdefs.h"
|
---|
9 | #include "biosdefs.h"
|
---|
10 | #include "stddefs.h"
|
---|
11 | #include "graphdef.h"
|
---|
12 | #include "vsdd.h"
|
---|
13 | #include "vsddsw.h"
|
---|
14 | #include "vsddvars.h"
|
---|
15 | #include "charset.h"
|
---|
16 | #include "fields.h"
|
---|
17 |
|
---|
18 | #include "midas.h"
|
---|
19 | #include "tundsp.h"
|
---|
20 |
|
---|
21 | #include "memory.h"
|
---|
22 | #include "stdio.h"
|
---|
23 | #include "strings.h"
|
---|
24 |
|
---|
25 | extern int16_t infield(int16_t row, int16_t col, struct fet *fetp);
|
---|
26 | extern uint16_t exp_c(uint16_t c);
|
---|
27 | extern void arcurs(uint16_t icolor);
|
---|
28 | extern void cnvc2p(int8_t *buf, int16_t cv);
|
---|
29 | extern void dswap(void);
|
---|
30 | extern void itcini(uint16_t color);
|
---|
31 | extern void itcpos(int16_t row, int16_t col);
|
---|
32 | extern void settc(int16_t rv, int16_t cv);
|
---|
33 | extern void ttcini(uint16_t color);
|
---|
34 | extern void vsndpal(int16_t pp[16][3]);
|
---|
35 |
|
---|
36 | #define TUN_VAL 100 /* default value for tunval in cents */
|
---|
37 |
|
---|
38 | extern int16_t stcrow, stccol, cxval, cyval;
|
---|
39 |
|
---|
40 | extern int16_t curtun; /* current tuning table */
|
---|
41 | extern int16_t submenu; /* submenu cursor switch */
|
---|
42 | extern int16_t tunmod; /* tuning table modified */
|
---|
43 | extern int16_t tunval; /* tuning table generator value */
|
---|
44 | extern int16_t ttcmdsv; /* tuning table editing state variable */
|
---|
45 | extern int16_t tdnamsw; /* tuning editor displaying typewriter */
|
---|
46 |
|
---|
47 | extern int16_t oldtun[]; /* previous tuning table for undo */
|
---|
48 | extern int16_t tuntab[]; /* current tuning table */
|
---|
49 | extern int16_t tunlib[][128]; /* tuning table library */
|
---|
50 |
|
---|
51 | extern int16_t panlkey[]; /* local key tunings */
|
---|
52 | extern int16_t lclkmap[]; /* local key to MIDI key map */
|
---|
53 |
|
---|
54 | extern int8_t tuncurn[]; /* current tuning table name */
|
---|
55 | extern int8_t tunname[][32]; /* tuning table names */
|
---|
56 | extern int8_t sfdsp[];
|
---|
57 |
|
---|
58 | extern uint16_t *obj0, *obj2;
|
---|
59 |
|
---|
60 | extern int8_t bfs[];
|
---|
61 | extern int8_t *tdbxlb[];
|
---|
62 |
|
---|
63 | extern int16_t tdbox[][8];
|
---|
64 |
|
---|
65 | extern uint16_t *tunob;
|
---|
66 |
|
---|
67 | extern struct octent *tdoct;
|
---|
68 |
|
---|
69 | /* |
---|
70 |
|
---|
71 | */
|
---|
72 |
|
---|
73 | int16_t tunpal[16][3] = { /* color palette */
|
---|
74 |
|
---|
75 | {0, 0, 0}, /* 0 */
|
---|
76 | {3, 3, 3}, /* 1 */
|
---|
77 | {0, 0, 0}, /* 2 */
|
---|
78 | {3, 3, 3}, /* 3 */
|
---|
79 | {1, 1, 0}, /* 4 */
|
---|
80 | {1, 0, 1}, /* 5 */
|
---|
81 | {0, 1, 1}, /* 6 (was 0, 1, 0) */
|
---|
82 | {0, 1, 1}, /* 7 (was 0, 1, 0) */
|
---|
83 | {0, 0, 1}, /* 8 (was 0, 0, 2) */
|
---|
84 | {0, 2, 3}, /* 9 (was 0, 3, 0) */
|
---|
85 | {2, 2, 2}, /* 10 */
|
---|
86 | {2, 3, 3}, /* 11 */
|
---|
87 | {3, 3, 0}, /* 12 */
|
---|
88 | {3, 3, 0}, /* 13 */
|
---|
89 | {3, 0, 0}, /* 14 */
|
---|
90 | {0, 0, 3} /* 15 */
|
---|
91 | };
|
---|
92 |
|
---|
93 | /* 12345678901234567890123456789012 */
|
---|
94 | static int8_t dfltnam[] = "Local 3rds + MIDI 12 tone scale ";
|
---|
95 |
|
---|
96 | int8_t *tdlabl[] = {
|
---|
97 |
|
---|
98 | "C", "#", "D", "#", "E", "F", "#", "G",
|
---|
99 | "#", "A", "#", "B", "C", "#", "D", "#",
|
---|
100 | "E", "F", "#", "G", "#", "A", "#", "B"
|
---|
101 | };
|
---|
102 |
|
---|
103 | /* |
---|
104 |
|
---|
105 | */
|
---|
106 |
|
---|
107 | /*
|
---|
108 | =============================================================================
|
---|
109 | gettun() -- retrieve a tuning table from the tuning table library
|
---|
110 | =============================================================================
|
---|
111 | */
|
---|
112 |
|
---|
113 | void gettun(int16_t n)
|
---|
114 | {
|
---|
115 | memcpyw(tuntab, tunlib[n], 128);
|
---|
116 | memcpy(tuncurn, tunname[n], 32);
|
---|
117 | curtun = n;
|
---|
118 | tunmod = FALSE;
|
---|
119 | }
|
---|
120 |
|
---|
121 | /*
|
---|
122 | =============================================================================
|
---|
123 | puttun() -- store a tuning table in the tuning table library
|
---|
124 | =============================================================================
|
---|
125 | */
|
---|
126 |
|
---|
127 | void puttun(int16_t n)
|
---|
128 | {
|
---|
129 | memcpyw(tunlib[n], tuntab, 128);
|
---|
130 | memcpy(tunname[n], tuncurn, 32);
|
---|
131 | tunmod = FALSE;
|
---|
132 | }
|
---|
133 |
|
---|
134 | /* |
---|
135 |
|
---|
136 | */
|
---|
137 |
|
---|
138 | /*
|
---|
139 | =============================================================================
|
---|
140 | inittt() -- initialize tuning table to equal tempered 12 tone scale
|
---|
141 | =============================================================================
|
---|
142 | */
|
---|
143 |
|
---|
144 | void inittt(int16_t n)
|
---|
145 | {
|
---|
146 | register int16_t i;
|
---|
147 |
|
---|
148 | for (i = 0; i < 128; i++)
|
---|
149 | tunlib[n][i] = ((i < 21) ? 160 : (i > 108) ? 10960 :
|
---|
150 | (160 + ((i - 12) * 100))) << 1;
|
---|
151 |
|
---|
152 | for (i = 0; i < 24; i++)
|
---|
153 | tunlib[n][lclkmap[i]] = panlkey[i] << 1;
|
---|
154 |
|
---|
155 | strcpy(tunname[n], dfltnam);
|
---|
156 | }
|
---|
157 |
|
---|
158 |
|
---|
159 | /*
|
---|
160 | =============================================================================
|
---|
161 | inittl() -- initialize tuning table library
|
---|
162 | =============================================================================
|
---|
163 | */
|
---|
164 |
|
---|
165 | void inittl(void)
|
---|
166 | {
|
---|
167 | register int16_t i;
|
---|
168 |
|
---|
169 | for (i = 0; i < NTUNS; i++)
|
---|
170 | inittt(i);
|
---|
171 |
|
---|
172 | tunval = TUN_VAL << 1;
|
---|
173 | gettun(0);
|
---|
174 | memcpyw(oldtun, tuntab, 128);
|
---|
175 | }
|
---|
176 |
|
---|
177 | /* |
---|
178 |
|
---|
179 | */
|
---|
180 |
|
---|
181 | /*
|
---|
182 | =============================================================================
|
---|
183 | tt_trcp() -- transpose and copy tuning table values
|
---|
184 | =============================================================================
|
---|
185 | */
|
---|
186 |
|
---|
187 | void tt_trcp(int16_t start, int16_t finish, int16_t dest)
|
---|
188 | {
|
---|
189 | register int16_t i;
|
---|
190 | register int32_t v;
|
---|
191 |
|
---|
192 | memcpyw(oldtun, tuntab, 128); /* preserve old table for undo */
|
---|
193 |
|
---|
194 | if (start > finish) {
|
---|
195 |
|
---|
196 | for (i = finish; ((i LE start) AND (dest < 128)); i++) {
|
---|
197 |
|
---|
198 | /* reverse copy */
|
---|
199 |
|
---|
200 | v = oldtun[i] + (int32_t)tunval; /* transpose */
|
---|
201 |
|
---|
202 | if (v GT (int32_t)PITCHMAX) /* limit */
|
---|
203 | v = (int32_t)PITCHMAX;
|
---|
204 | else if (v LT (int32_t)PITCHMIN)
|
---|
205 | v = (int32_t)PITCHMIN;
|
---|
206 |
|
---|
207 | tuntab[dest++] = (int16_t)v; /* store the value */
|
---|
208 | }
|
---|
209 |
|
---|
210 | } else {
|
---|
211 |
|
---|
212 | for (i = start; ((i LE finish) AND (dest < 128)); i++) {
|
---|
213 |
|
---|
214 | /* forward copy */
|
---|
215 |
|
---|
216 | v = oldtun[i] + (int32_t)tunval; /* transpose */
|
---|
217 |
|
---|
218 | if (v GT (int32_t)PITCHMAX) /* limit */
|
---|
219 | v = (int32_t)PITCHMAX;
|
---|
220 | else if (v LT (int32_t)PITCHMIN)
|
---|
221 | v = (int32_t)PITCHMIN;
|
---|
222 |
|
---|
223 | tuntab[dest++] = (int16_t)v; /* store the value */
|
---|
224 | }
|
---|
225 | }
|
---|
226 |
|
---|
227 | tunmod = TRUE;
|
---|
228 | }
|
---|
229 |
|
---|
230 | /* |
---|
231 |
|
---|
232 | */
|
---|
233 |
|
---|
234 | /*
|
---|
235 | =============================================================================
|
---|
236 | tt_intp() -- interpolate tuning table values
|
---|
237 | =============================================================================
|
---|
238 | */
|
---|
239 |
|
---|
240 | int16_t tt_intp(int16_t from, int16_t to)
|
---|
241 | {
|
---|
242 | register int16_t i, j, k, n;
|
---|
243 | register int32_t t;
|
---|
244 |
|
---|
245 | memcpyw(oldtun, tuntab, 128); /* preserve old table for undo */
|
---|
246 |
|
---|
247 | if (from > to) { /* adjust to and from for forward scan */
|
---|
248 |
|
---|
249 | i = from;
|
---|
250 | from = to;
|
---|
251 | to = i;
|
---|
252 | }
|
---|
253 |
|
---|
254 | n = to - from; /* get interval size */
|
---|
255 |
|
---|
256 | if (n < 2)
|
---|
257 | return(FAILURE);
|
---|
258 |
|
---|
259 | k = tuntab[from];
|
---|
260 | t = (((int32_t)tuntab[to] - (int32_t)k) << 16) / n;
|
---|
261 | j = 1 + from;
|
---|
262 | n--;
|
---|
263 |
|
---|
264 | for (i = 0; i < n ; i++)
|
---|
265 | tuntab[j++] = (int16_t)((t * (1 + i)) >> 16) + k;
|
---|
266 |
|
---|
267 | tunmod = TRUE;
|
---|
268 | return(SUCCESS);
|
---|
269 | }
|
---|
270 | /* |
---|
271 |
|
---|
272 | */
|
---|
273 |
|
---|
274 | /*
|
---|
275 | =============================================================================
|
---|
276 | tt_incr() -- increment tuning table values
|
---|
277 | =============================================================================
|
---|
278 | */
|
---|
279 |
|
---|
280 | int16_t tt_incr(int16_t from, int16_t to)
|
---|
281 | {
|
---|
282 | register int16_t i;
|
---|
283 | register int32_t v;
|
---|
284 |
|
---|
285 | memcpyw(oldtun, tuntab, 128); /* preserve old table for undo */
|
---|
286 |
|
---|
287 | if (from > to) { /* adjust to and from for forward scan */
|
---|
288 |
|
---|
289 | i = from;
|
---|
290 | from = to;
|
---|
291 | to = i;
|
---|
292 |
|
---|
293 | }
|
---|
294 |
|
---|
295 | v = (int32_t)oldtun[from]; /* initial value */
|
---|
296 |
|
---|
297 | if (from++ EQ to) /* interval has to be at least 1 */
|
---|
298 | return(FAILURE);
|
---|
299 |
|
---|
300 | for (i = from; i LE to; i++) {
|
---|
301 |
|
---|
302 | v += (int32_t)tunval; /* increment */
|
---|
303 |
|
---|
304 | if (v GT (int32_t)PITCHMAX) /* limit */
|
---|
305 | v = (int32_t)PITCHMAX;
|
---|
306 | else if (v LT (int32_t)PITCHMIN)
|
---|
307 | v = (int32_t)PITCHMIN;
|
---|
308 |
|
---|
309 | tuntab[i] = (int16_t)v; /* store the value */
|
---|
310 | }
|
---|
311 |
|
---|
312 | tunmod = TRUE;
|
---|
313 | return(SUCCESS);
|
---|
314 | }
|
---|
315 |
|
---|
316 | /* |
---|
317 |
|
---|
318 | */
|
---|
319 |
|
---|
320 | /*
|
---|
321 | =============================================================================
|
---|
322 | td_trcp() -- display transpose select label
|
---|
323 | =============================================================================
|
---|
324 | */
|
---|
325 |
|
---|
326 | void td_trcp(int16_t mode)
|
---|
327 | {
|
---|
328 | register uint16_t cx;
|
---|
329 |
|
---|
330 | cx = exp_c(mode ? TDSELD : tdbox[6][4]);
|
---|
331 | vbank(0);
|
---|
332 | vcputsv(tunob, 64, cx, tdbox[6][5], 9, 54, "Transpose", 14);
|
---|
333 | vcputsv(tunob, 64, cx, tdbox[6][5], 10, 54, "and Copy", 14);
|
---|
334 | }
|
---|
335 |
|
---|
336 | /*
|
---|
337 | =============================================================================
|
---|
338 | td_incr() -- display increment select label
|
---|
339 | =============================================================================
|
---|
340 | */
|
---|
341 |
|
---|
342 | void td_incr(int16_t mode)
|
---|
343 | {
|
---|
344 | register uint16_t cx;
|
---|
345 |
|
---|
346 | cx = exp_c(mode ? TDSELD : tdbox[6][4]);
|
---|
347 | vbank(0);
|
---|
348 | vcputsv(tunob, 64, cx, tdbox[6][5], 12, 54, "Increment", 14);
|
---|
349 | }
|
---|
350 |
|
---|
351 | /*
|
---|
352 | =============================================================================
|
---|
353 | td_intp() -- display interpolate select label
|
---|
354 | =============================================================================
|
---|
355 | */
|
---|
356 |
|
---|
357 | void td_intp(int16_t mode)
|
---|
358 | {
|
---|
359 | register uint16_t cx;
|
---|
360 |
|
---|
361 | cx = exp_c(mode ? TDSELD : tdbox[6][4]);
|
---|
362 | vbank(0);
|
---|
363 | vcputsv(tunob, 64, cx, tdbox[6][5], 14, 54, "Intrpolat", 14);
|
---|
364 | }
|
---|
365 |
|
---|
366 | /* |
---|
367 |
|
---|
368 | */
|
---|
369 |
|
---|
370 | /*
|
---|
371 | =============================================================================
|
---|
372 | advtcur() -- advance the tuning display text cursor
|
---|
373 | =============================================================================
|
---|
374 | */
|
---|
375 |
|
---|
376 | void advtcur(void)
|
---|
377 | {
|
---|
378 | register int16_t newcol;
|
---|
379 |
|
---|
380 | if (infield(stcrow, stccol, curfet))
|
---|
381 | cfetp = infetp;
|
---|
382 | else
|
---|
383 | return;
|
---|
384 |
|
---|
385 | newcol = stccol + 1;
|
---|
386 |
|
---|
387 | if (newcol LE cfetp->frcol)
|
---|
388 | itcpos(stcrow, newcol);
|
---|
389 |
|
---|
390 | cxval = stccol * 8;
|
---|
391 | cyval = stcrow * 14;
|
---|
392 | }
|
---|
393 |
|
---|
394 | /*
|
---|
395 | =============================================================================
|
---|
396 | bsptcur() -- backspace the tuning display text cursor
|
---|
397 | =============================================================================
|
---|
398 | */
|
---|
399 |
|
---|
400 | void bsptcur(void)
|
---|
401 | {
|
---|
402 | register int16_t newcol;
|
---|
403 |
|
---|
404 | if (infield(stcrow, stccol, curfet))
|
---|
405 | cfetp = infetp;
|
---|
406 | else
|
---|
407 | return;
|
---|
408 |
|
---|
409 | newcol = stccol - 1;
|
---|
410 |
|
---|
411 | if (newcol GE cfetp->flcol)
|
---|
412 | itcpos(stcrow, newcol);
|
---|
413 |
|
---|
414 | cxval = stccol * 8;
|
---|
415 | cyval = stcrow * 14;
|
---|
416 | }
|
---|
417 |
|
---|
418 | /* |
---|
419 |
|
---|
420 | */
|
---|
421 |
|
---|
422 | /*
|
---|
423 | =============================================================================
|
---|
424 | dsttval() -- display a tuning table value
|
---|
425 | =============================================================================
|
---|
426 | */
|
---|
427 |
|
---|
428 | void dsttval(int16_t row, int16_t col, int16_t val, uint16_t fg, uint16_t bg)
|
---|
429 | {
|
---|
430 | register uint16_t cfg, cbg;
|
---|
431 |
|
---|
432 | cfg = exp_c(fg);
|
---|
433 | cbg = exp_c(bg);
|
---|
434 |
|
---|
435 | cnvc2p(bfs, (val >> 1));
|
---|
436 |
|
---|
437 | bfs[0] += '0';
|
---|
438 | bfs[1] += 'A';
|
---|
439 | bfs[2] = sfdsp[bfs[2] - 7];
|
---|
440 | bfs[3] += '0';
|
---|
441 | bfs[4] += '0';
|
---|
442 | bfs[5] = '\0';
|
---|
443 |
|
---|
444 | vbank(0);
|
---|
445 | vcputsv(tunob, 64, cfg, cbg, row, col, bfs, 14);
|
---|
446 | }
|
---|
447 |
|
---|
448 | /* |
---|
449 |
|
---|
450 | */
|
---|
451 |
|
---|
452 | /*
|
---|
453 | =============================================================================
|
---|
454 | tdswin() -- display a window
|
---|
455 | =============================================================================
|
---|
456 | */
|
---|
457 |
|
---|
458 | void tdswin(int16_t n)
|
---|
459 | {
|
---|
460 | register int16_t cx, i, tv;
|
---|
461 | int8_t ts;
|
---|
462 |
|
---|
463 | cx = exp_c(tdbox[n][5]);
|
---|
464 |
|
---|
465 | /* first, fill the box with the background color */
|
---|
466 |
|
---|
467 | vbank(0);
|
---|
468 | vbfill4(tunob, 128, tdbox[n][0], tdbox[n][1], tdbox[n][2],
|
---|
469 | tdbox[n][3], cx);
|
---|
470 |
|
---|
471 | /* put in the box label */
|
---|
472 |
|
---|
473 | tsplot4(tunob, 64, tdbox[n][4], tdbox[n][6], tdbox[n][7],
|
---|
474 | tdbxlb[n], 14);
|
---|
475 |
|
---|
476 | /* |
---|
477 |
|
---|
478 | */
|
---|
479 | switch (n) { /* final text - overlays above stuff */
|
---|
480 |
|
---|
481 | case 0: /* keys 0..23 */
|
---|
482 |
|
---|
483 | for (i = 0; i < 24; i++) {
|
---|
484 |
|
---|
485 | tsplot4(tunob, 64, TDLABEL, i, 1, tdlabl[i], 14);
|
---|
486 | sprintf(bfs, "%2d", 1 + i);
|
---|
487 | tsplot4(tunob, 64, TDMKEYC, i, 3, bfs, 14);
|
---|
488 | dsttval(i, 6, tuntab[i],
|
---|
489 | ((tuntab[i] EQ 320) OR (tuntab[i] EQ 21920))
|
---|
490 | ? TDMKEYC : tdbox[n][4], tdbox[n][5]);
|
---|
491 | }
|
---|
492 |
|
---|
493 | return;
|
---|
494 |
|
---|
495 | case 1: /* keys 24..47 */
|
---|
496 |
|
---|
497 | for (i = 24; i < 48; i++) {
|
---|
498 |
|
---|
499 | sprintf(bfs, "%2d", 1 + i);
|
---|
500 | tsplot4(tunob, 64, TDMKEYC, i - 24, 13, bfs, 14);
|
---|
501 | dsttval(i - 24, 16, tuntab[i],
|
---|
502 | ((tuntab[i] EQ 320) OR (tuntab[i] EQ 21920))
|
---|
503 | ? TDMKEYC : tdbox[n][4], tdbox[n][5]);
|
---|
504 | }
|
---|
505 |
|
---|
506 | return;
|
---|
507 |
|
---|
508 | case 2: /* keys 48..71 */
|
---|
509 |
|
---|
510 | for (i = 48; i < 72; i++) {
|
---|
511 |
|
---|
512 | sprintf(bfs, "%2d", 1 + i);
|
---|
513 | tsplot4(tunob, 64, TDMKEYC, i - 48, 23, bfs, 14);
|
---|
514 | dsttval(i - 48, 26, tuntab[i],
|
---|
515 | ((tuntab[i] EQ 320) OR (tuntab[i] EQ 21920))
|
---|
516 | ? TDMKEYC : tdbox[n][4], tdbox[n][5]);
|
---|
517 | }
|
---|
518 |
|
---|
519 | return;
|
---|
520 | /* |
---|
521 |
|
---|
522 | */
|
---|
523 | case 3: /* keys 72..95 */
|
---|
524 |
|
---|
525 | for (i = 72; i < 96; i++) {
|
---|
526 |
|
---|
527 | sprintf(bfs, "%2d", 1 + i);
|
---|
528 | tsplot4(tunob, 64, TDMKEYC, i - 72, 33, bfs, 14);
|
---|
529 | dsttval(i - 72, 36, tuntab[i],
|
---|
530 | ((tuntab[i] EQ 320) OR (tuntab[i] EQ 21920))
|
---|
531 | ? TDMKEYC : tdbox[n][4], tdbox[n][5]);
|
---|
532 | }
|
---|
533 |
|
---|
534 | return;
|
---|
535 |
|
---|
536 | case 4: /* keys 96..119 */
|
---|
537 |
|
---|
538 | for (i = 96; i < 120; i++) {
|
---|
539 |
|
---|
540 | sprintf(bfs, "%3d", 1 + i);
|
---|
541 | tsplot4(tunob, 64, TDMKEYC, i - 96, 43, bfs, 14);
|
---|
542 | dsttval(i - 96, 47, tuntab[i],
|
---|
543 | ((tuntab[i] EQ 320) OR (tuntab[i] EQ 21920))
|
---|
544 | ? TDMKEYC : tdbox[n][4], tdbox[n][5]);
|
---|
545 | }
|
---|
546 |
|
---|
547 | return;
|
---|
548 |
|
---|
549 | case 5: /* keys 120..127 */
|
---|
550 |
|
---|
551 | for (i = 120; i < 128; i++) {
|
---|
552 |
|
---|
553 | sprintf(bfs, "%3d", 1 + i);
|
---|
554 | tsplot4(tunob, 64, TDMKEYC, i - 120, 54, bfs, 14);
|
---|
555 | dsttval(i - 120, 58, tuntab[i],
|
---|
556 | ((tuntab[i] EQ 320) OR (tuntab[i] EQ 21920))
|
---|
557 | ? TDMKEYC : tdbox[n][4], tdbox[n][5]);
|
---|
558 | }
|
---|
559 |
|
---|
560 | return;
|
---|
561 | /* |
---|
562 |
|
---|
563 | */
|
---|
564 | case 6:
|
---|
565 |
|
---|
566 | td_trcp(0);
|
---|
567 | td_incr(0);
|
---|
568 | td_intp(0);
|
---|
569 | tsplot4(tunob, 64, tdbox[n][4], 16, 54, "Undo", 14);
|
---|
570 |
|
---|
571 | tv = (tunval GE 0 ? tunval : -tunval) >> 1;
|
---|
572 | ts = tunval GE 0 ? '+' : '-';
|
---|
573 | sprintf(bfs, "Val %c%04d", ts, tv);
|
---|
574 | tsplot4(tunob, 64, tdbox[n][4], 18, 54, bfs, 14);
|
---|
575 |
|
---|
576 | tsplot4(tunob, 64, tdbox[n][4], 20, 54, "Store", 14);
|
---|
577 | tsplot4(tunob, 64, tdbox[n][4], 22, 54, "Retrieve", 14);
|
---|
578 |
|
---|
579 | tsplot4(tunob, 64, tdbox[n][4], 24, 54, "Table #", 14);
|
---|
580 | bfs[0] = curtun + '0';
|
---|
581 | bfs[1] = '\0';
|
---|
582 | tsplot4(tunob, 64, tunmod ? TDCHGD : tdbox[n][4],
|
---|
583 | 24, 61, bfs, 14);
|
---|
584 |
|
---|
585 | return;
|
---|
586 |
|
---|
587 | case 7: /* tuning table name */
|
---|
588 |
|
---|
589 | tsplot4(tunob, 64, tdbox[n][4], 24, 7, tuncurn, 14);
|
---|
590 | return;
|
---|
591 | }
|
---|
592 | }
|
---|
593 |
|
---|
594 | /* |
---|
595 |
|
---|
596 | */
|
---|
597 |
|
---|
598 | /*
|
---|
599 | =============================================================================
|
---|
600 | twins() -- display all tuning editor windows
|
---|
601 | =============================================================================
|
---|
602 | */
|
---|
603 |
|
---|
604 | void twins(void)
|
---|
605 | {
|
---|
606 | register int16_t i;
|
---|
607 |
|
---|
608 | for (i = 0; i < 8; i++)
|
---|
609 | tdswin(i);
|
---|
610 | }
|
---|
611 |
|
---|
612 | /* |
---|
613 |
|
---|
614 | */
|
---|
615 |
|
---|
616 | /*
|
---|
617 | =============================================================================
|
---|
618 | tundsp() -- put up the tuning display
|
---|
619 | =============================================================================
|
---|
620 | */
|
---|
621 |
|
---|
622 | void tundsp(void)
|
---|
623 | {
|
---|
624 | tunob = &v_score[0]; /* setup object pointer */
|
---|
625 | obj0 = &v_curs0[0]; /* setup cursor object pointer */
|
---|
626 | obj2 = &v_tcur[0]; /* setup typewriter object pointer */
|
---|
627 | tdoct = &v_obtab[TUNOBJ]; /* setup object control table pointer */
|
---|
628 |
|
---|
629 | ttcmdsv = 0; /* nothing selected */
|
---|
630 | tdnamsw = FALSE;
|
---|
631 | submenu = FALSE;
|
---|
632 |
|
---|
633 | dswap(); /* initialize display */
|
---|
634 |
|
---|
635 | if (v_regs[5] & 0x0180)
|
---|
636 | vbank(0);
|
---|
637 |
|
---|
638 | memsetw(tunob, 0, 32767); /* clear the display */
|
---|
639 | memsetw(tunob+32767L, 0, 12033);
|
---|
640 |
|
---|
641 | SetObj(TUNOBJ, 0, 0, tunob, 512, 350, 0, 0, TUNFL, -1);
|
---|
642 | SetObj( 0, 0, 1, obj0, 16, 16, TDCURX, TDCURY, OBFL_00, -1);
|
---|
643 | SetObj(TTCURS, 0, 1, obj2, 16, 16, 0, 0, TTCCFL, -1);
|
---|
644 |
|
---|
645 | arcurs(TDCURSR); /* setup arrow cursor object */
|
---|
646 | itcini(TDCURSR); /* setup text cursor object */
|
---|
647 | ttcini(TDTCURC); /* setup typewriter cursor object */
|
---|
648 |
|
---|
649 | twins();
|
---|
650 |
|
---|
651 | SetPri(TUNOBJ, TUNPRI);
|
---|
652 |
|
---|
653 | settc(YTOR(TDCURY), XTOC(TDCURX)); /* display the text cursor */
|
---|
654 |
|
---|
655 | vsndpal(tunpal);
|
---|
656 | }
|
---|