source: buchla-68k/orig/RAM/WDSELBX.C@ ee49131

Last change on this file since ee49131 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

  • Property mode set to 100755
File size: 5.1 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 "stddefs.h"
11#include "fields.h"
12#include "vsdd.h"
13#include "graphdef.h"
14#include "hwdefs.h"
15#include "fpu.h"
16
17#include "midas.h"
18#include "instdsp.h"
19#include "wsdsp.h"
20
21extern short enterit(), wdswin();
22
23extern short curvce, curwdth, cursbox, hitbox, cxval, cyval, hitcx, hitcy;
24extern short curwave, curwfnl, curwpnt, curwoff, curwhrm, curwhrv, curwslt;
25extern short wdupdfl, wpntsv, wplast, wvlast, lstwoff, lstwpnt;
26
27extern short offsets[NUMWPCAL];
28extern short vmtab[NUMHARM];
29extern short wsbuf[NUMWPCAL];
30
31extern long vknm[NUMHARM][NUMWPCAL];
32
33extern short wdbox[][8];
34
35extern short wsnmod[12][2];
36
37extern short crate1[], crate2[], *cratex, *cratey;
38
39extern struct selbox *csbp, *curboxp;
40
41extern struct instdef vbufs[];
42
43extern struct wstbl wslib[];
44
45/* forward references */
46
47short bx_null(), wdfnbox();
48
49/*
50
51*/
52
53struct selbox wdboxes[] = {
54
55 { 1, 1, 510, 307, 0, wdfnbox}, /* 0 */
56 { 1, 308, 510, 320, 1, wdfnbox}, /* 1 */
57 { 1, 322, 174, 348, 2, enterit}, /* 2 */
58 {176, 322, 230, 348, 3, wdfnbox}, /* 3 */
59 {232, 322, 398, 348, 4, enterit}, /* 4 */
60 {400, 322, 510, 348, 5, enterit}, /* 5 */
61
62 { 0, 0, 0, 0, 0, FN_NULL} /* end of table */
63};
64
65/*
66 =============================================================================
67 dsnewws() -- display a new waveshape
68 =============================================================================
69*/
70
71dsnewws()
72{
73 wdswin(0);
74 wdswin(2);
75 wdswin(4);
76 wdswin(5);
77}
78
79/*
80
81*/
82
83/*
84 =============================================================================
85 newws() -- setup editing for a new waveshape
86 =============================================================================
87*/
88
89newws()
90{
91 register short i;
92 register struct instdef *ip;
93
94 ip = &vbufs[curvce];
95
96 if (curwslt) {
97
98 for (i = 0; i < NUMWPNT; i++) {
99
100 offsets[i + 1] = ip->idhwvbo[i] >> 5;
101 wsbuf[i + 1] = ip->idhwvbf[i] >> 5;
102 }
103
104 memcpyw(vmtab, ip->idhwvbh, NUMHARM);
105
106 } else {
107
108 for (i = 0; i < NUMWPNT; i++) {
109
110 offsets[i + 1] = ip->idhwvao[i] >> 5;
111 wsbuf[i + 1] = ip->idhwvaf[i] >> 5;
112 }
113
114 memcpyw(vmtab, ip->idhwvah, NUMHARM);
115 }
116
117 offsets[0] = offsets[1];
118 wsbuf[0] = wsbuf[1];
119
120 curwhrv = vmtab[curwhrm];
121 lstwoff = wvlast = curwoff = offsets[1 + curwpnt];
122 curwfnl = wsbuf[curwpnt + 1];
123 lstwpnt = wplast = curwpnt;
124
125 memsetw(vknm, 0, (NUMHARM * NUMWPCAL) << 1);
126 wadj();
127}
128
129/*
130
131*/
132
133/*
134 =============================================================================
135 wdfnbox() -- waveshape display box hit processor
136 =============================================================================
137*/
138
139short
140wdfnbox(n)
141short n;
142{
143 register short wval;
144 register char wsgn;
145 register short *fpuws;
146
147 switch (n) { /* switch off of window ID */
148
149 case 0: /* process a hit in the main window */
150
151 switch (wpntsv) {
152
153 case 0: /* nothing selected so far: select a point */
154
155 wpntsv = 1;
156 curwpnt = (cxval - 2) / 2;
157
158 if (curwpnt GE NUMWPNT)
159 curwpnt = NUMWPNT - 1;
160 else if (curwpnt < 0)
161 curwpnt = 0;
162
163 cratex = crate2;
164 cratey = crate2;
165 newws();
166 cyval = WPOFF - ((curwoff * WPSF1) / WPSF2);
167 cxval = (curwpnt << 1) + 2;
168 arcurs(WS_GRAB);
169 gcurpos(cxval, cyval);
170 wplast = curwpnt;
171 wvlast = curwoff;
172 wdswin(4);
173 break;
174/*
175
176*/
177 case 1: /* point was selected: unselect it */
178
179 wpntsv = 0;
180 cratex = crate1;
181 cratey = crate1;
182
183 arcurs(WDCURS);
184 gcurpos(cxval, cyval);
185 break;
186
187 case 2: /* harmonic was selected: unselect it */
188
189 wpntsv = 0;
190 cratex = crate1;
191 cratey = crate1;
192
193 arcurs(WDCURS);
194 settc(22, 1 + (curwhrm << 1));
195 break;
196 }
197
198 return(TRUE);
199
200 case 1: /* process a hit in the harmonic legend */
201
202 wpntsv = 2;
203 cratex = crate1;
204 cratey = crate1;
205
206 curwhrm = cxval >> 4;
207 curwhrv = vmtab[curwhrm];
208
209 cxval = (curwhrm << 4) + 8;
210
211 if (curwhrv < 0) {
212
213 cyval = WBOFF - ((-curwhrv * WBSF1) / WBSF2);
214
215 } else {
216
217 cyval = WBOFF - ((curwhrv * WBSF1) / WBSF2);
218 }
219
220 arcurs(WS_GRAB);
221 gcurpos(cxval, cyval);
222 wdswin(5);
223 return(TRUE);
224/*
225
226*/
227 case 3: /* process a hit in the store & fetch window */
228
229 wsnmod[curvce][curwslt] = FALSE;
230
231 if (cyval < 336) { /* store ? */
232
233 memcpyw(&wslib[curwave],
234 curwslt ? vbufs[curvce].idhwvbf
235 : vbufs[curvce].idhwvaf,
236 NUMHARM + (2 * NUMWPNT));
237
238 wdswin(2);
239
240 } else { /* retrieve */
241
242 memcpyw(curwslt ? vbufs[curvce].idhwvbf
243 : vbufs[curvce].idhwvaf,
244 &wslib[curwave],
245 NUMHARM + (2 * NUMWPNT));
246
247 updfpu();
248 newws();
249 dsnewws();
250 }
251
252 cratex = crate1;
253 cratey = crate1;
254 return(TRUE);
255
256 default: /* anywhere else is an error */
257
258 cratex = crate1;
259 cratey = crate1;
260 return(FALSE);
261 }
262}
Note: See TracBrowser for help on using the repository browser.