source: buchla-68k/ram/wdselbx.c@ 081eee0

Last change on this file since 081eee0 was 7ecfb7b, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Unused variables and parameters.

  • Property mode set to 100644
File size: 4.0 KB
Line 
1/*
2 =============================================================================
3 wdselbx.c -- waveshape editor box selection functions
4 Version 27 -- 1988-09-15 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define DEBUGIT 0
9
10#include "ram.h"
11
12struct selbox wdboxes[] = {
13
14 { 1, 1, 510, 307, 0, wdfnbox}, /* 0 */
15 { 1, 308, 510, 320, 1, wdfnbox}, /* 1 */
16 { 1, 322, 174, 348, 2, entbh}, /* 2 */
17 {176, 322, 230, 348, 3, wdfnbox}, /* 3 */
18 {232, 322, 398, 348, 4, entbh}, /* 4 */
19 {400, 322, 510, 348, 5, entbh}, /* 5 */
20
21 { 0, 0, 0, 0, 0, FN_NULL} /* end of table */
22};
23
24/*
25 =============================================================================
26 dsnewws() -- display a new waveshape
27 =============================================================================
28*/
29
30void dsnewws(void)
31{
32 wdswin(0);
33 wdswin(2);
34 wdswin(4);
35 wdswin(5);
36}
37
38/*
39 =============================================================================
40 newws() -- setup editing for a new waveshape
41 =============================================================================
42*/
43
44void newws(void)
45{
46 register int16_t i;
47 register struct instdef *ip;
48
49 ip = &vbufs[curvce];
50
51 if (curwslt) {
52
53 for (i = 0; i < NUMWPNT; i++) {
54
55 offsets[i + 1] = ip->idhwvbo[i] >> 5;
56 wsbuf[i + 1] = ip->idhwvbf[i] >> 5;
57 }
58
59 memcpyw(vmtab, ip->idhwvbh, NUMHARM);
60
61 } else {
62
63 for (i = 0; i < NUMWPNT; i++) {
64
65 offsets[i + 1] = ip->idhwvao[i] >> 5;
66 wsbuf[i + 1] = ip->idhwvaf[i] >> 5;
67 }
68
69 memcpyw(vmtab, ip->idhwvah, NUMHARM);
70 }
71
72 offsets[0] = offsets[1];
73 wsbuf[0] = wsbuf[1];
74
75 curwhrv = vmtab[curwhrm];
76 lstwoff = wvlast = curwoff = offsets[1 + curwpnt];
77 curwfnl = wsbuf[curwpnt + 1];
78 lstwpnt = wplast = curwpnt;
79
80 memsetw(vknm, 0, (NUMHARM * NUMWPCAL) << 1);
81 wadj();
82}
83
84/*
85 =============================================================================
86 wdfnbox() -- waveshape display box hit processor
87 =============================================================================
88*/
89
90int16_t wdfnbox(int16_t n)
91{
92 switch (n) { /* switch off of window ID */
93
94 case 0: /* process a hit in the main window */
95
96 switch (wpntsv) {
97
98 case 0: /* nothing selected so far: select a point */
99
100 wpntsv = 1;
101 curwpnt = (cxval - 2) / 2;
102
103 if (curwpnt GE NUMWPNT)
104 curwpnt = NUMWPNT - 1;
105 else if (curwpnt < 0)
106 curwpnt = 0;
107
108 cratex = crate2;
109 cratey = crate2;
110 newws();
111 cyval = WPOFF - ((curwoff * WPSF1) / WPSF2);
112 cxval = (curwpnt << 1) + 2;
113 arcurs(WS_GRAB);
114 gcurpos(cxval, cyval);
115 wplast = curwpnt;
116 wvlast = curwoff;
117 wdswin(4);
118 break;
119
120 case 1: /* point was selected: unselect it */
121
122 wpntsv = 0;
123 cratex = crate1;
124 cratey = crate1;
125
126 arcurs(WDCURS);
127 gcurpos(cxval, cyval);
128 break;
129
130 case 2: /* harmonic was selected: unselect it */
131
132 wpntsv = 0;
133 cratex = crate1;
134 cratey = crate1;
135
136 arcurs(WDCURS);
137 settc(22, 1 + (curwhrm << 1));
138 break;
139 }
140
141 return(TRUE);
142
143 case 1: /* process a hit in the harmonic legend */
144
145 wpntsv = 2;
146 cratex = crate1;
147 cratey = crate1;
148
149 curwhrm = cxval >> 4;
150 curwhrv = vmtab[curwhrm];
151
152 cxval = (curwhrm << 4) + 8;
153
154 if (curwhrv < 0) {
155
156 cyval = WBOFF - ((-curwhrv * WBSF1) / WBSF2);
157
158 } else {
159
160 cyval = WBOFF - ((curwhrv * WBSF1) / WBSF2);
161 }
162
163 arcurs(WS_GRAB);
164 gcurpos(cxval, cyval);
165 wdswin(5);
166 return(TRUE);
167
168 case 3: /* process a hit in the store & fetch window */
169
170 wsnmod[curvce][curwslt] = FALSE;
171
172 if (cyval < 336) { /* store ? */
173
174 memcpyw(&wslib[curwave],
175 curwslt ? vbufs[curvce].idhwvbf
176 : vbufs[curvce].idhwvaf,
177 NUMHARM + (2 * NUMWPNT));
178
179 wdswin(2);
180
181 } else { /* retrieve */
182
183 memcpyw(curwslt ? vbufs[curvce].idhwvbf
184 : vbufs[curvce].idhwvaf,
185 &wslib[curwave],
186 NUMHARM + (2 * NUMWPNT));
187
188 updfpu();
189 newws();
190 dsnewws();
191 }
192
193 cratex = crate1;
194 cratey = crate1;
195 return(TRUE);
196
197 default: /* anywhere else is an error */
198
199 cratex = crate1;
200 cratey = crate1;
201 return(FALSE);
202 }
203}
204
Note: See TracBrowser for help on using the repository browser.