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

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

Removed form-feed comments.

  • Property mode set to 100644
File size: 4.1 KB
RevLine 
[f40a309]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
[b28a12e]10#include "ram.h"
[f40a309]11
12struct selbox wdboxes[] = {
13
14 { 1, 1, 510, 307, 0, wdfnbox}, /* 0 */
15 { 1, 308, 510, 320, 1, wdfnbox}, /* 1 */
[60288f5]16 { 1, 322, 174, 348, 2, entbh}, /* 2 */
[f40a309]17 {176, 322, 230, 348, 3, wdfnbox}, /* 3 */
[60288f5]18 {232, 322, 398, 348, 4, entbh}, /* 4 */
19 {400, 322, 510, 348, 5, entbh}, /* 5 */
[f40a309]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
[0580615]30void dsnewws(void)
[f40a309]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
[0580615]44void newws(void)
[f40a309]45{
[7258c6a]46 register int16_t i;
[f40a309]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
[7258c6a]90int16_t wdfnbox(int16_t n)
[f40a309]91{
[7258c6a]92 register int16_t wval;
93 register int8_t wsgn;
94 register int16_t *fpuws;
[f40a309]95
96 switch (n) { /* switch off of window ID */
97
98 case 0: /* process a hit in the main window */
99
100 switch (wpntsv) {
101
102 case 0: /* nothing selected so far: select a point */
103
104 wpntsv = 1;
105 curwpnt = (cxval - 2) / 2;
106
107 if (curwpnt GE NUMWPNT)
108 curwpnt = NUMWPNT - 1;
109 else if (curwpnt < 0)
110 curwpnt = 0;
111
112 cratex = crate2;
113 cratey = crate2;
114 newws();
115 cyval = WPOFF - ((curwoff * WPSF1) / WPSF2);
116 cxval = (curwpnt << 1) + 2;
117 arcurs(WS_GRAB);
118 gcurpos(cxval, cyval);
119 wplast = curwpnt;
120 wvlast = curwoff;
121 wdswin(4);
122 break;
[fa38804]123
[f40a309]124 case 1: /* point was selected: unselect it */
125
126 wpntsv = 0;
127 cratex = crate1;
128 cratey = crate1;
129
130 arcurs(WDCURS);
131 gcurpos(cxval, cyval);
132 break;
133
134 case 2: /* harmonic was selected: unselect it */
135
136 wpntsv = 0;
137 cratex = crate1;
138 cratey = crate1;
139
140 arcurs(WDCURS);
141 settc(22, 1 + (curwhrm << 1));
142 break;
143 }
144
145 return(TRUE);
146
147 case 1: /* process a hit in the harmonic legend */
148
149 wpntsv = 2;
150 cratex = crate1;
151 cratey = crate1;
152
153 curwhrm = cxval >> 4;
154 curwhrv = vmtab[curwhrm];
155
156 cxval = (curwhrm << 4) + 8;
157
158 if (curwhrv < 0) {
159
160 cyval = WBOFF - ((-curwhrv * WBSF1) / WBSF2);
161
162 } else {
163
164 cyval = WBOFF - ((curwhrv * WBSF1) / WBSF2);
165 }
166
167 arcurs(WS_GRAB);
168 gcurpos(cxval, cyval);
169 wdswin(5);
170 return(TRUE);
[fa38804]171
[f40a309]172 case 3: /* process a hit in the store & fetch window */
173
174 wsnmod[curvce][curwslt] = FALSE;
175
176 if (cyval < 336) { /* store ? */
177
178 memcpyw(&wslib[curwave],
179 curwslt ? vbufs[curvce].idhwvbf
180 : vbufs[curvce].idhwvaf,
181 NUMHARM + (2 * NUMWPNT));
182
183 wdswin(2);
184
185 } else { /* retrieve */
186
187 memcpyw(curwslt ? vbufs[curvce].idhwvbf
188 : vbufs[curvce].idhwvaf,
189 &wslib[curwave],
190 NUMHARM + (2 * NUMWPNT));
191
192 updfpu();
193 newws();
194 dsnewws();
195 }
196
197 cratex = crate1;
198 cratey = crate1;
199 return(TRUE);
200
201 default: /* anywhere else is an error */
202
203 cratex = crate1;
204 cratey = crate1;
205 return(FALSE);
206 }
207}
[6262b5c]208
Note: See TracBrowser for help on using the repository browser.