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

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

Zero redundant declarations.

  • Property mode set to 100644
File size: 4.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 "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*/
41
42/*
43 =============================================================================
44 newws() -- setup editing for a new waveshape
45 =============================================================================
46*/
47
48void newws(void)
49{
50 register int16_t i;
51 register struct instdef *ip;
52
53 ip = &vbufs[curvce];
54
55 if (curwslt) {
56
57 for (i = 0; i < NUMWPNT; i++) {
58
59 offsets[i + 1] = ip->idhwvbo[i] >> 5;
60 wsbuf[i + 1] = ip->idhwvbf[i] >> 5;
61 }
62
63 memcpyw(vmtab, ip->idhwvbh, NUMHARM);
64
65 } else {
66
67 for (i = 0; i < NUMWPNT; i++) {
68
69 offsets[i + 1] = ip->idhwvao[i] >> 5;
70 wsbuf[i + 1] = ip->idhwvaf[i] >> 5;
71 }
72
73 memcpyw(vmtab, ip->idhwvah, NUMHARM);
74 }
75
76 offsets[0] = offsets[1];
77 wsbuf[0] = wsbuf[1];
78
79 curwhrv = vmtab[curwhrm];
80 lstwoff = wvlast = curwoff = offsets[1 + curwpnt];
81 curwfnl = wsbuf[curwpnt + 1];
82 lstwpnt = wplast = curwpnt;
83
84 memsetw(vknm, 0, (NUMHARM * NUMWPCAL) << 1);
85 wadj();
86}
87
88/*
89
90*/
91
92/*
93 =============================================================================
94 wdfnbox() -- waveshape display box hit processor
95 =============================================================================
96*/
97
98int16_t wdfnbox(int16_t n)
99{
100 register int16_t wval;
101 register int8_t wsgn;
102 register int16_t *fpuws;
103
104 switch (n) { /* switch off of window ID */
105
106 case 0: /* process a hit in the main window */
107
108 switch (wpntsv) {
109
110 case 0: /* nothing selected so far: select a point */
111
112 wpntsv = 1;
113 curwpnt = (cxval - 2) / 2;
114
115 if (curwpnt GE NUMWPNT)
116 curwpnt = NUMWPNT - 1;
117 else if (curwpnt < 0)
118 curwpnt = 0;
119
120 cratex = crate2;
121 cratey = crate2;
122 newws();
123 cyval = WPOFF - ((curwoff * WPSF1) / WPSF2);
124 cxval = (curwpnt << 1) + 2;
125 arcurs(WS_GRAB);
126 gcurpos(cxval, cyval);
127 wplast = curwpnt;
128 wvlast = curwoff;
129 wdswin(4);
130 break;
131/*
132
133*/
134 case 1: /* point was selected: unselect it */
135
136 wpntsv = 0;
137 cratex = crate1;
138 cratey = crate1;
139
140 arcurs(WDCURS);
141 gcurpos(cxval, cyval);
142 break;
143
144 case 2: /* harmonic was selected: unselect it */
145
146 wpntsv = 0;
147 cratex = crate1;
148 cratey = crate1;
149
150 arcurs(WDCURS);
151 settc(22, 1 + (curwhrm << 1));
152 break;
153 }
154
155 return(TRUE);
156
157 case 1: /* process a hit in the harmonic legend */
158
159 wpntsv = 2;
160 cratex = crate1;
161 cratey = crate1;
162
163 curwhrm = cxval >> 4;
164 curwhrv = vmtab[curwhrm];
165
166 cxval = (curwhrm << 4) + 8;
167
168 if (curwhrv < 0) {
169
170 cyval = WBOFF - ((-curwhrv * WBSF1) / WBSF2);
171
172 } else {
173
174 cyval = WBOFF - ((curwhrv * WBSF1) / WBSF2);
175 }
176
177 arcurs(WS_GRAB);
178 gcurpos(cxval, cyval);
179 wdswin(5);
180 return(TRUE);
181/*
182
183*/
184 case 3: /* process a hit in the store & fetch window */
185
186 wsnmod[curvce][curwslt] = FALSE;
187
188 if (cyval < 336) { /* store ? */
189
190 memcpyw(&wslib[curwave],
191 curwslt ? vbufs[curvce].idhwvbf
192 : vbufs[curvce].idhwvaf,
193 NUMHARM + (2 * NUMWPNT));
194
195 wdswin(2);
196
197 } else { /* retrieve */
198
199 memcpyw(curwslt ? vbufs[curvce].idhwvbf
200 : vbufs[curvce].idhwvaf,
201 &wslib[curwave],
202 NUMHARM + (2 * NUMWPNT));
203
204 updfpu();
205 newws();
206 dsnewws();
207 }
208
209 cratex = crate1;
210 cratey = crate1;
211 return(TRUE);
212
213 default: /* anywhere else is an error */
214
215 cratex = crate1;
216 cratey = crate1;
217 return(FALSE);
218 }
219}
220
Note: See TracBrowser for help on using the repository browser.