1 | /*
|
---|
2 | =============================================================================
|
---|
3 | etiosc.c -- MIDAS instrument editor -- oscillator field handlers
|
---|
4 | Version 31 -- 1988-10-27 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "ram.h"
|
---|
9 |
|
---|
10 | /* initialized variables */
|
---|
11 |
|
---|
12 | /* C C# D D# E F F# G G# A A# B */
|
---|
13 | int8_t notes[] = {2, 2, 3, 3, 4, 5, 5, 6, 6, 0, 0, 1};
|
---|
14 |
|
---|
15 | /* A B C D E F G */
|
---|
16 | int16_t pitches[] = { 900, 1100, 0, 200, 400, 500, 700};
|
---|
17 |
|
---|
18 | #include "ratio.h" /* short ratio[]; */
|
---|
19 |
|
---|
20 | /* C C# D D# E F F# G G# A A# B */
|
---|
21 | int8_t sharps[] = {7, 9, 7, 9, 7, 7, 9, 7, 9, 7, 9, 7};
|
---|
22 |
|
---|
23 | int16_t shrpflt[] = { 0, -100, 100};
|
---|
24 |
|
---|
25 | int8_t sfdsp[] = {' ', (int8_t)D_FLAT, (int8_t)D_SHARP};
|
---|
26 |
|
---|
27 | static int8_t intstr[] = "+0000";
|
---|
28 | static int8_t ratstr[] = "1/1";
|
---|
29 | static int8_t frqstr[] = "00.0";
|
---|
30 | static int8_t pchstr[] = "0C 00";
|
---|
31 |
|
---|
32 | int16_t ndvals[10] = {0, 0, 1200, 1902, 2400, 2786, 3102, 3369, 3600, 3804};
|
---|
33 |
|
---|
34 | /*
|
---|
35 | =============================================================================
|
---|
36 | int2rat() -- convert interval to ratio
|
---|
37 | =============================================================================
|
---|
38 | */
|
---|
39 |
|
---|
40 | void int2rat(int16_t rat)
|
---|
41 | {
|
---|
42 | register int16_t den, inum, num;
|
---|
43 |
|
---|
44 | ebuf[0] = '1';
|
---|
45 | ebuf[1] = '/';
|
---|
46 | ebuf[2] = '1';
|
---|
47 | ebuf[3] = '\0';
|
---|
48 |
|
---|
49 | for (num = 1; num < 10; num++) {
|
---|
50 |
|
---|
51 | inum = 10 * num;
|
---|
52 |
|
---|
53 | for (den = 1; den < 10; den++) {
|
---|
54 |
|
---|
55 | if (rat EQ ratio[inum + den]) {
|
---|
56 |
|
---|
57 | ebuf[0] = (int8_t)(num + '0');
|
---|
58 | ebuf[2] = (int8_t)(den + '0');
|
---|
59 | return;
|
---|
60 | }
|
---|
61 | }
|
---|
62 | }
|
---|
63 | }
|
---|
64 |
|
---|
65 | /*
|
---|
66 | =============================================================================
|
---|
67 | cnvc2p() -- convert cents to pitch
|
---|
68 | =============================================================================
|
---|
69 | */
|
---|
70 |
|
---|
71 | void cnvc2p(int8_t *buf, int16_t cv)
|
---|
72 | {
|
---|
73 | int16_t rem, tmp;
|
---|
74 |
|
---|
75 | cv -= 160;
|
---|
76 | buf[0] = (int8_t)(cv / 1200);
|
---|
77 | rem = cv - (buf[0] * 1200);
|
---|
78 | tmp = rem / 100;
|
---|
79 | rem -= (tmp * 100);
|
---|
80 | buf[1] = notes[tmp];
|
---|
81 | buf[2] = sharps[tmp];
|
---|
82 | buf[3] = (int8_t)(rem / 10);
|
---|
83 | buf[4] = (int8_t)(rem - (buf[3] * 10));
|
---|
84 | }
|
---|
85 |
|
---|
86 | /*
|
---|
87 | =============================================================================
|
---|
88 | cnvp2c() -- convert pitch to cents
|
---|
89 |
|
---|
90 | input in edit buffer:
|
---|
91 |
|
---|
92 | ebuf[0] = octave 0..9
|
---|
93 | ebuf[1] = note A..G (0..6)
|
---|
94 | ebuf[2] = type natural, flat, sharp (7..9)
|
---|
95 | ebuf[3] = ms byte of offset 0..9
|
---|
96 | ebuf[4] = ls byte of offset 0..9
|
---|
97 |
|
---|
98 | output in cents
|
---|
99 | =============================================================================
|
---|
100 | */
|
---|
101 |
|
---|
102 | int16_t cnvp2c(void)
|
---|
103 | {
|
---|
104 | if (ebuf[0] EQ 9) { /* high limit is C9 00 */
|
---|
105 | if (ebuf[1] GT 2)
|
---|
106 | return(FAILURE);
|
---|
107 | else if (ebuf[1] EQ 2) {
|
---|
108 | if (ebuf[2] NE 7)
|
---|
109 | return(FAILURE);
|
---|
110 | else if (ebuf[3] OR ebuf[4])
|
---|
111 | return(FAILURE);
|
---|
112 | }
|
---|
113 | }
|
---|
114 |
|
---|
115 | cents = (ebuf[0] * 1200) + pitches[(int16_t)ebuf[1]]
|
---|
116 | + shrpflt[ebuf[2] - 7] + (ebuf[3] * 10) + ebuf[4] + 160;
|
---|
117 |
|
---|
118 | return(SUCCESS);
|
---|
119 | }
|
---|
120 |
|
---|
121 | /*
|
---|
122 | =============================================================================
|
---|
123 | et_iosc() -- load the edit buffer
|
---|
124 | =============================================================================
|
---|
125 | */
|
---|
126 |
|
---|
127 | int16_t et_iosc(int16_t nn)
|
---|
128 | {
|
---|
129 | register struct instdef *ip;
|
---|
130 | register int16_t val, ctl, fh, fl, v;
|
---|
131 |
|
---|
132 | v = (nn >> 8) & 0x03;
|
---|
133 | ip = &vbufs[curvce];
|
---|
134 |
|
---|
135 | switch (v) {
|
---|
136 |
|
---|
137 | case 0:
|
---|
138 |
|
---|
139 | val = ip->idhos1v;
|
---|
140 | ctl = ip->idhos1c;
|
---|
141 | break;
|
---|
142 |
|
---|
143 | case 1:
|
---|
144 |
|
---|
145 | val = ip->idhos2v;
|
---|
146 | ctl = ip->idhos2c;
|
---|
147 | break;
|
---|
148 |
|
---|
149 | case 2:
|
---|
150 |
|
---|
151 | val = ip->idhos3v;
|
---|
152 | ctl = ip->idhos3c;
|
---|
153 | break;
|
---|
154 |
|
---|
155 | case 3:
|
---|
156 |
|
---|
157 | val = ip->idhos4v;
|
---|
158 | ctl = ip->idhos4c;
|
---|
159 | break;
|
---|
160 | }
|
---|
161 |
|
---|
162 | bform = ctl & OC_MOD;
|
---|
163 |
|
---|
164 | switch (bform) {
|
---|
165 |
|
---|
166 | case OC_INT: /* interval */
|
---|
167 |
|
---|
168 | sprintf(ebuf, "%04d%c", ((val < 0 ? -val : val) >> 1),
|
---|
169 | (val < 0 ? '-' : '+'));
|
---|
170 |
|
---|
171 | ebflag = TRUE;
|
---|
172 | return(SUCCESS);
|
---|
173 |
|
---|
174 | case OC_RAT: /* ratio */
|
---|
175 |
|
---|
176 | int2rat(val >> 1);
|
---|
177 | ebflag = TRUE;
|
---|
178 | return(SUCCESS);
|
---|
179 |
|
---|
180 | case OC_FRQ: /* frequency */
|
---|
181 |
|
---|
182 | fh = (val >> 1) / 10;
|
---|
183 | fl = (val >> 1) - (fh * 10);
|
---|
184 |
|
---|
185 | sprintf(ebuf, "%02d.%d", fh, fl);
|
---|
186 | ebflag = TRUE;
|
---|
187 | return(SUCCESS);
|
---|
188 |
|
---|
189 | case OC_PCH:
|
---|
190 |
|
---|
191 | cnvc2p(ebuf, (val >> 1));
|
---|
192 | ebflag = TRUE;
|
---|
193 | return(SUCCESS);
|
---|
194 | }
|
---|
195 |
|
---|
196 | return(FAILURE);
|
---|
197 | }
|
---|
198 |
|
---|
199 | /*
|
---|
200 | =============================================================================
|
---|
201 | setoval() -- set oscillator mode and pitch/ratio variables
|
---|
202 | =============================================================================
|
---|
203 | */
|
---|
204 |
|
---|
205 | void setoval(struct instdef *ip, int16_t v, int16_t val)
|
---|
206 | {
|
---|
207 | switch (v) {
|
---|
208 |
|
---|
209 | case 0:
|
---|
210 |
|
---|
211 | ip->idhos1v = val << 1;
|
---|
212 | ip->idhos1c = (int8_t)((ip->idhos1c & ~OC_MOD) | bform);
|
---|
213 | break;
|
---|
214 |
|
---|
215 | case 1:
|
---|
216 |
|
---|
217 | ip->idhos2v = val << 1;
|
---|
218 | ip->idhos2c = (int8_t)((ip->idhos2c & ~OC_MOD) | bform);
|
---|
219 | break;
|
---|
220 |
|
---|
221 | case 2:
|
---|
222 |
|
---|
223 | ip->idhos3v = val << 1;
|
---|
224 | ip->idhos3c = (int8_t)((ip->idhos3c & ~OC_MOD) | bform);
|
---|
225 | break;
|
---|
226 |
|
---|
227 | case 3:
|
---|
228 |
|
---|
229 | ip->idhos4v = val << 1;
|
---|
230 | ip->idhos4c = (int8_t)((ip->idhos4c & ~OC_MOD) | bform);
|
---|
231 | break;
|
---|
232 | }
|
---|
233 |
|
---|
234 | ip->idhfnc[v].idftmd = (int8_t)((ip->idhfnc[v].idftmd & ~I_NRATIO)
|
---|
235 | | ((bform & 2) ? I_NRATIO : 0));
|
---|
236 | }
|
---|
237 |
|
---|
238 | /*
|
---|
239 | =============================================================================
|
---|
240 | ef_iosc() -- unload (parse) edit buffer
|
---|
241 | =============================================================================
|
---|
242 | */
|
---|
243 |
|
---|
244 | int16_t ef_iosc(int16_t nn)
|
---|
245 | {
|
---|
246 | register struct instdef *ip;
|
---|
247 | register int16_t v, i, tmp;
|
---|
248 |
|
---|
249 | v = (nn >> 8) & 3;
|
---|
250 | ip = &vbufs[curvce];
|
---|
251 | ebflag = FALSE;
|
---|
252 |
|
---|
253 | switch (bform) {
|
---|
254 |
|
---|
255 | case OC_INT: /* interval */
|
---|
256 |
|
---|
257 | tmp = 0;
|
---|
258 |
|
---|
259 | for (i = 0; i < 4; i++)
|
---|
260 | tmp = (tmp * 10) + (ebuf[i] - '0');
|
---|
261 |
|
---|
262 | if (ebuf[4] EQ '-')
|
---|
263 | tmp = -tmp;
|
---|
264 |
|
---|
265 | setoval(ip, v, tmp);
|
---|
266 | modinst();
|
---|
267 | return(SUCCESS);
|
---|
268 |
|
---|
269 | case OC_RAT: /* ratio */
|
---|
270 |
|
---|
271 | tmp = ndvals[ebuf[0] - '0'] - ndvals[ebuf[2] - '0'];
|
---|
272 |
|
---|
273 | setoval(ip, v, tmp);
|
---|
274 | modinst();
|
---|
275 | return(SUCCESS);
|
---|
276 |
|
---|
277 | case OC_FRQ: /* frequency */
|
---|
278 |
|
---|
279 | tmp = 0;
|
---|
280 |
|
---|
281 | for (i = 0; i < 2; i++)
|
---|
282 | tmp = (tmp * 10) + ebuf[i] - '0';
|
---|
283 |
|
---|
284 | tmp = (tmp * 10) + ebuf[3] - '0';
|
---|
285 |
|
---|
286 | if (tmp GT 159)
|
---|
287 | return(FAILURE);
|
---|
288 |
|
---|
289 | setoval(ip, v, tmp);
|
---|
290 | modinst();
|
---|
291 | return(SUCCESS);
|
---|
292 |
|
---|
293 | case OC_PCH: /* pitch */
|
---|
294 |
|
---|
295 | if (cnvp2c() EQ FAILURE)
|
---|
296 | return(FAILURE);
|
---|
297 |
|
---|
298 | setoval(ip, v, cents);
|
---|
299 | modinst();
|
---|
300 | return(SUCCESS);
|
---|
301 | }
|
---|
302 |
|
---|
303 | return(FAILURE);
|
---|
304 | }
|
---|
305 |
|
---|
306 | /*
|
---|
307 | =============================================================================
|
---|
308 | rd_iosc() -- (re)display the field
|
---|
309 | =============================================================================
|
---|
310 | */
|
---|
311 |
|
---|
312 | int16_t rd_iosc(int16_t nn)
|
---|
313 | {
|
---|
314 | register struct instdef *ip;
|
---|
315 | register int16_t val, ctl, fh, fl, v;
|
---|
316 | int16_t n;
|
---|
317 | int8_t ocs;
|
---|
318 |
|
---|
319 | v = (nn >> 8) & 0x03;
|
---|
320 | n = nn & 0xFF;
|
---|
321 | ip = &vbufs[curvce];
|
---|
322 |
|
---|
323 | switch (v) {
|
---|
324 |
|
---|
325 | case 0:
|
---|
326 |
|
---|
327 | val = ip->idhos1v;
|
---|
328 | ctl = ip->idhos1c;
|
---|
329 | break;
|
---|
330 |
|
---|
331 | case 1:
|
---|
332 |
|
---|
333 | val = ip->idhos2v;
|
---|
334 | ctl = ip->idhos2c;
|
---|
335 | break;
|
---|
336 |
|
---|
337 | case 2:
|
---|
338 |
|
---|
339 | val = ip->idhos3v;
|
---|
340 | ctl = ip->idhos3c;
|
---|
341 | break;
|
---|
342 |
|
---|
343 | case 3:
|
---|
344 |
|
---|
345 | val = ip->idhos4v;
|
---|
346 | ctl = ip->idhos4c;
|
---|
347 | break;
|
---|
348 | }
|
---|
349 |
|
---|
350 | bform = ctl & OC_MOD;
|
---|
351 | ocs = ((v EQ 3) ? ' ' : (ctl & OC_SYN ? 'S' : 's'));
|
---|
352 |
|
---|
353 | switch (bform) {
|
---|
354 |
|
---|
355 | case OC_INT: /* interval */
|
---|
356 |
|
---|
357 | sprintf(dspbuf, "Int %c%04d %c",
|
---|
358 | (val < 0 ? '-' : '+'),
|
---|
359 | ((val < 0 ? -val : val) >> 1),
|
---|
360 | ocs);
|
---|
361 | break;
|
---|
362 |
|
---|
363 | case OC_RAT: /* ratio */
|
---|
364 |
|
---|
365 | int2rat(val >> 1);
|
---|
366 | sprintf(dspbuf, "Rat %c/%c %c", ebuf[0], ebuf[2], ocs);
|
---|
367 | break;
|
---|
368 |
|
---|
369 | case OC_FRQ: /* frequency */
|
---|
370 |
|
---|
371 | fh = (val >> 1) / 10;
|
---|
372 | fl = (val >> 1) - (fh * 10);
|
---|
373 |
|
---|
374 | sprintf(dspbuf, "Frq %02d.%d %c", fh, fl, ocs);
|
---|
375 | break;
|
---|
376 |
|
---|
377 | case OC_PCH:
|
---|
378 |
|
---|
379 | strcpy(dspbuf, "Pch ");
|
---|
380 | cnvc2p(&dspbuf[4], (val >> 1));
|
---|
381 | dspbuf[4] = (int8_t)(dspbuf[4] + '0');
|
---|
382 | dspbuf[5] = (int8_t)(dspbuf[5] + 'A');
|
---|
383 | dspbuf[6] = sfdsp[dspbuf[6] - 7];
|
---|
384 | dspbuf[7] = (int8_t)(dspbuf[7] + '0');
|
---|
385 | dspbuf[8] = (int8_t)(dspbuf[8] + '0');
|
---|
386 | dspbuf[9] = ' ';
|
---|
387 | dspbuf[10] = ocs;
|
---|
388 | dspbuf[11] = '\0';
|
---|
389 | break;
|
---|
390 | }
|
---|
391 |
|
---|
392 | if (v_regs[5] & 0x0180)
|
---|
393 | vbank(0);
|
---|
394 |
|
---|
395 | vcputsv(instob, 64, idbox[n][4], idbox[n][5], 18 + v , 36, dspbuf, 14);
|
---|
396 |
|
---|
397 | return(SUCCESS);
|
---|
398 | }
|
---|
399 |
|
---|
400 | /*
|
---|
401 | =============================================================================
|
---|
402 | setoscb() -- change oscillator data entry buffer format
|
---|
403 | =============================================================================
|
---|
404 | */
|
---|
405 |
|
---|
406 | void setoscb(int16_t n, int16_t v)
|
---|
407 | {
|
---|
408 | register struct instdef *ip;
|
---|
409 | register int16_t bfm, ctl, val;
|
---|
410 | register int8_t ocs;
|
---|
411 |
|
---|
412 | ip = &vbufs[curvce];
|
---|
413 |
|
---|
414 | switch (v) {
|
---|
415 |
|
---|
416 | case 0:
|
---|
417 |
|
---|
418 | ctl = ip->idhos1c;
|
---|
419 | val = ip->idhos1v;
|
---|
420 | break;
|
---|
421 |
|
---|
422 | case 1:
|
---|
423 |
|
---|
424 | ctl = ip->idhos2c;
|
---|
425 | val = ip->idhos2v;
|
---|
426 | break;
|
---|
427 |
|
---|
428 | case 2:
|
---|
429 |
|
---|
430 | ctl = ip->idhos3c;
|
---|
431 | val = ip->idhos3v;
|
---|
432 | break;
|
---|
433 |
|
---|
434 | case 3:
|
---|
435 |
|
---|
436 | ctl = ip->idhos4c;
|
---|
437 | val = ip->idhos4v;
|
---|
438 | break;
|
---|
439 |
|
---|
440 | default:
|
---|
441 |
|
---|
442 | ctl = val = -1;
|
---|
443 | break;
|
---|
444 | }
|
---|
445 |
|
---|
446 | ocs = ((v EQ 3) ? ' ' : (ctl & OC_SYN ? 'S' : 's'));
|
---|
447 |
|
---|
448 | bfm = ctl & OC_MOD;
|
---|
449 |
|
---|
450 | switch (bform) {
|
---|
451 |
|
---|
452 | case OC_INT: /* interval */
|
---|
453 |
|
---|
454 | if ((bfm EQ OC_RAT) OR (bfm EQ OC_INT)) {
|
---|
455 |
|
---|
456 | sprintf(ebuf, "%04d%c", ((val < 0 ? -val : val) >> 1),
|
---|
457 | (val < 0 ? '-' : '+'));
|
---|
458 |
|
---|
459 | sprintf(dspbuf, "Int %c%04d %c",
|
---|
460 | (val < 0 ? '-' : '+'),
|
---|
461 | ((val < 0 ? -val : val) >> 1),
|
---|
462 | ocs);
|
---|
463 |
|
---|
464 | } else {
|
---|
465 |
|
---|
466 | strcpy(ebuf, "0000+");
|
---|
467 | sprintf(dspbuf, "Int %s %c", intstr, ocs);
|
---|
468 | }
|
---|
469 |
|
---|
470 | break;
|
---|
471 |
|
---|
472 | case OC_RAT: /* ratio */
|
---|
473 |
|
---|
474 | if (bfm EQ OC_RAT) {
|
---|
475 |
|
---|
476 | int2rat(val >> 1);
|
---|
477 |
|
---|
478 | sprintf(dspbuf, "Rat %c/%c %c",
|
---|
479 | ebuf[0], ebuf[2], ocs);
|
---|
480 |
|
---|
481 | } else {
|
---|
482 |
|
---|
483 | strcpy(ebuf, ratstr);
|
---|
484 | sprintf(dspbuf, "Rat %s %c", ratstr, ocs);
|
---|
485 | }
|
---|
486 |
|
---|
487 | break;
|
---|
488 |
|
---|
489 | case OC_FRQ: /* frequency */
|
---|
490 |
|
---|
491 | strcpy(ebuf, frqstr);
|
---|
492 | sprintf(dspbuf, "Frq %s %c", frqstr, ocs);
|
---|
493 | break;
|
---|
494 |
|
---|
495 | case OC_PCH: /* pitch */
|
---|
496 |
|
---|
497 | ebuf[0] = 0; /* 0 */
|
---|
498 | ebuf[1] = 2; /* C */
|
---|
499 | ebuf[2] = 7; /* */
|
---|
500 | ebuf[3] = 0; /* 0 */
|
---|
501 | ebuf[4] = 0; /* 0 */
|
---|
502 |
|
---|
503 | sprintf(dspbuf, "Pch %s %c", pchstr, ocs);
|
---|
504 | break;
|
---|
505 | }
|
---|
506 |
|
---|
507 | ebflag = TRUE;
|
---|
508 |
|
---|
509 | if (v_regs[5] & 0x0180)
|
---|
510 | vbank(0);
|
---|
511 |
|
---|
512 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
|
---|
513 | stcrow, 36, dspbuf, 14);
|
---|
514 | }
|
---|
515 |
|
---|
516 | /*
|
---|
517 | =============================================================================
|
---|
518 | setosyn() -- set oscillator sync mode
|
---|
519 | =============================================================================
|
---|
520 | */
|
---|
521 |
|
---|
522 | void setosyn(int16_t n, int16_t v, int16_t t)
|
---|
523 | {
|
---|
524 | register struct instdef *ip;
|
---|
525 | register int8_t *sc;
|
---|
526 |
|
---|
527 | ip = &vbufs[curvce];
|
---|
528 |
|
---|
529 | if (stcrow EQ 21)
|
---|
530 | return;
|
---|
531 |
|
---|
532 | sc = t ? "S" : "s";
|
---|
533 |
|
---|
534 | switch (v) {
|
---|
535 |
|
---|
536 | case 0:
|
---|
537 |
|
---|
538 | ip->idhos1c = (int8_t)((ip->idhos1c & ~OC_SYN) | (t ? OC_SYN : 0));
|
---|
539 | break;
|
---|
540 |
|
---|
541 | case 1:
|
---|
542 |
|
---|
543 | ip->idhos2c = (int8_t)((ip->idhos2c & ~OC_SYN) | (t ? OC_SYN : 0));
|
---|
544 | break;
|
---|
545 |
|
---|
546 | case 2:
|
---|
547 |
|
---|
548 | ip->idhos3c = (int8_t)((ip->idhos3c & ~OC_SYN) | (t ? OC_SYN : 0));
|
---|
549 | break;
|
---|
550 |
|
---|
551 | case 3:
|
---|
552 |
|
---|
553 | return;
|
---|
554 | }
|
---|
555 |
|
---|
556 | dosync(curvce);
|
---|
557 |
|
---|
558 | if (v_regs[5] & 0x0180)
|
---|
559 | vbank(0);
|
---|
560 |
|
---|
561 | vcputsv(instob, 64, idbox[n][4], idbox[n][5], stcrow, stccol, sc, 14);
|
---|
562 | modinst();
|
---|
563 | }
|
---|
564 |
|
---|
565 | /*
|
---|
566 | =============================================================================
|
---|
567 | nd_iosc() -- handle new data entry
|
---|
568 | =============================================================================
|
---|
569 | */
|
---|
570 |
|
---|
571 | int16_t nd_iosc(int16_t nn, int16_t k)
|
---|
572 | {
|
---|
573 | register int16_t v, n;
|
---|
574 |
|
---|
575 | n = nn & 0xFF;
|
---|
576 | v = (nn >> 8) & 3;
|
---|
577 |
|
---|
578 | if (stccol LT 39) { /* mode */
|
---|
579 |
|
---|
580 | if (k EQ 8) { /* - */
|
---|
581 |
|
---|
582 | if (--bform LT 0)
|
---|
583 | bform = 3;
|
---|
584 |
|
---|
585 | setoscb(n, v);
|
---|
586 | return(SUCCESS);
|
---|
587 |
|
---|
588 | } else if (k EQ 9) { /* + */
|
---|
589 |
|
---|
590 | if (++bform GT 3)
|
---|
591 | bform = 0;
|
---|
592 |
|
---|
593 | setoscb(n, v);
|
---|
594 | return(SUCCESS);
|
---|
595 |
|
---|
596 | } else
|
---|
597 | return(FAILURE);
|
---|
598 |
|
---|
599 | } else if (stccol EQ 46) { /* sync */
|
---|
600 |
|
---|
601 | if (stcrow EQ 21)
|
---|
602 | return(FAILURE);
|
---|
603 |
|
---|
604 | if (k EQ 8) { /* - */
|
---|
605 |
|
---|
606 | setosyn(n, v, 0); /* off */
|
---|
607 | return(SUCCESS);
|
---|
608 |
|
---|
609 | } else if (k EQ 9) { /* + */
|
---|
610 |
|
---|
611 | setosyn(n, v, 1); /* on */
|
---|
612 | return(SUCCESS);
|
---|
613 |
|
---|
614 | } else
|
---|
615 | return(FAILURE);
|
---|
616 |
|
---|
617 |
|
---|
618 | } else if ((stccol GE 40) AND (stccol LE 44)) { /* value */
|
---|
619 |
|
---|
620 | switch (bform) {
|
---|
621 |
|
---|
622 | case OC_INT: /* interval */
|
---|
623 |
|
---|
624 | if (stccol EQ 40) { /* sign */
|
---|
625 |
|
---|
626 | if (k EQ 8) { /* - */
|
---|
627 |
|
---|
628 | k = '-';
|
---|
629 | ebuf[4] = '-';
|
---|
630 |
|
---|
631 | } else if (k EQ 9) { /* + */
|
---|
632 |
|
---|
633 | k = '+';
|
---|
634 | ebuf[4] = '+';
|
---|
635 |
|
---|
636 | } else
|
---|
637 | return(FAILURE);
|
---|
638 |
|
---|
639 | } else {
|
---|
640 |
|
---|
641 | ebuf[stccol - 41] = (int8_t)(k + '0');
|
---|
642 | }
|
---|
643 |
|
---|
644 | dspbuf[0] = (int8_t)((k > 9) ? k : (k + '0'));
|
---|
645 | dspbuf[1] = '\0';
|
---|
646 |
|
---|
647 | if (v_regs[5] & 0x0180)
|
---|
648 | vbank(0);
|
---|
649 |
|
---|
650 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
|
---|
651 | stcrow, stccol, dspbuf, 14);
|
---|
652 |
|
---|
653 | if (stccol EQ 44)
|
---|
654 | return(SUCCESS);
|
---|
655 |
|
---|
656 | advicur();
|
---|
657 | return(SUCCESS);
|
---|
658 |
|
---|
659 | case OC_RAT: /* ratio */
|
---|
660 |
|
---|
661 | if (stccol EQ 40) {
|
---|
662 |
|
---|
663 | if (k) {
|
---|
664 |
|
---|
665 | ebuf[0] = dspbuf[0] = (int8_t)(k + '0');
|
---|
666 | dspbuf[1] = '\0';
|
---|
667 |
|
---|
668 | if (v_regs[5] & 0x0180)
|
---|
669 | vbank(0);
|
---|
670 |
|
---|
671 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
|
---|
672 | stcrow, stccol, dspbuf, 14);
|
---|
673 |
|
---|
674 | advicur();
|
---|
675 | advicur();
|
---|
676 |
|
---|
677 | return(SUCCESS);
|
---|
678 |
|
---|
679 | } else
|
---|
680 | return(FAILURE);
|
---|
681 |
|
---|
682 | } else if (stccol EQ 42) {
|
---|
683 |
|
---|
684 | if (k) {
|
---|
685 |
|
---|
686 | ebuf[2] = dspbuf[0] = (int8_t)(k + '0');
|
---|
687 | dspbuf[1] = '\0';
|
---|
688 |
|
---|
689 | if (v_regs[5] & 0x0180)
|
---|
690 | vbank(0);
|
---|
691 |
|
---|
692 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
|
---|
693 | stcrow, stccol, dspbuf, 14);
|
---|
694 |
|
---|
695 | return(SUCCESS);
|
---|
696 |
|
---|
697 | } else
|
---|
698 | return(FAILURE);
|
---|
699 | } else {
|
---|
700 |
|
---|
701 | return(FAILURE);
|
---|
702 | }
|
---|
703 |
|
---|
704 | case OC_FRQ: /* frequency */
|
---|
705 |
|
---|
706 | if (stccol EQ 42)
|
---|
707 | return(FAILURE);
|
---|
708 |
|
---|
709 | ebuf[stccol - 40] = (int8_t)(k + '0');
|
---|
710 | dspbuf[0] = (int8_t)(k + '0');
|
---|
711 | dspbuf[1] = '\0';
|
---|
712 |
|
---|
713 | if (v_regs[5] & 0x0180)
|
---|
714 | vbank(0);
|
---|
715 |
|
---|
716 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
|
---|
717 | stcrow, stccol, dspbuf, 14);
|
---|
718 |
|
---|
719 | if (stccol EQ 44)
|
---|
720 | return(SUCCESS);
|
---|
721 |
|
---|
722 | advicur();
|
---|
723 |
|
---|
724 | if (stccol EQ 42)
|
---|
725 | advicur();
|
---|
726 |
|
---|
727 | return(SUCCESS);
|
---|
728 |
|
---|
729 | case OC_PCH: /* pitch */
|
---|
730 |
|
---|
731 | switch (stccol) {
|
---|
732 |
|
---|
733 | case 40:
|
---|
734 |
|
---|
735 | ebuf[0] = (int8_t)k;
|
---|
736 | dspbuf[0] = (int8_t)(k + '0');
|
---|
737 | break;
|
---|
738 |
|
---|
739 | case 41:
|
---|
740 |
|
---|
741 | if (k GT 6)
|
---|
742 | return(FAILURE);
|
---|
743 |
|
---|
744 | ebuf[1] = (int8_t)k;
|
---|
745 | dspbuf[0] = (int8_t)(k + 'A');
|
---|
746 | break;
|
---|
747 |
|
---|
748 | case 42:
|
---|
749 |
|
---|
750 | if (k EQ 7) { /* blank */
|
---|
751 |
|
---|
752 | ebuf[2] = (int8_t)k;
|
---|
753 | dspbuf[0] = sfdsp[0];
|
---|
754 | break;
|
---|
755 |
|
---|
756 | } else if (k EQ 8) { /* flat */
|
---|
757 |
|
---|
758 | ebuf[2] = (int8_t)k;
|
---|
759 | dspbuf[0] = sfdsp[1];
|
---|
760 | break;
|
---|
761 |
|
---|
762 | } else if (k EQ 9) { /* sharp */
|
---|
763 |
|
---|
764 | ebuf[2] = (int8_t)k;
|
---|
765 | dspbuf[0] = sfdsp[2];
|
---|
766 | break;
|
---|
767 |
|
---|
768 | } else
|
---|
769 | return(FAILURE);
|
---|
770 | case 43:
|
---|
771 | case 44:
|
---|
772 |
|
---|
773 | ebuf[stccol - 40] = (int8_t)k;
|
---|
774 | dspbuf[0] = (int8_t)(k + '0');
|
---|
775 | break;
|
---|
776 | }
|
---|
777 |
|
---|
778 | dspbuf[1] = '\0';
|
---|
779 |
|
---|
780 | if (v_regs[5] & 0x0180)
|
---|
781 | vbank(0);
|
---|
782 |
|
---|
783 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
|
---|
784 | stcrow, stccol, dspbuf, 14);
|
---|
785 |
|
---|
786 | if (stccol EQ 44)
|
---|
787 | return(SUCCESS);
|
---|
788 |
|
---|
789 | advicur();
|
---|
790 | return(SUCCESS);
|
---|
791 | }
|
---|
792 |
|
---|
793 | return(FAILURE);
|
---|
794 |
|
---|
795 | } else {
|
---|
796 |
|
---|
797 | return(FAILURE);
|
---|
798 | }
|
---|
799 | }
|
---|
800 |
|
---|