1 | /*
|
---|
2 | =============================================================================
|
---|
3 | wdfield.c -- waveshape display field processing and cursor motion
|
---|
4 | Version 46 -- 1989-11-15 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #define DOUBLED 1 /* non-zero for doubled WS outputs */
|
---|
9 |
|
---|
10 | #include "stddefs.h"
|
---|
11 | #include "fields.h"
|
---|
12 | #include "vsdd.h"
|
---|
13 | #include "graphdef.h"
|
---|
14 | #include "charset.h"
|
---|
15 | #include "hwdefs.h"
|
---|
16 | #include "fpu.h"
|
---|
17 | #include "macros.h"
|
---|
18 | #include "curpak.h"
|
---|
19 |
|
---|
20 | #include "midas.h"
|
---|
21 | #include "instdsp.h"
|
---|
22 | #include "wsdsp.h"
|
---|
23 |
|
---|
24 | #define WCSCALE 32768L
|
---|
25 | #define WCROUND 16384L
|
---|
26 |
|
---|
27 | extern short select(), whatbox(), nokey(), stdctp1();
|
---|
28 | extern short cxkstd(), cykstd(), stdmkey(), stddkey();
|
---|
29 |
|
---|
30 | extern short et_null(), ef_null(), rd_null(), nd_null();
|
---|
31 | extern short et_wavs(), ef_wavs(), rd_wavs(), nd_wavs();
|
---|
32 | extern short et_wvce(), ef_wvce(), rd_wvce(), nd_wvce();
|
---|
33 | extern short et_wslt(), ef_wslt(), rd_wslt(), nd_wslt();
|
---|
34 | extern short et_wpnt(), ef_wpnt(), rd_wpnt(), nd_wpnt();
|
---|
35 | extern short et_woff(), ef_woff(), rd_woff(), nd_woff();
|
---|
36 | extern short et_whar(), ef_whar(), rd_whar(), nd_whar();
|
---|
37 | extern short et_whrv(), ef_whrv(), rd_whrv(), nd_whrv();
|
---|
38 |
|
---|
39 | extern short vcputsv();
|
---|
40 |
|
---|
41 | extern char *memset();
|
---|
42 |
|
---|
43 | /* |
---|
44 |
|
---|
45 | */
|
---|
46 |
|
---|
47 | extern short astat;
|
---|
48 | extern short cmtype;
|
---|
49 | extern short curfunc;
|
---|
50 | extern short curinst;
|
---|
51 | extern short curslim;
|
---|
52 | extern short curvce;
|
---|
53 | extern short curwave;
|
---|
54 | extern short curwdth;
|
---|
55 | extern short curwfnl;
|
---|
56 | extern short curwhrm;
|
---|
57 | extern short curwhrv;
|
---|
58 | extern short curwoff;
|
---|
59 | extern short curwpnt;
|
---|
60 | extern short curwslt;
|
---|
61 | extern short cxrate;
|
---|
62 | extern short cxval;
|
---|
63 | extern short cyrate;
|
---|
64 | extern short cyval;
|
---|
65 | extern short hitbox;
|
---|
66 | extern short lstwoff;
|
---|
67 | extern short lstwpnt;
|
---|
68 | extern short stccol;
|
---|
69 | extern short stcrow;
|
---|
70 | extern short wdupdfl;
|
---|
71 | extern short wplast;
|
---|
72 | extern short wpntsv;
|
---|
73 | extern short wvlast;
|
---|
74 |
|
---|
75 | /* |
---|
76 |
|
---|
77 | */
|
---|
78 |
|
---|
79 | extern short crate1[];
|
---|
80 | extern short offsets[NUMWPCAL];
|
---|
81 | extern short vmtab[NUMHARM];
|
---|
82 | extern short wsbuf[NUMWPCAL];
|
---|
83 |
|
---|
84 | extern short wsnmod[12][2];
|
---|
85 |
|
---|
86 | extern unsigned *waveob;
|
---|
87 |
|
---|
88 | extern char bfs[];
|
---|
89 |
|
---|
90 | extern struct instdef vbufs[];
|
---|
91 |
|
---|
92 | extern struct selbox *csbp;
|
---|
93 | extern struct selbox wdboxes[];
|
---|
94 |
|
---|
95 | /* forward references */
|
---|
96 |
|
---|
97 | short wdxkey(), wdnfld(), wdcxupd(), wdcyupd(), wdykup(), wdykdn();
|
---|
98 |
|
---|
99 | /* |
---|
100 |
|
---|
101 | */
|
---|
102 |
|
---|
103 | #include "wdcurtb.h" /* short wdcurtb[]; short wdcurct[8][2]; */
|
---|
104 |
|
---|
105 | short wxrate = 1; /* WS interpolate X movement increment */
|
---|
106 |
|
---|
107 | struct fet wd_fet1[] = {
|
---|
108 |
|
---|
109 | {23, 10, 11, 0x0002, et_wavs, ef_wavs, rd_wavs, nd_wavs},
|
---|
110 | {23, 19, 20, 0x0102, et_wvce, ef_wvce, rd_wvce, nd_wvce},
|
---|
111 | {23, 34, 36, 0x0004, et_wpnt, ef_wpnt, rd_wpnt, nd_wpnt},
|
---|
112 | {23, 44, 48, 0x0104, et_woff, ef_woff, rd_woff, nd_woff},
|
---|
113 | {23, 61, 62, 0x0005, et_whar, ef_whar, rd_whar, nd_whar},
|
---|
114 |
|
---|
115 | {24, 20, 20, 0x0302, et_wslt, ef_wslt, rd_wslt, nd_wslt},
|
---|
116 | {24, 57, 60, 0x0105, et_whrv, ef_whrv, rd_whrv, nd_whrv},
|
---|
117 |
|
---|
118 | { 0, 0, 0, 0x0000, FN_NULL, FN_NULL, FN_NULL, FN_NULL}
|
---|
119 | };
|
---|
120 |
|
---|
121 | short wdbox[][8] = { /* display box parameters */
|
---|
122 |
|
---|
123 | { 1, 1, 510, 307, WCFBX00, WCBBX00, 0, 1}, /* 0 */
|
---|
124 | { 1, 309, 510, 320, WCFBX01, WCBBX01, 22, 0}, /* 1 */
|
---|
125 | { 1, 322, 174, 348, WCFBX02, WCBBX02, 23, 1}, /* 2 */
|
---|
126 | {176, 322, 230, 348, WCFBX03, WCBBX03, 23, 23}, /* 3 */
|
---|
127 | {232, 322, 398, 348, WCFBX04, WCBBX04, 23, 30}, /* 4 */
|
---|
128 | {400, 322, 510, 348, WCFBX05, WCBBX05, 23, 51} /* 5 */
|
---|
129 | };
|
---|
130 |
|
---|
131 | char *wdbxlb0[] = { /* display box labels -- row 0 */
|
---|
132 |
|
---|
133 | "", /* 0 */
|
---|
134 |
|
---|
135 | "\320\301 \320\303 \320\305 \320\307 \320\311 \
|
---|
136 | \321\301 \321\303 \321\305 \321\307 \321\311 \
|
---|
137 | \322\301 \322\303 \322\305 \322\307 \322\311 \323\301 ", /* 1 */
|
---|
138 |
|
---|
139 | "Waveshpe Voice", /* 2 */
|
---|
140 | "Store", /* 3 */
|
---|
141 | "Pnt Offst", /* 4 */
|
---|
142 | "Harmonic #" /* 5 */
|
---|
143 | };
|
---|
144 |
|
---|
145 | char *wdbxlb1[] = { /* display box labels -- row 1 */
|
---|
146 |
|
---|
147 | "", /* 0 */
|
---|
148 | "", /* 1 */
|
---|
149 | "Instrument Slot", /* 2 */
|
---|
150 | "Fetch", /* 3 */
|
---|
151 | " Final", /* 4 */
|
---|
152 | "Value" /* 5 */
|
---|
153 | };
|
---|
154 |
|
---|
155 | /* |
---|
156 |
|
---|
157 | */
|
---|
158 |
|
---|
159 | struct curpak wd_flds = {
|
---|
160 |
|
---|
161 | stdctp1, /* curtype */
|
---|
162 | nokey, /* premove */
|
---|
163 | nokey, /* pstmove */
|
---|
164 | cxkstd, /* cx_key */
|
---|
165 | cykstd, /* cy_key */
|
---|
166 | wdcxupd, /* cx_upd */
|
---|
167 | wdcyupd, /* cy_upd */
|
---|
168 | wdykup, /* xy_up */
|
---|
169 | wdykdn, /* xy_dn */
|
---|
170 | wdxkey, /* x_key */
|
---|
171 | select, /* e_key */
|
---|
172 | stdmkey, /* m_key */
|
---|
173 | stddkey, /* d_key */
|
---|
174 | wdnfld, /* not_fld */
|
---|
175 | wd_fet1, /* curfet */
|
---|
176 | wdboxes, /* csbp */
|
---|
177 | crate1, /* cratex */
|
---|
178 | crate1, /* cratey */
|
---|
179 | CT_GRAF, /* cmtype */
|
---|
180 | WCURX, /* cxval */
|
---|
181 | WCURY /* cyval */
|
---|
182 | };
|
---|
183 |
|
---|
184 | /* |
---|
185 |
|
---|
186 | */
|
---|
187 |
|
---|
188 | /*
|
---|
189 | =============================================================================
|
---|
190 | updfpu() -- update the FPU with a new waveshape
|
---|
191 | =============================================================================
|
---|
192 | */
|
---|
193 |
|
---|
194 | updfpu()
|
---|
195 | {
|
---|
196 | register short i;
|
---|
197 | register short *wsp1, *wsp2;
|
---|
198 |
|
---|
199 | /* calculate instrument source and FPU destination pointers */
|
---|
200 |
|
---|
201 | wsp1 = io_fpu + FPU_OWST + (curvce << 9) + (curwslt ? 0 : 0x0100) + 1;
|
---|
202 | wsp2 = curwslt ? vbufs[curvce].idhwvbf : vbufs[curvce].idhwvaf;
|
---|
203 |
|
---|
204 | memcpyw(wsp1, wsp2, NUMWPNT);
|
---|
205 |
|
---|
206 | /* make endpoints track */
|
---|
207 |
|
---|
208 | *(wsp1 - 1) = *(wsp2 - 1); /* lowest point */
|
---|
209 | *(wsp1 + NUMWPNT) = *(wsp2 + NUMWPNT - 1); /* highest point */
|
---|
210 |
|
---|
211 | #if DOUBLED
|
---|
212 |
|
---|
213 | /* do outputs again to get around hardware bug */
|
---|
214 |
|
---|
215 | memcpyw(wsp1, wsp2, NUMWPNT);
|
---|
216 |
|
---|
217 | *(wsp1 - 1) = *(wsp2 - 1); /* lowest point */
|
---|
218 | *(wsp1 + NUMWPNT) = *(wsp2 + NUMWPNT - 1); /* highest point */
|
---|
219 | #endif
|
---|
220 |
|
---|
221 | curwfnl = wsp2[curwpnt] >> 5; /* udpate final value */
|
---|
222 | }
|
---|
223 |
|
---|
224 | /* |
---|
225 |
|
---|
226 | */
|
---|
227 |
|
---|
228 | /*
|
---|
229 | =============================================================================
|
---|
230 | wsupd() -- update the instrument definition and FPU for new WS offsets
|
---|
231 | =============================================================================
|
---|
232 | */
|
---|
233 |
|
---|
234 | wsupd()
|
---|
235 | {
|
---|
236 | register short i;
|
---|
237 | register short *wsp1, *wsp2;
|
---|
238 |
|
---|
239 | /* update the offsets[] array from the instrument definition */
|
---|
240 |
|
---|
241 | wsp2 = curwslt ? vbufs[curvce].idhwvbo : vbufs[curvce].idhwvao;
|
---|
242 |
|
---|
243 | for (i = 0; i < NUMWPNT; i++)
|
---|
244 | offsets[i + 1] = wsp2[i] >> 5;
|
---|
245 |
|
---|
246 | offsets[0] = offsets[1];
|
---|
247 |
|
---|
248 | wscalc(); /* calculate the final values */
|
---|
249 |
|
---|
250 | /* update the final values in the instrument definition */
|
---|
251 |
|
---|
252 | wsp1 = curwslt ? vbufs[curvce].idhwvbf : vbufs[curvce].idhwvaf;
|
---|
253 |
|
---|
254 | for (i = 0; i < NUMWPNT; i++)
|
---|
255 | wsp1[i] = wsbuf[1 + i] << 5;
|
---|
256 |
|
---|
257 | updfpu();
|
---|
258 | wsnmod[curvce][curwslt] = TRUE; /* tag WS as modified */
|
---|
259 | }
|
---|
260 |
|
---|
261 | /*
|
---|
262 | =============================================================================
|
---|
263 | whupd() -- update the FPU for new WS harmonics
|
---|
264 | =============================================================================
|
---|
265 | */
|
---|
266 |
|
---|
267 | whupd()
|
---|
268 | {
|
---|
269 | register short i;
|
---|
270 | register short *wsp1;
|
---|
271 |
|
---|
272 | /* update the final values in the instrument definition */
|
---|
273 |
|
---|
274 | wsp1 = curwslt ? vbufs[curvce].idhwvbf : vbufs[curvce].idhwvaf;
|
---|
275 |
|
---|
276 | for (i = 0; i < NUMWPNT; i++)
|
---|
277 | wsp1[i] = wsbuf[i + 1] << 5;
|
---|
278 |
|
---|
279 | updfpu(); /* update the FPU */
|
---|
280 | wsnmod[curvce][curwslt] = TRUE; /* tag WS as modified */
|
---|
281 | }
|
---|
282 |
|
---|
283 | /* |
---|
284 |
|
---|
285 | */
|
---|
286 |
|
---|
287 | /*
|
---|
288 | =============================================================================
|
---|
289 | pntsup() -- update waveshape points with the cursor 'brush'
|
---|
290 | =============================================================================
|
---|
291 | */
|
---|
292 |
|
---|
293 | pntsup()
|
---|
294 | {
|
---|
295 | register struct instdef *ip;
|
---|
296 | short *ov;
|
---|
297 | register short i, j, k, tv, curdif;
|
---|
298 | short cwnp, cwin;
|
---|
299 |
|
---|
300 | ip = &vbufs[curvce]; /* instrument definition */
|
---|
301 |
|
---|
302 | ov = curwslt ? &ip->idhwvbo /* offsets in definition */
|
---|
303 | : &ip->idhwvao;
|
---|
304 |
|
---|
305 | cwnp = wdcurct[curwdth][0]; /* number of points effected */
|
---|
306 |
|
---|
307 | cwin = wdcurct[curwdth][1]; /* table increment */
|
---|
308 |
|
---|
309 | curdif = lstwoff - curwoff; /* calculate the difference */
|
---|
310 |
|
---|
311 | /* |
---|
312 |
|
---|
313 | */
|
---|
314 | for (i = 0 , k = 0; i < cwnp; i++ , k += cwin) {
|
---|
315 |
|
---|
316 | if (i EQ 0) { /* first point */
|
---|
317 |
|
---|
318 | ov[curwpnt] = curwoff << 5;
|
---|
319 |
|
---|
320 | } else { /* subsequent points */
|
---|
321 |
|
---|
322 | j = curwpnt + i; /* update point on the right */
|
---|
323 |
|
---|
324 | if (j < NUMWPNT) { /* ... if it exists */
|
---|
325 |
|
---|
326 | tv = (ov[j] >> 5) -
|
---|
327 | ((((long)curdif * wdcurtb[k])
|
---|
328 | + WCROUND) / WCSCALE);
|
---|
329 |
|
---|
330 | if (tv GT 1023)
|
---|
331 | tv = 1023;
|
---|
332 | else if (tv LT -1023)
|
---|
333 | tv = -1023;
|
---|
334 |
|
---|
335 | ov[j] = tv << 5;
|
---|
336 | }
|
---|
337 |
|
---|
338 | j = curwpnt - i; /* update point on the left */
|
---|
339 |
|
---|
340 | if (j GE 0) { /* ... if it exists */
|
---|
341 |
|
---|
342 | tv = (ov[j] >> 5) -
|
---|
343 | ((((long)curdif * wdcurtb[k])
|
---|
344 | + WCROUND) / WCSCALE);
|
---|
345 |
|
---|
346 | if (tv GT 1023)
|
---|
347 | tv = 1023;
|
---|
348 | else if (tv LT -1023)
|
---|
349 | tv = -1023;
|
---|
350 |
|
---|
351 | ov[j] = tv << 5;
|
---|
352 | }
|
---|
353 | }
|
---|
354 | }
|
---|
355 |
|
---|
356 | wsupd();
|
---|
357 | }
|
---|
358 |
|
---|
359 | /* |
---|
360 |
|
---|
361 | */
|
---|
362 |
|
---|
363 | /*
|
---|
364 | =============================================================================
|
---|
365 | wdintp() -- interpolate between waveshape points
|
---|
366 | =============================================================================
|
---|
367 | */
|
---|
368 |
|
---|
369 | wdintp()
|
---|
370 | {
|
---|
371 | register struct instdef *ip;
|
---|
372 | register short *ov;
|
---|
373 | register short i, j, k, n;
|
---|
374 | register long t;
|
---|
375 | short to, from;
|
---|
376 |
|
---|
377 | to = curwpnt;
|
---|
378 | from = wplast;
|
---|
379 |
|
---|
380 | ip = &vbufs[curvce];
|
---|
381 | ov = curwslt ? &ip->idhwvbo : &ip->idhwvao;
|
---|
382 |
|
---|
383 | ov[curwpnt] = curwoff << 5; /* force current point value */
|
---|
384 |
|
---|
385 | if (from > to) { /* make 'from' the leftmost point number */
|
---|
386 |
|
---|
387 | i = from;
|
---|
388 | from = to;
|
---|
389 | to = i;
|
---|
390 | }
|
---|
391 |
|
---|
392 | n = to - from; /* number of points */
|
---|
393 |
|
---|
394 | if (n > 1) { /* have to have at least 1 point difference */
|
---|
395 |
|
---|
396 | k = ov[from] >> 5;
|
---|
397 | t = ((long)((long)(ov[to] >> 5) - (long)k) << 16) / n;
|
---|
398 | j = 1 + from;
|
---|
399 | --n;
|
---|
400 |
|
---|
401 | for (i = 0; i < n; i++)
|
---|
402 | ov[j++] = ((short)((t * (1 + i)) >> 16) + k) << 5;
|
---|
403 | }
|
---|
404 |
|
---|
405 | wplast = curwpnt;
|
---|
406 | wvlast = curwoff;
|
---|
407 |
|
---|
408 | wsupd();
|
---|
409 | }
|
---|
410 |
|
---|
411 | /* |
---|
412 |
|
---|
413 | */
|
---|
414 |
|
---|
415 | /*
|
---|
416 | =============================================================================
|
---|
417 | wdykdn() -- cursor y finger down processing
|
---|
418 | =============================================================================
|
---|
419 | */
|
---|
420 |
|
---|
421 | wdykdn()
|
---|
422 | {
|
---|
423 | if (wpntsv EQ 0)
|
---|
424 | return;
|
---|
425 |
|
---|
426 | lstwpnt = curwpnt;
|
---|
427 | lstwoff = curwoff;
|
---|
428 | }
|
---|
429 |
|
---|
430 | /*
|
---|
431 | =============================================================================
|
---|
432 | wdykup() -- cursor y finger up processing
|
---|
433 | =============================================================================
|
---|
434 | */
|
---|
435 |
|
---|
436 | wdykup()
|
---|
437 | {
|
---|
438 | if ((wpntsv EQ 0) OR (wdupdfl EQ FALSE))
|
---|
439 | return;
|
---|
440 |
|
---|
441 | if (wpntsv EQ 1) { /* offsets */
|
---|
442 |
|
---|
443 | if (curwdth EQ NUMWIDS)
|
---|
444 | wdintp(); /* interpolate mode */
|
---|
445 | else
|
---|
446 | pntsup(); /* brush mode */
|
---|
447 |
|
---|
448 | } else { /* harmonics */
|
---|
449 |
|
---|
450 | adj(curwhrm); /* adjust vknm[curwhrm][] */
|
---|
451 | wscalc(); /* recalculate the waveshape */
|
---|
452 | whupd(); /* update the FPU */
|
---|
453 | }
|
---|
454 |
|
---|
455 | wdswin(0); /* display updated waveshape */
|
---|
456 | wdswin(2);
|
---|
457 | wdswin(4);
|
---|
458 |
|
---|
459 | wdupdfl = FALSE;
|
---|
460 | }
|
---|
461 |
|
---|
462 | /* |
---|
463 |
|
---|
464 | */
|
---|
465 |
|
---|
466 | /*
|
---|
467 | =============================================================================
|
---|
468 | wdcyupd() -- update cursor y location
|
---|
469 | =============================================================================
|
---|
470 | */
|
---|
471 |
|
---|
472 | wdcyupd()
|
---|
473 | {
|
---|
474 | register struct instdef *ip;
|
---|
475 | register short *ov, *hv;
|
---|
476 | register short i, j, k, tv;
|
---|
477 | register char wsgn;
|
---|
478 | short wval, cwnp, cwin;
|
---|
479 |
|
---|
480 | ip = &vbufs[curvce];
|
---|
481 |
|
---|
482 | switch (wpntsv) {
|
---|
483 |
|
---|
484 | case 0: /* nothing selected -- just move cursor */
|
---|
485 |
|
---|
486 | cyval += cyrate;
|
---|
487 |
|
---|
488 | if (cyval GT (CYMAX - 1))
|
---|
489 | cyval = CYMAX - 1;
|
---|
490 | else if (cyval LT 1)
|
---|
491 | cyval = 1;
|
---|
492 |
|
---|
493 | return;
|
---|
494 | /* |
---|
495 |
|
---|
496 | */
|
---|
497 | case 1: /* offset selected */
|
---|
498 |
|
---|
499 | curwoff -= cyrate;
|
---|
500 |
|
---|
501 | if (curwoff GT 1023)
|
---|
502 | curwoff = 1023;
|
---|
503 | else if (curwoff LT -1023)
|
---|
504 | curwoff = -1023;
|
---|
505 |
|
---|
506 | cyval = WPOFF - ((curwoff * WPSF1) / WPSF2);
|
---|
507 |
|
---|
508 | if (curwoff < 0) {
|
---|
509 |
|
---|
510 | wval = - curwoff;
|
---|
511 | wsgn = '-';
|
---|
512 |
|
---|
513 | } else {
|
---|
514 |
|
---|
515 | wval = curwoff;
|
---|
516 | wsgn = '+';
|
---|
517 | }
|
---|
518 |
|
---|
519 | sprintf(bfs, "%c%04d", wsgn, wval);
|
---|
520 |
|
---|
521 | if (v_regs[5] & 0x0180)
|
---|
522 | vbank(0);
|
---|
523 |
|
---|
524 | vcputsv(waveob, 64, wdbox[4][4], wdbox[4][5], wdbox[4][6],
|
---|
525 | wdbox[4][7] + WOFF_OFF, bfs, 14);
|
---|
526 |
|
---|
527 | wdupdfl = TRUE;
|
---|
528 | return;
|
---|
529 | /* |
---|
530 |
|
---|
531 | */
|
---|
532 | case 2: /* harmonic selected */
|
---|
533 |
|
---|
534 | hv = curwslt ? &ip->idhwvbh : &ip->idhwvah;
|
---|
535 |
|
---|
536 | curwhrv = abs(hv[curwhrm]) - cyrate;
|
---|
537 |
|
---|
538 | if (curwhrv > 100)
|
---|
539 | curwhrv = 100;
|
---|
540 | else if (curwhrv < 0)
|
---|
541 | curwhrv = 0;
|
---|
542 |
|
---|
543 | curwhrv = (hv[curwhrm] < 0) ? -curwhrv : curwhrv;
|
---|
544 |
|
---|
545 | hv[curwhrm] = curwhrv;
|
---|
546 | vmtab[curwhrm] = curwhrv;
|
---|
547 |
|
---|
548 | if (curwhrv < 0) {
|
---|
549 |
|
---|
550 | wval = -curwhrv;
|
---|
551 | wsgn = '-';
|
---|
552 |
|
---|
553 | } else {
|
---|
554 |
|
---|
555 | wval = curwhrv;
|
---|
556 | wsgn = '+';
|
---|
557 | }
|
---|
558 |
|
---|
559 | if (v_regs[5] & 0x0180)
|
---|
560 | vbank(0);
|
---|
561 |
|
---|
562 | sprintf(bfs, "%c%03d", wsgn, wval);
|
---|
563 |
|
---|
564 | vcputsv(waveob, 64, wdbox[5][4], wdbox[5][5],
|
---|
565 | wdbox[5][6] + 1, wdbox[5][7] + WHRV_OFF, bfs, 14);
|
---|
566 |
|
---|
567 | if (curwhrv < 0)
|
---|
568 | cyval = WBOFF - ((-curwhrv * WBSF1) / WBSF2);
|
---|
569 | else
|
---|
570 | cyval = WBOFF - ((curwhrv * WBSF1) / WBSF2);
|
---|
571 |
|
---|
572 | wdupdfl = TRUE;
|
---|
573 | return;
|
---|
574 | }
|
---|
575 | }
|
---|
576 |
|
---|
577 | /* |
---|
578 |
|
---|
579 | */
|
---|
580 |
|
---|
581 | /*
|
---|
582 | =============================================================================
|
---|
583 | wdcxupd() -- update cursor x location
|
---|
584 | =============================================================================
|
---|
585 | */
|
---|
586 |
|
---|
587 | wdcxupd()
|
---|
588 | {
|
---|
589 | switch (wpntsv) {
|
---|
590 |
|
---|
591 | case 0: /* nothing selected - just move cursor */
|
---|
592 |
|
---|
593 | cxval += cxrate;
|
---|
594 |
|
---|
595 | if (cxval GT (CXMAX - 1))
|
---|
596 | cxval = CXMAX - 1;
|
---|
597 | else if (cxval LT 1)
|
---|
598 | cxval = 1;
|
---|
599 |
|
---|
600 | return;
|
---|
601 |
|
---|
602 | case 1: /* offset selected - maybe do interpolate move */
|
---|
603 |
|
---|
604 | if (curwdth NE NUMWIDS)
|
---|
605 | return;
|
---|
606 |
|
---|
607 | curwpnt += sign(cxrate, wxrate);
|
---|
608 |
|
---|
609 | if (curwpnt GE NUMWPNT)
|
---|
610 | curwpnt = NUMWPNT - 1;
|
---|
611 | else if (curwpnt < 0)
|
---|
612 | curwpnt = 0;
|
---|
613 |
|
---|
614 | cxval = (curwpnt << 1) + 2;
|
---|
615 |
|
---|
616 | if (v_regs[5] & 0x0180)
|
---|
617 | vbank(0);
|
---|
618 |
|
---|
619 | sprintf(bfs, "%03d", curwpnt);
|
---|
620 | vcputsv(waveob, 64, wdbox[4][4], wdbox[4][5],
|
---|
621 | wdbox[4][6], wdbox[4][7] + WPNT_OFF, bfs, 14);
|
---|
622 | }
|
---|
623 | }
|
---|
624 |
|
---|
625 | /* |
---|
626 |
|
---|
627 | */
|
---|
628 |
|
---|
629 | /*
|
---|
630 | =============================================================================
|
---|
631 | wdnfld() -- process not-in-field key entry
|
---|
632 | =============================================================================
|
---|
633 | */
|
---|
634 |
|
---|
635 | short
|
---|
636 | wdnfld(k)
|
---|
637 | short k;
|
---|
638 | {
|
---|
639 | register short *hv;
|
---|
640 | register struct instdef *ip;
|
---|
641 |
|
---|
642 | if (astat) {
|
---|
643 |
|
---|
644 | if (whatbox()) {
|
---|
645 |
|
---|
646 | ip = &vbufs[curvce];
|
---|
647 | hv = curwslt ? &ip->idhwvbh : &ip->idhwvah;
|
---|
648 |
|
---|
649 | if (hitbox EQ 0) { /* waveshape area */
|
---|
650 |
|
---|
651 | switch (wpntsv) {
|
---|
652 |
|
---|
653 | case 0: /* nothing selected */
|
---|
654 |
|
---|
655 | if (k EQ 8) { /* - */
|
---|
656 |
|
---|
657 | if (--curwdth < 0)
|
---|
658 | curwdth = NUMWIDS;
|
---|
659 |
|
---|
660 | wdswin(4);
|
---|
661 | return(SUCCESS);
|
---|
662 |
|
---|
663 | } else if (k EQ 9) { /* + */
|
---|
664 |
|
---|
665 | if (++curwdth > NUMWIDS)
|
---|
666 | curwdth = 0;
|
---|
667 |
|
---|
668 | wdswin(4);
|
---|
669 | return(SUCCESS);
|
---|
670 | }
|
---|
671 |
|
---|
672 | return(FAILURE);
|
---|
673 | /* |
---|
674 |
|
---|
675 | */
|
---|
676 | case 1: /* offset selected */
|
---|
677 |
|
---|
678 | if (k EQ 8) { /* - */
|
---|
679 |
|
---|
680 | if (curwdth EQ NUMWIDS)
|
---|
681 | return(FAILURE);
|
---|
682 |
|
---|
683 | if (--curwdth LT 0)
|
---|
684 | curwdth = NUMWIDS - 1;
|
---|
685 |
|
---|
686 | wdswin(4);
|
---|
687 | return(SUCCESS);
|
---|
688 |
|
---|
689 | } else if (k EQ 9) { /* + */
|
---|
690 |
|
---|
691 | if (curwdth EQ NUMWIDS) {
|
---|
692 |
|
---|
693 | wdintp();
|
---|
694 | wdswin(0);
|
---|
695 | wdswin(2);
|
---|
696 |
|
---|
697 | } else if (++curwdth GE NUMWIDS)
|
---|
698 | curwdth = 0;
|
---|
699 |
|
---|
700 | wdswin(4);
|
---|
701 | return(SUCCESS);
|
---|
702 | }
|
---|
703 |
|
---|
704 | return(FAILURE);
|
---|
705 | /* |
---|
706 |
|
---|
707 | */
|
---|
708 | case 2: /* harmonic selected */
|
---|
709 |
|
---|
710 | if (k EQ 8) { /* - */
|
---|
711 |
|
---|
712 | if (hv[curwhrm] > 0)
|
---|
713 | hv[curwhrm] = -hv[curwhrm];
|
---|
714 | else
|
---|
715 | return(FAILURE);
|
---|
716 |
|
---|
717 | } else if (k EQ 9) { /* + */
|
---|
718 |
|
---|
719 | if (hv[curwhrm] < 0)
|
---|
720 | hv[curwhrm] = -hv[curwhrm];
|
---|
721 | else
|
---|
722 | return(FAILURE);
|
---|
723 |
|
---|
724 | } else {
|
---|
725 |
|
---|
726 | return(FAILURE);
|
---|
727 | }
|
---|
728 |
|
---|
729 | curwhrv = hv[curwhrm];
|
---|
730 | vmtab[curwhrm] = curwhrv;
|
---|
731 | adj(curwhrm);
|
---|
732 | wscalc();
|
---|
733 | whupd();
|
---|
734 | wdswin(0);
|
---|
735 | wdswin(4);
|
---|
736 | wdswin(5);
|
---|
737 | return(SUCCESS);
|
---|
738 | }
|
---|
739 |
|
---|
740 | } else
|
---|
741 | return(FAILURE);
|
---|
742 | /* |
---|
743 |
|
---|
744 | */
|
---|
745 | } else if (hitbox EQ 1) { /* harmonic legend */
|
---|
746 |
|
---|
747 | if (k EQ 8) { /* - */
|
---|
748 |
|
---|
749 | if (hv[curwhrm] > 0)
|
---|
750 | hv[curwhrm] = -hv[curwhrm];
|
---|
751 | else
|
---|
752 | return(FAILURE);
|
---|
753 |
|
---|
754 | } else if (k EQ 9) { /* + */
|
---|
755 |
|
---|
756 | if (hv[curwhrm] < 0)
|
---|
757 | hv[curwhrm] = -hv[curwhrm];
|
---|
758 | else
|
---|
759 | return(FAILURE);
|
---|
760 |
|
---|
761 | } else {
|
---|
762 |
|
---|
763 | return(FAILURE);
|
---|
764 | }
|
---|
765 |
|
---|
766 | curwhrv = hv[curwhrm];
|
---|
767 | vmtab[curwhrm] = curwhrv;
|
---|
768 | adj(curwhrm);
|
---|
769 | wscalc();
|
---|
770 | whupd();
|
---|
771 | wdswin(0);
|
---|
772 | wdswin(4);
|
---|
773 | wdswin(5);
|
---|
774 | return(SUCCESS);
|
---|
775 | }
|
---|
776 |
|
---|
777 | return(FAILURE);
|
---|
778 | }
|
---|
779 | }
|
---|
780 |
|
---|
781 | /* |
---|
782 |
|
---|
783 | */
|
---|
784 |
|
---|
785 | /*
|
---|
786 | =============================================================================
|
---|
787 | wdxkey() -- process X key
|
---|
788 | =============================================================================
|
---|
789 | */
|
---|
790 |
|
---|
791 | short
|
---|
792 | wdxkey()
|
---|
793 | {
|
---|
794 | if (NOT astat)
|
---|
795 | return(FAILURE);
|
---|
796 |
|
---|
797 | stcrow = cyval / 14;
|
---|
798 | stccol = cxval >> 3;
|
---|
799 |
|
---|
800 | if (stcrow EQ 23) {
|
---|
801 |
|
---|
802 | if ((stccol GE 2) OR (stccol LE 8)) {
|
---|
803 |
|
---|
804 | clrws();
|
---|
805 |
|
---|
806 | } else if ((stccol GE 38) AND (stccol LE 42)) {
|
---|
807 |
|
---|
808 | memsetw(curwslt ? vbufs[curvce].idhwvbo
|
---|
809 | : vbufs[curvce].idhwvbo,
|
---|
810 | 0, NUMWPNT);
|
---|
811 |
|
---|
812 | curwoff = 0;
|
---|
813 | wsupd();
|
---|
814 |
|
---|
815 | } else if ((stccol GE 51) AND (stccol LE 58)) {
|
---|
816 |
|
---|
817 | memsetw(vmtab, 0, NUMHARM);
|
---|
818 | curwhrv = 0;
|
---|
819 | wadj();
|
---|
820 | wscalc();
|
---|
821 | whupd();
|
---|
822 |
|
---|
823 | } else {
|
---|
824 |
|
---|
825 | return(FAILURE);
|
---|
826 | }
|
---|
827 |
|
---|
828 | wsnmod[curvce][curwslt] = TRUE;
|
---|
829 | wwins();
|
---|
830 | return(SUCCESS);
|
---|
831 | }
|
---|
832 |
|
---|
833 | return(FAILURE);
|
---|
834 | }
|
---|
835 |
|
---|
836 | /* |
---|
837 |
|
---|
838 | */
|
---|
839 |
|
---|
840 | /*
|
---|
841 | =============================================================================
|
---|
842 | wdfield() -- setup field routines for the waveshape editor
|
---|
843 | =============================================================================
|
---|
844 | */
|
---|
845 |
|
---|
846 | wdfield()
|
---|
847 | {
|
---|
848 | curslim = 307;
|
---|
849 |
|
---|
850 | curset(&wd_flds);
|
---|
851 | }
|
---|