1 | /*
|
---|
2 | =============================================================================
|
---|
3 | etwvce.c -- waveshape editor - voice field handlers
|
---|
4 | Version 8 -- 1987-12-11 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stddefs.h"
|
---|
9 | #include "fields.h"
|
---|
10 | #include "vsdd.h"
|
---|
11 | #include "vsddsw.h"
|
---|
12 | #include "graphdef.h"
|
---|
13 |
|
---|
14 | #include "midas.h"
|
---|
15 | #include "wsdsp.h"
|
---|
16 |
|
---|
17 | #include "stdio.h"
|
---|
18 |
|
---|
19 | extern void advwcur(void);
|
---|
20 |
|
---|
21 | extern void newvce(int16_t voice);
|
---|
22 | extern void wwins(void);
|
---|
23 |
|
---|
24 | extern uint16_t *waveob;
|
---|
25 |
|
---|
26 | extern int16_t stcrow, stccol, curvce;
|
---|
27 |
|
---|
28 | extern int16_t wdbox[][8];
|
---|
29 |
|
---|
30 | extern int8_t dspbuf[];
|
---|
31 |
|
---|
32 | /* |
---|
33 |
|
---|
34 | */
|
---|
35 |
|
---|
36 | /*
|
---|
37 | =============================================================================
|
---|
38 | et_wvce() -- load the edit buffer
|
---|
39 | =============================================================================
|
---|
40 | */
|
---|
41 |
|
---|
42 | int16_t et_wvce(int16_t n)
|
---|
43 | {
|
---|
44 | sprintf(ebuf, "%02d", curvce + 1);
|
---|
45 | ebflag = TRUE;
|
---|
46 |
|
---|
47 | return(SUCCESS);
|
---|
48 | }
|
---|
49 |
|
---|
50 | /*
|
---|
51 | =============================================================================
|
---|
52 | ef_wvce() -- parse (unload) the edit buffer
|
---|
53 | =============================================================================
|
---|
54 | */
|
---|
55 |
|
---|
56 | int16_t ef_wvce(int16_t n)
|
---|
57 | {
|
---|
58 | register int16_t i, tmpval;
|
---|
59 |
|
---|
60 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
61 | ebflag = FALSE;
|
---|
62 | tmpval = 0;
|
---|
63 |
|
---|
64 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
---|
65 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
66 |
|
---|
67 | if ((tmpval EQ 0) OR (tmpval GT 12))
|
---|
68 | return(FAILURE);
|
---|
69 |
|
---|
70 | newvce(tmpval - 1);
|
---|
71 | wwins();
|
---|
72 | return(SUCCESS);
|
---|
73 | }
|
---|
74 |
|
---|
75 | /* |
---|
76 |
|
---|
77 | */
|
---|
78 |
|
---|
79 | /*
|
---|
80 | =============================================================================
|
---|
81 | rd_wvce() -- (re)display the field
|
---|
82 | =============================================================================
|
---|
83 | */
|
---|
84 |
|
---|
85 | int16_t rd_wvce(int16_t nn)
|
---|
86 | {
|
---|
87 | register int16_t n;
|
---|
88 |
|
---|
89 | n = nn & 0xFF;
|
---|
90 | sprintf(dspbuf, "%02d", curvce + 1);
|
---|
91 |
|
---|
92 | vbank(0);
|
---|
93 | vcputsv(waveob, 64, wdbox[n][4], wdbox[n][5],
|
---|
94 | wdbox[n][6], wdbox[n][7] + WVCE_OFF, dspbuf, 14);
|
---|
95 |
|
---|
96 | return(SUCCESS);
|
---|
97 | }
|
---|
98 |
|
---|
99 | /*
|
---|
100 | =============================================================================
|
---|
101 | nd_wvce() -- handle new data entry
|
---|
102 | =============================================================================
|
---|
103 | */
|
---|
104 |
|
---|
105 | int16_t nd_wvce(int16_t nn, int16_t k)
|
---|
106 | {
|
---|
107 | register int16_t ec, n;
|
---|
108 |
|
---|
109 | n = nn & 0xFF;
|
---|
110 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
111 | ebuf[ec] = k + '0';
|
---|
112 | ebuf[2] = '\0';
|
---|
113 |
|
---|
114 | dspbuf[0] = k + '0';
|
---|
115 | dspbuf[1] = '\0';
|
---|
116 |
|
---|
117 | vbank(0);
|
---|
118 | vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
|
---|
119 | stcrow, stccol, dspbuf, 14);
|
---|
120 |
|
---|
121 | advwcur();
|
---|
122 | return(SUCCESS);
|
---|
123 | }
|
---|