1
2 /*
3 * Diverse Bristol audio routines.
4 * Copyright (c) by Nick Copeland <nickycopeland@hotmail.com> 1996,2012
5 *
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22 /*
23 * Layer params - 12 are reserved:
24 *
25 * Sqr gain level
26 * Rmp gain level
27 * Osc Brilliance'
28 * Osc Brilliance''
29 * Filter brilliance
30 * Pan
31 * Env1 gain
32 * Nudge
33 * Switch/level env2 to LPF? Gives two env for filters. Env panned cutover?
34 * Glide rates - from starting point, not between notes?
35 *
36 * Global params:
37 *
38 * Detune
39 * LFO Key Sync
40 * Midi Channel selection
41 * Noise Multi
42 * LFO Multi
43 * Nudge
44 * Nudge Depth
45 */
46
47 #include <fcntl.h>
48
49 #include "brighton.h"
50 #include "bristolmidi.h"
51 #include "brightonMini.h"
52 #include "brightoninternals.h"
53
54 #include "bristolarpeggiation.h"
55
56 static int cs80Init();
57 static int cs80Configure();
58 static int cs80Callback(brightonWindow *, int, int, float);
59 static int cs80panelswitch(brightonWindow *, int, int, float);
60 static int midiCallback(brightonWindow *, int, int, float);
61
62 extern guimain global;
63
64 static int debuglevel = 0;
65
66 #include "brightonKeys.h"
67
68 /*
69 * These are a pair of double click timers and mw is a memory weighting to
70 * scale the 64 available memories into banks of banks
71 */
72 static int dc1, mw = 0;
73
74 static int width;
75
76 /*
77 * We need a scratchpad so that we can load single layers out of existing
78 * memories.
79 */
80 static float *scratch = NULL;
81
82 #define DEVICE_COUNT 180
83 /*
84 * Need to split up active into the two layers, mods and opts.
85 */
86 #define ACTIVE_DEVS 145
87 #define MEM_MGT (ACTIVE_DEVS + 2)
88 #define LAYER_DEVS 120
89
90 #define PATCH_BUTTONS MEM_MGT
91 #define BANK_BUTTONS (MEM_MGT + 9)
92 #define LOAD_BUTTON (MEM_MGT + 8)
93
94 #define KEY_PANEL 2
95 #define MODS_PANEL 2
96
97 #define RADIO_UB 147
98 #define RADIO_LB 163
99 #define RADIO_UP 151
100 #define RADIO_LP 167
101
102 #define PANEL_SELECT (ACTIVE_DEVS + 4)
103
104 /*
105 * This structure is for device definition. The structure is defined in
106 * include/brighton.h, further definitions in brighton/brightonDevtable.h and
107 * include/brightoninternals.h
108 *
109 * typedef int (*brightonCallback)(int, float);
110 * typedef struct BrightonLocations {
111 * int device; 0=rotary, 1=scale, etc.
112 * float relx, rely; relative position with regards to 1000 by 1000 window
113 * float relw, relh; relative height.
114 * int from, to;
115 * brightonCallback callback; specific to this dev
116 * char *image; bitmap. If zero take a device default.
117 * int flags;
118 * } brightonLocations;
119 *
120 * This example is for a cs80Bristol type synth interface.
121 */
122 #define W1 17
123 #define W2 16
124 #define W3 15
125 #define L1 200
126 #define L2 50
127 #define L3 100
128 #define L4 120
129
130 #define R1 53
131 #define R1a 100
132 #define R2 346
133 #define R2a 396
134 #define R3 618
135 #define R3a (R3 + 45)
136 #define R4 (R3 + L2)
137 #define R5 (R4 + L2)
138
139 #define D1 25
140 #define D2 (W2)
141 #define D3 20
142 #define D4 24
143
144 #define C1 270
145 #define C2 (C1 + D1)
146 #define C3 (C2 + D1)
147 #define C4 (C3 + D1 + 5)
148 #define C5 (C4 + D1)
149 #define C6 (C5 + D1)
150 #define C7 (C6 + D1 +D3)
151 #define C8 (C7 + D1)
152 #define C9 (C8 + D1)
153 #define C10 (C9 + D1)
154 #define C11 (C10 + D1)
155 #define C12 (C11 + D1)
156 #define C13 (C12 + D1)
157 #define C14 (C13 + D1)
158 #define C15 (C14 + D1)
159 #define C16 (C15 + D1 + D3)
160 #define C17 (C16 + D1)
161 #define C18 (C17 + D1)
162 #define C19 (C18 + D1)
163 #define C20 (C19 + D1)
164 #define C21 (C20 + D1)
165 #define C22 (C21 + D1)
166 #define C23 (C22 + D1 + D3)
167 #define C24 (C23 + D1)
168 #define C25 (C24 + D1)
169 #define C26 (C25 + D1)
170
171 #define CB1 14
172 #define CB2 (CB1 + D4 + 8)
173 #define CB3 (CB2 + D4 + 7)
174 #define CB4 (CB3 + D4)
175 #define CB5 (CB4 + D4)
176 #define CB6 (CB5 + D4)
177 #define CB7 (CB6 + D4)
178 #define CB8 (CB7 + D4 + 4)
179 #define CB9 (CB8 + D4 + 16)
180 #define CB10 (CB9 + D4)
181 #define CB11 (CB10 + D4)
182 #define CB12 (CB11 + D4)
183 #define CB13 (CB12 + D4)
184 #define CB14 (CB13 + D4)
185
186 #define CB15 665
187 #define CB16 (CB15 + D4)
188 #define CB17 (CB16 + D4)
189 #define CB18 (CB17 + D4 + 10)
190 #define CB19 (CB18 + D4)
191 #define CB20 (CB19 + D4)
192 #define CB21 (CB20 + D4 + 1)
193 #define CB22 (CB21 + D4 + 8)
194 #define CB23 (CB22 + D4 + 1)
195 #define CB24 (CB23 + D4)
196 #define CB25 (CB24 + D4)
197 #define CB26 (CB25 + D4 + 10)
198
199 #define BC1 405
200 #define BC2 (BC1 + D2)
201 #define BC3 (BC2 + D2)
202 #define BC4 (BC3 + D2)
203 #define BC5 (BC4 + D2)
204 #define BC6 (BC5 + D2)
205 #define BC7 (BC6 + D2)
206 #define BC8 (BC7 + D2)
207 #define BC9 (BC8 + D2)
208 #define BC10 (BC9 + D2)
209 #define BC11 (BC10 + D2)
210 #define BC12 (BC11 + D2)
211 #define BC13 (BC12 + D2)
212 #define BC14 (BC13 + D2)
213 #define BC15 (BC14 + D2)
214 #define BC16 (BC15 + D2)
215
216 /*
217 * two rows of 25 identical controls for the layered synths, then a load for
218 * global controls and presets.
219 */
220 static brightonLocations locations[DEVICE_COUNT] = {
221 /* First 26 controls for upper layer - 0 */
222 {"", 1, C1, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderwhite2.xpm", 0,
223 BRIGHTON_HALFSHADOW},
224 {"", 1, C2, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
225 BRIGHTON_HALFSHADOW},
226 {"", 1, C3, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
227 BRIGHTON_HALFSHADOW},
228 {"", 2, C4, R1a, W3, L3, 0, 1, 0, "bitmaps/buttons/rockerblack.xpm", 0,
229 BRIGHTON_NOSHADOW|BRIGHTON_VERTICAL},
230 {"", 2, C5, R1a, W3, L3, 0, 1, 0, "bitmaps/buttons/rockerblack.xpm", 0,
231 BRIGHTON_NOSHADOW|BRIGHTON_VERTICAL},
232 {"", 1, C6, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
233 BRIGHTON_HALFSHADOW},
234 {"", 1, C7, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
235 BRIGHTON_HALFSHADOW},
236 {"", 1, C8, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderred2.xpm", 0,
237 BRIGHTON_HALFSHADOW},
238 {"", 1, C9, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
239 BRIGHTON_HALFSHADOW},
240 {"", 1, C10, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderred2.xpm", 0,
241 BRIGHTON_HALFSHADOW},
242 {"", 1, C11, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
243 BRIGHTON_HALFSHADOW},
244 {"", 1, C12, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
245 BRIGHTON_HALFSHADOW},
246 {"", 1, C13, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
247 BRIGHTON_HALFSHADOW},
248 {"", 1, C14, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
249 BRIGHTON_HALFSHADOW},
250 {"", 1, C15, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/slideryellow.xpm", 0,
251 BRIGHTON_HALFSHADOW},
252 {"", 1, C16, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
253 BRIGHTON_HALFSHADOW},
254 {"", 1, C17, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
255 BRIGHTON_HALFSHADOW},
256 {"", 1, C18, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
257 BRIGHTON_HALFSHADOW},
258 {"", 1, C19, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
259 BRIGHTON_HALFSHADOW},
260 {"", 1, C20, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
261 BRIGHTON_HALFSHADOW},
262 {"", 1, C21, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/slideryellow.xpm", 0,
263 BRIGHTON_HALFSHADOW},
264 {"", 1, C22, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
265 BRIGHTON_HALFSHADOW},
266 {"", 1, C23, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
267 BRIGHTON_HALFSHADOW},
268 {"", 1, C24, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
269 BRIGHTON_HALFSHADOW},
270 {"", 1, C25, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
271 BRIGHTON_HALFSHADOW},
272 {"", 1, C26, R1, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
273 BRIGHTON_HALFSHADOW},
274
275 /* Second 25 controls for lower layer - 26 */
276 {"", 1, C1, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderwhite2.xpm", 0,
277 BRIGHTON_HALFSHADOW},
278 {"", 1, C2, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
279 BRIGHTON_HALFSHADOW},
280 {"", 1, C3, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
281 BRIGHTON_HALFSHADOW},
282 {"", 2, C4, R2a, W3, L3, 0, 1, 0, "bitmaps/buttons/rockerblack.xpm", 0,
283 BRIGHTON_NOSHADOW|BRIGHTON_VERTICAL},
284 {"", 2, C5, R2a, W3, L3, 0, 1, 0, "bitmaps/buttons/rockerblack.xpm", 0,
285 BRIGHTON_NOSHADOW|BRIGHTON_VERTICAL},
286 {"", 1, C6, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
287 BRIGHTON_HALFSHADOW},
288 {"", 1, C7, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
289 BRIGHTON_HALFSHADOW},
290 {"", 1, C8, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderred2.xpm", 0,
291 BRIGHTON_HALFSHADOW},
292 {"", 1, C9, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
293 BRIGHTON_HALFSHADOW},
294 {"", 1, C10, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderred2.xpm", 0,
295 BRIGHTON_HALFSHADOW},
296 {"", 1, C11, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
297 BRIGHTON_HALFSHADOW},
298 {"", 1, C12, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
299 BRIGHTON_HALFSHADOW},
300 {"", 1, C13, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
301 BRIGHTON_HALFSHADOW},
302 {"", 1, C14, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
303 BRIGHTON_HALFSHADOW},
304 {"", 1, C15, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/slideryellow.xpm", 0,
305 BRIGHTON_HALFSHADOW},
306 {"", 1, C16, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
307 BRIGHTON_HALFSHADOW},
308 {"", 1, C17, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
309 BRIGHTON_HALFSHADOW},
310 {"", 1, C18, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
311 BRIGHTON_HALFSHADOW},
312 {"", 1, C19, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
313 BRIGHTON_HALFSHADOW},
314 {"", 1, C20, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
315 BRIGHTON_HALFSHADOW},
316 {"", 1, C21, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/slideryellow.xpm", 0,
317 BRIGHTON_HALFSHADOW},
318 {"", 1, C22, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
319 BRIGHTON_HALFSHADOW},
320 {"", 1, C23, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
321 BRIGHTON_HALFSHADOW},
322 {"", 1, C24, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
323 BRIGHTON_HALFSHADOW},
324 {"", 1, C25, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
325 BRIGHTON_HALFSHADOW},
326 {"", 1, C26, R2, W1, L1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
327 BRIGHTON_HALFSHADOW},
328
329 /*
330 * Global controls 1 - 52
331 * The two knobs will eventually be moved outside of the memory area for
332 * global tune and volume control. We will also install about 16 dummies
333 * to cover for the control panel and a rake more for diverse parameters
334 */
335 {"", 10, CB2, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/sliderwhite7_3.xpm",
336 "bitmaps/knobs/sliderwhite7_2.xpm",
337 BRIGHTON_HALFSHADOW|BRIGHTON_NOTCH},
338 {"", 10, CB3, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/sliderblack7_1.xpm",
339 "bitmaps/knobs/sliderblack7_2.xpm",
340 BRIGHTON_HALFSHADOW},
341 {"", 10, CB4, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/sliderblack7_1.xpm",
342 "bitmaps/knobs/sliderblack7_2.xpm",
343 BRIGHTON_HALFSHADOW},
344 {"", 10, CB5, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/slidergrey7_1.xpm",
345 "bitmaps/knobs/slidergrey7_2.xpm",
346 BRIGHTON_HALFSHADOW},
347 {"", 10, CB6, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/sliderwhite7_3.xpm",
348 "bitmaps/knobs/sliderwhite7_2.xpm",
349 BRIGHTON_HALFSHADOW},
350 {"", 10, CB7, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/slidergrey7_1.xpm",
351 "bitmaps/knobs/slidergrey7_2.xpm",
352 BRIGHTON_HALFSHADOW},
353
354 {"", 1, CB8, R3, W1, L1, 0, 5, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
355 BRIGHTON_HALFSHADOW},
356 {"", 10, CB9, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/sliderwhite7_3.xpm",
357 "bitmaps/knobs/sliderwhite7_2.xpm",
358 BRIGHTON_HALFSHADOW},
359 {"", 10, CB10, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/sliderwhite7_3.xpm",
360 "bitmaps/knobs/sliderwhite7_2.xpm",
361 BRIGHTON_HALFSHADOW},
362 {"", 10, CB11, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/slidergreen7_1.xpm",
363 "bitmaps/knobs/slidergreen7_2.xpm",
364 BRIGHTON_HALFSHADOW},
365 {"", 10, CB12, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/slidergrey7_1.xpm",
366 "bitmaps/knobs/slidergrey7_2.xpm",
367 BRIGHTON_HALFSHADOW},
368 {"", 1, CB13 , R3, W1, L1, 0, 5, 0, "bitmaps/knobs/sliderwhite2.xpm", 0,
369 BRIGHTON_HALFSHADOW},
370 {"", 1, CB14 + 8, R3, W1, L1, 0, 5, 0, "bitmaps/knobs/sliderwhite2.xpm", 0,
371 BRIGHTON_HALFSHADOW},
372
373 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
374 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
375 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
376 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
377
378 /*
379 * Global controls 2 - 69
380 */
381 {"", 10, CB15, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/sliderblack7_1.xpm",
382 "bitmaps/knobs/sliderblack7_2.xpm",
383 BRIGHTON_HALFSHADOW},
384 {"", 10, CB16, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/slidergreen7_1.xpm",
385 "bitmaps/knobs/slidergreen7_2.xpm",
386 BRIGHTON_HALFSHADOW},
387 {"", 10, CB17, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/sliderred7_1.xpm",
388 "bitmaps/knobs/sliderred7_2.xpm",
389 BRIGHTON_HALFSHADOW},
390 {"", 10, CB18, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/sliderwhite7_3.xpm",
391 "bitmaps/knobs/sliderwhite7_2.xpm",
392 BRIGHTON_HALFSHADOW},
393 {"", 10, CB19, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/sliderwhite7_3.xpm",
394 "bitmaps/knobs/sliderwhite7_2.xpm",
395 BRIGHTON_HALFSHADOW},
396 {"", 10, CB20, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/sliderwhite7_3.xpm",
397 "bitmaps/knobs/sliderwhite7_2.xpm",
398 BRIGHTON_HALFSHADOW},
399 {"", 10, CB21, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/slidergreen7_1.xpm",
400 "bitmaps/knobs/slidergreen7_2.xpm",
401 BRIGHTON_HALFSHADOW},
402 {"", 10, CB22, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/slidergreen7_1.xpm",
403 "bitmaps/knobs/slidergreen7_2.xpm",
404 BRIGHTON_HALFSHADOW},
405 {"", 10, CB23, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/slidergreen7_1.xpm",
406 "bitmaps/knobs/slidergreen7_2.xpm",
407 BRIGHTON_HALFSHADOW},
408 {"", 10, CB24, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/slidergrey7_1.xpm",
409 "bitmaps/knobs/slidergrey7_2.xpm",
410 BRIGHTON_HALFSHADOW},
411 {"", 10, CB25, R3a, W1, L4, 0, 1, 0, "bitmaps/knobs/slidergrey7_1.xpm",
412 "bitmaps/knobs/slidergrey7_2.xpm",
413 BRIGHTON_HALFSHADOW},
414
415 /*
416 * Dummies 65 from index 80
417 *
418 * First 53 for the opts panel, 36 used, final 12 for the opts.
419 */
420 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
421 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
422 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
423 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
424 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
425 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
426 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
427 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
428 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
429 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
430 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
431 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
432 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
433 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
434 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
435 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
436
437 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
438 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
439 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
440 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
441 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
442 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
443 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
444 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
445 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
446 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
447 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
448 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
449 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
450 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
451 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
452 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
453
454 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
455 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
456 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
457 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
458 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
459 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
460 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
461 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
462 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
463 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
464 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
465 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
466 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
467 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
468 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
469 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
470
471 /* Free 13 May turn into global options so channels can have 20 each */
472 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
473 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
474 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
475 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
476 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
477
478 /* Mods panel, 12 from 133 */
479 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
480 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
481 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
482 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
483 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
484 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
485 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
486 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
487 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
488 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
489 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
490 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
491
492 /* Vol and Tune - 145 */
493 {"", 0, CB1, R4 + 15, W1 + 8, L1, 0, 1, 0, "bitmaps/knobs/knob2.xpm", 0,
494 BRIGHTON_HALFSHADOW|BRIGHTON_NOTCH},
495 {"", 0, CB26, R4 + 15, W1 + 8, L1, 0, 1, 0, "bitmaps/knobs/knob2.xpm", 0,
496 BRIGHTON_HALFSHADOW},
497
498 /* Memory Buttons */
499 {"", 2, BC1, R4, W2, L2, 0, 1, 0,
500 "bitmaps/buttons/touchnlo.xpm", "bitmaps/buttons/touchnlO.xpm", 0},
501 {"", 2, BC2, R4, W2, L2, 0, 1, 0,
502 "bitmaps/buttons/touchnlo.xpm", "bitmaps/buttons/touchnlO.xpm", 0},
503 {"", 2, BC3, R4, W2, L2, 0, 1, 0,
504 "bitmaps/buttons/touchnlo.xpm", "bitmaps/buttons/touchnlO.xpm", 0},
505 {"", 2, BC4, R4, W2, L2, 0, 1, 0,
506 "bitmaps/buttons/touchnlo.xpm", "bitmaps/buttons/touchnlO.xpm", 0},
507 {"", 2, BC5, R4, W2, L2, 0, 1, 0,
508 "bitmaps/buttons/touchnlr.xpm", "bitmaps/buttons/touchnlR.xpm", 0},
509 {"", 2, BC6, R4, W2, L2, 0, 1, 0,
510 "bitmaps/buttons/touchnlr.xpm", "bitmaps/buttons/touchnlR.xpm", 0},
511 {"", 2, BC7, R4, W2, L2, 0, 1, 0,
512 "bitmaps/buttons/touchnlo.xpm", "bitmaps/buttons/touchnlO.xpm", 0},
513 {"", 2, BC8, R4, W2, L2, 0, 1, 0,
514 "bitmaps/buttons/touchnlo.xpm", "bitmaps/buttons/touchnlO.xpm", 0},
515 {"", 2, BC9, R4, W2, L2, 0, 1, 0,
516 "bitmaps/buttons/touchnlo.xpm", "bitmaps/buttons/touchnlO.xpm", 0},
517 {"", 2, BC10, R4, W2, L2, 0, 1, 0,
518 "bitmaps/buttons/touchnlg.xpm", "bitmaps/buttons/touchnlG.xpm", 0},
519 {"", 2, BC11, R4, W2, L2, 0, 1, 0,
520 "bitmaps/buttons/touchnlg.xpm", "bitmaps/buttons/touchnlG.xpm", 0},
521 {"", 2, BC12, R4, W2, L2, 0, 1, 0,
522 "bitmaps/buttons/touchnlw.xpm", "bitmaps/buttons/touchnlW.xpm", 0},
523 {"", 2, BC13, R4, W2, L2, 0, 1, 0,
524 "bitmaps/buttons/touchnlw.xpm", "bitmaps/buttons/touchnlW.xpm", 0},
525 {"", 2, BC14, R4, W2, L2, 0, 1, 0,
526 "bitmaps/buttons/touchnlw.xpm", "bitmaps/buttons/touchnlW.xpm", 0},
527 {"", 2, BC15, R4, W2, L2, 0, 1, 0,
528 "bitmaps/buttons/touchnlo.xpm", "bitmaps/buttons/touchnlO.xpm",
529 BRIGHTON_CHECKBUTTON},
530 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
531
532 {"", 2, BC1, R5, W2, L2, 0, 1, 0,
533 "bitmaps/buttons/touchnlo.xpm", "bitmaps/buttons/touchnlO.xpm", 0},
534 {"", 2, BC2, R5, W2, L2, 0, 1, 0,
535 "bitmaps/buttons/touchnlo.xpm", "bitmaps/buttons/touchnlO.xpm", 0},
536 {"", 2, BC3, R5, W2, L2, 0, 1, 0,
537 "bitmaps/buttons/touchnlo.xpm", "bitmaps/buttons/touchnlO.xpm", 0},
538 {"", 2, BC4, R5, W2, L2, 0, 1, 0,
539 "bitmaps/buttons/touchnlo.xpm", "bitmaps/buttons/touchnlO.xpm", 0},
540 {"", 2, BC5, R5, W2, L2, 0, 1, 0,
541 "bitmaps/buttons/touchnlr.xpm", "bitmaps/buttons/touchnlR.xpm", 0},
542 {"", 2, BC6, R5, W2, L2, 0, 1, 0,
543 "bitmaps/buttons/touchnlr.xpm", "bitmaps/buttons/touchnlR.xpm", 0},
544 {"", 2, BC7, R5, W2, L2, 0, 1, 0,
545 "bitmaps/buttons/touchnlo.xpm", "bitmaps/buttons/touchnlO.xpm", 0},
546 {"", 2, BC8, R5, W2, L2, 0, 1, 0,
547 "bitmaps/buttons/touchnlo.xpm", "bitmaps/buttons/touchnlO.xpm", 0},
548 {"", 2, BC9, R5, W2, L2, 0, 1, 0,
549 "bitmaps/buttons/touchnlo.xpm", "bitmaps/buttons/touchnlO.xpm", 0},
550 {"", 2, BC10, R5, W2, L2, 0, 1, 0,
551 "bitmaps/buttons/touchnlg.xpm", "bitmaps/buttons/touchnlG.xpm", 0},
552 {"", 2, BC11, R5, W2, L2, 0, 1, 0,
553 "bitmaps/buttons/touchnlg.xpm", "bitmaps/buttons/touchnlG.xpm", 0},
554 {"", 2, BC12, R5, W2, L2, 0, 1, 0,
555 "bitmaps/buttons/touchnlw.xpm", "bitmaps/buttons/touchnlW.xpm", 0},
556 {"", 2, BC13, R5, W2, L2, 0, 1, 0,
557 "bitmaps/buttons/touchnlw.xpm", "bitmaps/buttons/touchnlW.xpm", 0},
558 {"", 2, BC14, R5, W2, L2, 0, 1, 0,
559 "bitmaps/buttons/touchnlw.xpm", "bitmaps/buttons/touchnlW.xpm", 0},
560 {"", 2, BC15, R5, W2, L2, 0, 1, 0,
561 "bitmaps/buttons/touchnlr.xpm", "bitmaps/buttons/touchnlR.xpm",
562 BRIGHTON_CHECKBUTTON},
563 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
564
565 /* Touch strip - hide the controller */
566 {"", 1, 135, 920, 560, 41, 0, 1, 0, "bitmaps/buttons/blue.xpm", 0,
567 BRIGHTON_VERTICAL|BRIGHTON_NOSHADOW|BRIGHTON_CENTER|BRIGHTON_REVERSE},
568
569 };
570
571 /*
572 * Mod panel
573 */
574 static brightonLocations csmods[15] = {
575 {"", 2, 50, 100, 70, 300, 0, 1, 0, "bitmaps/buttons/dualpushgrey.xpm", 0,
576 BRIGHTON_VERTICAL},
577
578 {"", 1, 305, 50, 80, 400, 0, 1, 0, "bitmaps/knobs/slideryellow.xpm", 0,
579 BRIGHTON_HALFSHADOW},
580 {"", 1, 430, 50, 80, 400, 0, 1, 0, "bitmaps/knobs/sliderwhite2.xpm", 0,
581 BRIGHTON_HALFSHADOW},
582
583 {"", 0, 630, 100, 115, 200, 0, 1, 0, "bitmaps/knobs/knob2.xpm", 0,
584 BRIGHTON_HALFSHADOW},
585 {"", 0, 820, 100, 115, 200, 0, 1, 0, "bitmaps/knobs/knob2.xpm", 0,
586 BRIGHTON_HALFSHADOW},
587
588 {"", 2, 50, 550, 70, 300, 0, 1, 0, "bitmaps/buttons/rockerblack.xpm", 0,
589 BRIGHTON_VERTICAL},
590 {"", 2, 175, 550, 70, 300, 0, 1, 0, "bitmaps/buttons/rockerblack.xpm", 0,
591 BRIGHTON_VERTICAL},
592 {"", 2, 300, 550, 70, 300, 0, 1, 0, "bitmaps/buttons/rockerblack.xpm", 0,
593 BRIGHTON_VERTICAL},
594 {"", 2, 425, 550, 70, 300, 0, 1, 0, "bitmaps/buttons/rockerblack.xpm", 0,
595 BRIGHTON_VERTICAL},
596
597 {"", 2, 640, 410, 90, 420, 0, 1, 0, "bitmaps/buttons/rockersmoothBB.xpm",
598 "bitmaps/buttons/rockersmoothBBd.xpm", 0},
599 {"", 2, 740, 410, 90, 420, 0, 1, 0, "bitmaps/buttons/rockersmoothBB.xpm",
600 "bitmaps/buttons/rockersmoothBBd.xpm", 0},
601 {"", 2, 840, 410, 90, 420, 0, 1, 0, "bitmaps/buttons/rockersmoothBB.xpm",
602 "bitmaps/buttons/rockersmoothBBd.xpm", 0},
603 };
604
605 static brightonLocations csmods2[1] = {
606 {"", 2, 250, 450, 600, 300, 0, 1, 0, "bitmaps/buttons/rockersmoothBWR.xpm",
607 "bitmaps/buttons/rockersmoothBWRd.xpm", 0},
608 };
609
610 #define OPTS_COUNT 48
611 #define MODS_COUNT 12
612
613 #define OW1 50
614 #define OL1 250
615
616 #define OR1 110
617 #define OR2 390
618 #define OR3 (OR2 + OR2 - OR1)
619
620 #define OD1 73
621
622 #define OC1 104
623 #define OC2 (OC1 + OD1)
624 #define OC3 (OC2 + OD1)
625 #define OC4 (OC3 + OD1)
626 #define OC5 (OC4 + OD1)
627 #define OC6 (OC5 + OD1)
628 #define OC7 (OC6 + OD1)
629 #define OC8 (OC7 + OD1)
630 #define OC9 (OC8 + OD1)
631 #define OC10 (OC9 + OD1)
632 #define OC11 (OC10 + OD1)
633 #define OC12 (OC11 + OD1)
634
635 static brightonLocations csopts[OPTS_COUNT] = {
636
637 {"", 1, OC1, OR1, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
638 BRIGHTON_HALFSHADOW},
639 {"", 1, OC2, OR1, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
640 BRIGHTON_HALFSHADOW},
641 {"", 1, OC3, OR1, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
642 BRIGHTON_HALFSHADOW},
643 {"", 1, OC4, OR1, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
644 BRIGHTON_HALFSHADOW},
645 {"", 1, OC5, OR1, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderred2.xpm", 0,
646 BRIGHTON_HALFSHADOW},
647 {"", 1, OC6, OR1, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
648 BRIGHTON_HALFSHADOW},
649 {"", 1, OC7, OR1, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
650 BRIGHTON_HALFSHADOW},
651 {"", 1, OC8, OR1, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
652 BRIGHTON_HALFSHADOW},
653 {"", 1, OC9, OR1, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
654 BRIGHTON_HALFSHADOW},
655 {"", 1, OC10, OR1, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
656 BRIGHTON_HALFSHADOW},
657 {"", 1, OC11, OR1, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slideryellow.xpm", 0,
658 BRIGHTON_HALFSHADOW},
659 {"", 1, OC12, OR1, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
660 BRIGHTON_HALFSHADOW},
661 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
662 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
663 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
664 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
665
666 {"", 1, OC1, OR2, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
667 BRIGHTON_HALFSHADOW},
668 {"", 1, OC2, OR2, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
669 BRIGHTON_HALFSHADOW},
670 {"", 1, OC3, OR2, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
671 BRIGHTON_HALFSHADOW},
672 {"", 1, OC4, OR2, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
673 BRIGHTON_HALFSHADOW},
674 {"", 1, OC5, OR2, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderred2.xpm", 0,
675 BRIGHTON_HALFSHADOW},
676 {"", 1, OC6, OR2, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
677 BRIGHTON_HALFSHADOW},
678 {"", 1, OC7, OR2, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
679 BRIGHTON_HALFSHADOW},
680 {"", 1, OC8, OR2, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
681 BRIGHTON_HALFSHADOW},
682 {"", 1, OC9, OR2, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
683 BRIGHTON_HALFSHADOW},
684 {"", 1, OC10, OR2, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
685 BRIGHTON_HALFSHADOW},
686 {"", 1, OC11, OR2, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slideryellow.xpm", 0,
687 BRIGHTON_HALFSHADOW},
688 {"", 1, OC12, OR2, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
689 BRIGHTON_HALFSHADOW},
690 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
691 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
692 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
693 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
694
695 {"", 1, OC1, OR3, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderwhite2.xpm", 0,
696 BRIGHTON_HALFSHADOW},
697 {"", 1, OC2, OR3, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
698 BRIGHTON_HALFSHADOW},
699 {"", 1, OC3, OR3, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
700 BRIGHTON_HALFSHADOW},
701 {"", 1, OC4, OR3, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
702 BRIGHTON_HALFSHADOW},
703 {"", 1, OC5, OR3, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
704 BRIGHTON_HALFSHADOW},
705 {"", 1, OC6, OR3, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergrey.xpm", 0,
706 BRIGHTON_HALFSHADOW},
707 {"", 1, OC7, OR3, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderwhite2.xpm", 0,
708 BRIGHTON_HALFSHADOW},
709 {"", 1, OC8, OR3, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderwhite2.xpm", 0,
710 BRIGHTON_HALFSHADOW},
711 {"", 1, OC9, OR3, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
712 BRIGHTON_HALFSHADOW},
713 {"", 1, OC10, OR3, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slidergreen.xpm", 0,
714 BRIGHTON_HALFSHADOW},
715 {"", 1, OC11, OR3, OW1, OL1, 0, 1, 0, "bitmaps/knobs/slideryellow.xpm", 0,
716 BRIGHTON_HALFSHADOW},
717 {"", 1, OC12, OR3, OW1, OL1, 0, 1, 0, "bitmaps/knobs/sliderblack6.xpm", 0,
718 BRIGHTON_HALFSHADOW},
719 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
720 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
721 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
722 {"", 0, 900, 900, W1, L1, 0, 1, 0, 0, 0, BRIGHTON_WITHDRAWN|BRIGHTON_NOSHADOW},
723
724 };
725
726 static int
cs80DestroySynth(brightonWindow * win)727 cs80DestroySynth(brightonWindow *win)
728 {
729 guiSynth *synth = findSynth(global.synths, win);
730
731 /*
732 * Since we registered two synths, we now need to remove the upper
733 * manual.
734 */
735 bristolMidiSendMsg(global.controlfd, synth->sid, 127, 0, BRISTOL_EXIT_ALGO);
736 return(0);
737 }
738
739 /*
740 * This is a set of globals for the main window rendering. Again taken from
741 * include/brighton.h
742 */
743 brightonApp cs80App = {
744 "cs80",
745 0,
746 "bitmaps/textures/wood4.xpm",
747 BRIGHTON_VERTICAL,
748 cs80Init,
749 cs80Configure, /* 3 callbacks, unused? */
750 midiCallback,
751 cs80DestroySynth,
752 {8, 150, 8, 2, 5, 520, 0, 0},
753 940, 435, 0, 0,
754 11,
755 {
756 {
757 "Opts",
758 "bitmaps/blueprints/cs80opts.xpm", /* flags */
759 "bitmaps/textures/cs80opts.xpm", /* flags */
760 BRIGHTON_WITHDRAWN|BRIGHTON_STRETCH,
761 0,
762 0,
763 cs80Callback,
764 28, 58, 235, 382,
765 OPTS_COUNT,
766 csopts
767 },
768 {
769 "CS80",
770 "bitmaps/blueprints/cs80.xpm",
771 "bitmaps/textures/metal7.xpm",
772 BRIGHTON_STRETCH|BRIGHTON_REVERSE, /* flags */
773 0,
774 0,
775 cs80Callback,
776 23, 47, 957, 677,
777 DEVICE_COUNT,
778 locations
779 },
780 {
781 "Keyboard",
782 0,
783 "bitmaps/newkeys/nkbg.xpm", /* flags */
784 0x020|BRIGHTON_STRETCH,
785 0,
786 0,
787 keyCallback,
788 208, 724, 758, 248,
789 KEY_COUNT,
790 keysprofile2
791 },
792 {
793 "Mods",
794 "bitmaps/blueprints/cs80mods.xpm",
795 "bitmaps/textures/metal5.xpm", /* flags */
796 BRIGHTON_VERTICAL,
797 0,
798 0,
799 cs80Callback,
800 23, 724, 186, 248,
801 MODS_COUNT,
802 csmods
803 },
804 {
805 "Mods2",
806 0,
807 "bitmaps/textures/metal5.xpm", /* flags */
808 BRIGHTON_VERTICAL,
809 0,
810 0,
811 cs80panelswitch,
812 943, 724, 38, 248,
813 1,
814 csmods2
815 },
816 {
817 "Leather Edge",
818 0,
819 "bitmaps/textures/leather.xpm",
820 BRIGHTON_VERTICAL, /* flags */
821 0,
822 0,
823 0,
824 0, 0, 10, 1000,
825 0,
826 0
827 },
828 {
829 "Leather Cover",
830 0,
831 "bitmaps/textures/leather.xpm",
832 BRIGHTON_VERTICAL, /* flags */
833 0,
834 0,
835 0,
836 10, 830, 13, 160,
837 0,
838 0
839 },
840 {
841 "Leather Edge",
842 0,
843 "bitmaps/textures/leather.xpm",
844 BRIGHTON_VERTICAL, /* flags */
845 0,
846 0,
847 0,
848 991, 0, 10, 1000,
849 0,
850 0
851 },
852 {
853 "Leather Cover",
854 0,
855 "bitmaps/textures/leather.xpm",
856 BRIGHTON_VERTICAL, /* flags */
857 0,
858 0,
859 0,
860 979, 830, 13, 160,
861 0,
862 0
863 },
864 {
865 "Leather Top",
866 0,
867 "bitmaps/textures/leather.xpm",
868 BRIGHTON_VERTICAL, /* flags */
869 0,
870 0,
871 0,
872 0, 0, 1000, 22,
873 0,
874 0
875 },
876 {
877 "Leather bottom",
878 0,
879 "bitmaps/textures/leather.xpm",
880 BRIGHTON_VERTICAL, /* flags */
881 0,
882 0,
883 0,
884 0, 970, 1000, 33,
885 0,
886 0
887 },
888 }
889 };
890
891 static int
cs80panelswitch(brightonWindow * win,int panel,int index,float value)892 cs80panelswitch(brightonWindow *win, int panel, int index, float value)
893 {
894 brightonEvent event;
895
896 event.type = BRIGHTON_EXPOSE;
897
898 printf("panel swithc %f\n", value);
899 if (value > 0) {
900 event.intvalue = 0;
901 brightonParamChange(win, 0, -1, &event);
902 event.intvalue = 1;
903 brightonParamChange(win, 1, -1, &event);
904 } else {
905 event.intvalue = 1;
906 brightonParamChange(win, 0, -1, &event);
907 }
908
909 if (width != win->width)
910 brightonPut(win,
911 "bitmaps/blueprints/cs80shade.xpm", 0, 0, win->width, win->height);
912
913 width = win->width;
914
915 return(0);
916 }
917
918 static int
cs80Debug(guiSynth * synth,int level)919 cs80Debug(guiSynth *synth, int level)
920 {
921 if (debuglevel >= level)
922 return(1);
923 return(0);
924 }
925
926 static int
cs80MidiSendMsg(guiSynth * synth,int fd,int chan,int c,int o,int v)927 cs80MidiSendMsg(guiSynth *synth, int fd, int chan, int c, int o, int v)
928 {
929 bristolMidiSendMsg(fd, synth->sid2, c, o, v);
930 return(0);
931 }
932
933 static void
modPanelFix(brightonWindow * win,guiSynth * synth)934 modPanelFix(brightonWindow *win, guiSynth *synth)
935 {
936 int i;
937 brightonEvent event;
938
939 event.type = BRIGHTON_FLOAT;
940
941 for (i = 0; i < 14; i++)
942 {
943 event.value = synth->mem.param[LAYER_DEVS + i];
944 brightonParamChange(win, MODS_PANEL, i, &event);
945 }
946 }
947
948 static int
midiCallback(brightonWindow * win,int controller,int value,float n)949 midiCallback(brightonWindow *win, int controller, int value, float n)
950 {
951 guiSynth *synth = findSynth(global.synths, win);
952
953 if (cs80Debug(synth, 1))
954 printf("midi callback: %x, %i\n", controller, value);
955
956 switch(controller)
957 {
958 case MIDI_PROGRAM:
959 if (cs80Debug(synth, 2))
960 printf("midi program: %x, %i\n", controller, value);
961 synth->location = value;
962 loadMemory(synth, "cs80", 0, synth->bank + synth->location + mw,
963 synth->mem.active, 0, 0);
964 modPanelFix(win, synth);
965 break;
966 case MIDI_BANK_SELECT:
967 if (cs80Debug(synth, 2))
968 printf("midi banksel: %x, %i\n", controller, value);
969 synth->bank = value;
970 break;
971 }
972 return(0);
973 }
974
975 static void
cs80ButtonPanel(guiSynth * synth,int fd,int chan,int c,int o,int v)976 cs80ButtonPanel(guiSynth *synth, int fd, int chan, int c, int o, int v)
977 {
978 brightonEvent event;
979
980 event.type = BRIGHTON_FLOAT;
981
982 if (cs80Debug(synth, 1))
983 printf("cs80ButtonPanel(%i, %i, %i)\n", c, o, v);
984
985 switch (c) {
986 case 0:
987 /* patch selector */
988 if (cs80Debug(synth, 2))
989 printf("memory\n");
990 /*
991 * Force exclusion
992 */
993 if (synth->dispatch[MEM_MGT + c].other2)
994 {
995 synth->dispatch[MEM_MGT + c].other2 = 0;
996 return;
997 }
998 if (synth->dispatch[MEM_MGT + c].other1 != -1)
999 {
1000 synth->dispatch[MEM_MGT + c].other2 = 1;
1001
1002 if (synth->dispatch[MEM_MGT + c].other1 != MEM_MGT + o)
1003 event.value = 0;
1004 else
1005 event.value = 1;
1006
1007 brightonParamChange(synth->win, synth->panel,
1008 synth->dispatch[MEM_MGT + c].other1, &event);
1009 }
1010 synth->dispatch[MEM_MGT + c].other1 = MEM_MGT + o;
1011
1012 synth->location = o + 1;
1013
1014 break;
1015 case 1:
1016 /* Bank selector */
1017 if (cs80Debug(synth, 2))
1018 printf("bank\n");
1019 /*
1020 * Force exclusion
1021 */
1022 if (synth->dispatch[MEM_MGT + c].other2)
1023 {
1024 synth->dispatch[MEM_MGT + c].other2 = 0;
1025 return;
1026 }
1027 if (synth->dispatch[MEM_MGT + c].other1 != -1)
1028 {
1029 synth->dispatch[MEM_MGT + c].other2 = 1;
1030
1031 if (synth->dispatch[MEM_MGT + c].other1 != MEM_MGT + o + 9)
1032 event.value = 0;
1033 else
1034 event.value = 1;
1035
1036 brightonParamChange(synth->win, synth->panel,
1037 synth->dispatch[MEM_MGT + c].other1, &event);
1038 }
1039 synth->dispatch[MEM_MGT + c].other1 = MEM_MGT + o + 9;
1040
1041 synth->bank = (o + 1) * 10;
1042
1043 break;
1044 }
1045 }
1046
1047 #define CS_LOAD 0
1048 #define CS_UB 1
1049 #define CS_LB 2
1050 #define CS_UP 3
1051 #define CS_LP 4
1052 #define CS_SAVE 5
1053
1054 #define UPPER_BANK 0
1055 #define LOWER_BANK 1
1056 #define NO_BANK -1
1057 static int currentLayer = NO_BANK;
1058
1059 /*
1060 * Loading everything means get the memory with NOCALLS then dispatch the new
1061 * values manually including the opts and mods panel.
1062 */
1063 static void
cs80MemoryShim(guiSynth * synth)1064 cs80MemoryShim(guiSynth *synth)
1065 {
1066 brightonEvent event;
1067 int i;
1068
1069 event.type = BRIGHTON_FLOAT;
1070
1071 /* The main panel */
1072 for (i = 0; i < 80; i++)
1073 {
1074 event.value = synth->mem.param[i];
1075 brightonParamChange(synth->win, 1, i, &event);
1076 }
1077
1078 /* The opts panel */
1079 for (i = 0; i < OPTS_COUNT; i++)
1080 {
1081 event.value = synth->mem.param[i + 80];
1082 brightonParamChange(synth->win, 0, i, &event);
1083 }
1084
1085 /* The mods panel */
1086 for (i = 0; i < MODS_COUNT; i++)
1087 {
1088 event.value = synth->mem.param[i + 133];
1089 brightonParamChange(synth->win, 3, i, &event);
1090 }
1091
1092 }
1093
1094 /*
1095 * Load everything
1096 */
1097 static void
cs80MemoryLoad(guiSynth * synth,int layer,int bank,int patch)1098 cs80MemoryLoad(guiSynth *synth, int layer, int bank, int patch)
1099 {
1100 printf("load %i %i %i %i\n", mw, layer, bank, patch);
1101
1102 loadMemory(synth, "cs80", 0, bank * 10 + patch + mw,
1103 synth->mem.active, 0, BRISTOL_FORCE|BRISTOL_NOCALLS);
1104 cs80MemoryShim(synth);
1105 }
1106
1107 /*
1108 * Loading layer means get the memory with nocalls into scratch memory then
1109 * dispatch the single layer values manually.
1110 */
1111 static void
cs80MemoryLoadLayer(guiSynth * synth,int layer,int bank,int patch)1112 cs80MemoryLoadLayer(guiSynth *synth, int layer, int bank, int patch)
1113 {
1114 float *hold = synth->mem.param;
1115 int i, offset = 0;
1116 brightonEvent event;
1117
1118 printf("load layer %i %i %i %i\n", mw, layer, bank, patch);
1119
1120 event.type = BRIGHTON_FLOAT;
1121
1122 synth->mem.param = scratch;
1123 loadMemory(synth, "cs80", 0, bank * 10 + patch + mw,
1124 synth->mem.active, 0, BRISTOL_FORCE|BRISTOL_NOCALLS);
1125 synth->mem.param = hold;
1126
1127 /*
1128 * So, we now have scratch selected. depending on the selected layer we
1129 * need to scan through the channel settings and then the opts for that
1130 * channel
1131 */
1132 if (layer == LOWER_BANK)
1133 {
1134 printf("load into channel-II\n");
1135 offset = 26;
1136 } else
1137 printf("load into channel-I\n");
1138
1139 for (i = 0; i < 26; i++)
1140 {
1141 event.value = scratch[i + offset];
1142 brightonParamChange(synth->win, 1, i + offset, &event);
1143 }
1144
1145 /*
1146 * Then work on the channel opts
1147 */
1148 if (layer == LOWER_BANK) {
1149 offset = 92;
1150 layer = 12;
1151 } else {
1152 offset = 80;
1153 layer = 0;
1154 }
1155
1156 for (i = 0; i < 12; i++)
1157 {
1158 event.value = scratch[i + offset];
1159 brightonParamChange(synth->win, 0, i + layer, &event);
1160 }
1161 }
1162
1163 static void
cs80MemorySave(guiSynth * synth,int layer,int bank,int patch)1164 cs80MemorySave(guiSynth *synth, int layer, int bank, int patch)
1165 {
1166 saveMemory(synth, "cs80", 0, mw + bank * 10 + patch, 0);
1167 }
1168
1169 static void
cs80Memory(guiSynth * synth,int fd,int chan,int c,int o,int v)1170 cs80Memory(guiSynth *synth, int fd, int chan, int c, int o, int v)
1171 {
1172 int i, b = 0, p = 0, off = 147;
1173 brightonEvent event;
1174
1175 event.type = BRIGHTON_FLOAT;
1176
1177 if (synth->flags & MEM_LOADING)
1178 return;
1179
1180 if ((synth->flags & OPERATIONAL) == 0)
1181 return;
1182
1183 if (cs80Debug(synth, 1))
1184 printf("cs80Memory(%i, %i, %i)\n", c, o, v);
1185 printf("cs80Memory(%i, %i, %i)\n", c, o, v);
1186
1187 /*
1188 * Six ways here, we need to do button exclusions here, probably in the
1189 * routines called.
1190 *
1191 * CS_LOAD - single then load last selected layer. Double load all.
1192 * CS_SAVE - double then save all to last selected layer.
1193 *
1194 * CS_UB - select upper bank.
1195 * CS_LB - select lower bank.
1196 * CS_UP - select upper bank, double load it.
1197 * CS_LP - select lower bank, double load it.
1198 */
1199 switch (c) {
1200 case CS_LOAD:
1201 printf("cs80Memory(load)\n");
1202
1203 if (currentLayer == LOWER_BANK)
1204 off = 163;
1205
1206 for (i = 0; i < 4;i++)
1207 {
1208 if (synth->mem.param[i + off] != 0)
1209 {
1210 b = i;
1211 break;
1212 }
1213 }
1214
1215 if (currentLayer == LOWER_BANK)
1216 off = 167;
1217 else
1218 off = 151;
1219
1220 for (i = 0; i < 10;i++)
1221 {
1222 if (synth->mem.param[i + off] != 0)
1223 {
1224 p = i;
1225 break;
1226 }
1227 }
1228
1229 if (brightonDoubleClick(dc1))
1230 cs80MemoryLoad(synth, currentLayer, b, p);
1231 else
1232 cs80MemoryLoadLayer(synth, currentLayer, b, p);
1233 break;
1234 case CS_SAVE:
1235 if (currentLayer == NO_BANK)
1236 return;
1237
1238 if (brightonDoubleClick(dc1))
1239 {
1240 printf("cs80Memory(save)\n");
1241
1242 if (currentLayer == LOWER_BANK)
1243 off = 163;
1244
1245 for (i = 0; i < 4;i++)
1246 {
1247 if (synth->mem.param[i + off] != 0)
1248 {
1249 b = i;
1250 break;
1251 }
1252 }
1253
1254 if (currentLayer == LOWER_BANK)
1255 off = 167;
1256 else
1257 off = 151;
1258
1259 for (i = 0; i < 10;i++)
1260 {
1261 if (synth->mem.param[i + off] != 0)
1262 {
1263 p = i;
1264 break;
1265 }
1266 }
1267
1268 cs80MemorySave(synth, currentLayer, b, p);
1269 }
1270 break;
1271 case CS_UB:
1272 printf("cs80Memory(ub, %i, %i)\n", c, o);
1273 currentLayer = UPPER_BANK;
1274
1275 /*
1276 * Force exclusion
1277 */
1278 if (synth->dispatch[RADIO_UB].other2)
1279 {
1280 synth->dispatch[RADIO_UB].other2 = 0;
1281 return;
1282 }
1283
1284 o += RADIO_UB;
1285
1286 if (v == 0)
1287 {
1288 if (synth->dispatch[RADIO_UB].other1 == o)
1289 {
1290 event.value = 1;
1291 brightonParamChange(synth->win, 1, o, &event);
1292 }
1293 return;
1294 }
1295
1296 if (synth->dispatch[RADIO_UB].other1 != -1)
1297 {
1298 synth->dispatch[RADIO_UB].other2 = 1;
1299
1300 if (synth->dispatch[RADIO_UB].other1 != o)
1301 event.value = 0;
1302 else
1303 event.value = 1;
1304
1305 brightonParamChange(synth->win, 1,
1306 synth->dispatch[RADIO_UB].other1, &event);
1307 }
1308 synth->dispatch[RADIO_UB].other1 = o;
1309
1310 break;
1311 case CS_LB:
1312 currentLayer = LOWER_BANK;
1313 printf("cs80Memory(lb)\n");
1314
1315 /*
1316 * Force exclusion
1317 */
1318 if (synth->dispatch[RADIO_LB].other2)
1319 {
1320 synth->dispatch[RADIO_LB].other2 = 0;
1321 return;
1322 }
1323
1324 o += RADIO_LB;
1325
1326 if (v == 0)
1327 {
1328 if (synth->dispatch[RADIO_LB].other1 == o)
1329 {
1330 event.value = 1;
1331 brightonParamChange(synth->win, 1, o, &event);
1332 }
1333 return;
1334 }
1335
1336 if (synth->dispatch[RADIO_LB].other1 != -1)
1337 {
1338 synth->dispatch[RADIO_LB].other2 = 1;
1339
1340 if (synth->dispatch[RADIO_LB].other1 != o)
1341 event.value = 0;
1342 else
1343 event.value = 1;
1344
1345 brightonParamChange(synth->win, 1,
1346 synth->dispatch[RADIO_LB].other1, &event);
1347 }
1348 synth->dispatch[RADIO_LB].other1 = o;
1349
1350 break;
1351 case CS_UP:
1352 currentLayer = UPPER_BANK;
1353 printf("cs80Memory(up)\n");
1354
1355 /*
1356 * Force exclusion
1357 */
1358 if (synth->dispatch[RADIO_UP].other2)
1359 {
1360 synth->dispatch[RADIO_UP].other2 = 0;
1361 return;
1362 }
1363
1364 o += RADIO_UP;
1365
1366 if (v == 0)
1367 {
1368 if (synth->dispatch[RADIO_UP].other1 == o)
1369 {
1370 event.value = 1;
1371 brightonParamChange(synth->win, 1, o, &event);
1372 }
1373 return;
1374 }
1375
1376 if (synth->dispatch[RADIO_UP].other1 != -1)
1377 {
1378 synth->dispatch[RADIO_UP].other2 = 1;
1379
1380 if (synth->dispatch[RADIO_UP].other1 != o)
1381 event.value = 0;
1382 else
1383 event.value = 1;
1384
1385 brightonParamChange(synth->win, 1,
1386 synth->dispatch[RADIO_UP].other1, &event);
1387 }
1388 synth->dispatch[RADIO_UP].other1 = o;
1389
1390 break;
1391 case CS_LP:
1392 currentLayer = LOWER_BANK;
1393 printf("cs80Memory(lp)\n");
1394
1395 /*
1396 * Force exclusion
1397 */
1398 if (synth->dispatch[RADIO_LP].other2)
1399 {
1400 synth->dispatch[RADIO_LP].other2 = 0;
1401 return;
1402 }
1403
1404 o += RADIO_LP;
1405
1406 if (v == 0)
1407 {
1408 if (synth->dispatch[RADIO_LP].other1 == o)
1409 {
1410 event.value = 1;
1411 brightonParamChange(synth->win, 1, o, &event);
1412 }
1413 return;
1414 }
1415
1416 if (synth->dispatch[RADIO_LP].other1 != -1)
1417 {
1418 synth->dispatch[RADIO_LP].other2 = 1;
1419
1420 if (synth->dispatch[RADIO_LP].other1 != o)
1421 event.value = 0;
1422 else
1423 event.value = 1;
1424
1425 brightonParamChange(synth->win, 1,
1426 synth->dispatch[RADIO_LP].other1, &event);
1427 }
1428 synth->dispatch[RADIO_LP].other1 = o;
1429 break;
1430 default:
1431 currentLayer = NO_BANK;
1432 printf("cs80Memory(?)\n");
1433 break;
1434 }
1435 }
1436
1437 static void
cs80Midi(guiSynth * synth,int fd,int chan,int c,int o,int v)1438 cs80Midi(guiSynth *synth, int fd, int chan, int c, int o, int v)
1439 {
1440 int newchan;
1441
1442 if ((synth->flags & OPERATIONAL) == 0)
1443 return;
1444
1445 if (c == 1) {
1446 if ((newchan = synth->midichannel - 1) < 0)
1447 newchan = synth->midichannel = 0;
1448 } else {
1449 /*
1450 * This is a little incorrect - if we are layered then we can go to
1451 * midi channel 15.
1452 */
1453 if ((newchan = synth->midichannel + 1) >= 14)
1454 newchan = synth->midichannel = 14;
1455 }
1456
1457 if (global.libtest == 0)
1458 {
1459 bristolMidiSendMsg(global.controlfd, synth->sid2,
1460 127, 0, (BRISTOL_MIDICHANNEL|newchan) + 1);
1461 bristolMidiSendMsg(global.controlfd, synth->sid,
1462 127, 0, BRISTOL_MIDICHANNEL|newchan);
1463 }
1464
1465 synth->midichannel = newchan;
1466 }
1467
1468 /*
1469 * For the sake of ease of use, links have been placed here to be called
1470 * by any of the devices created. They would be better in some other file,
1471 * perhaps with this as a dispatch.
1472 *
1473 * Param refers to the device index in the locations table given below.
1474 */
1475 static int
cs80Callback(brightonWindow * win,int panel,int index,float value)1476 cs80Callback(brightonWindow * win, int panel, int index, float value)
1477 {
1478 guiSynth *synth = findSynth(global.synths, win);
1479 int sendvalue;
1480
1481 if ((synth == 0) || (synth->flags & SUPPRESS))
1482 return(0);
1483
1484 if (cs80Debug(synth, 2))
1485 printf("cs80Callback(%i, %i, %f)\n", panel, index, value);
1486 printf("cs80Callback(%i, %i, %f)\n", panel, index, value);
1487
1488 if (panel == 0) {
1489 index += 80;
1490 sendvalue = value * C_RANGE_MIN_1;
1491 } else if (panel == 3) {
1492 index += 133;
1493 sendvalue = value * C_RANGE_MIN_1;
1494 } else {
1495 if (cs80App.resources[panel].devlocn[index].to == 1.0)
1496 sendvalue = value * C_RANGE_MIN_1;
1497 else
1498 sendvalue = value;
1499 }
1500
1501 /*
1502 * If the index is less than LAYER_DEVS then write the value to the desired
1503 * layer only, otherwise write the value to both/top layers?
1504 */
1505 synth->mem.param[index] = value;
1506
1507 /*
1508 if ((index >= DEVICE_COUNT) || ((synth->flags & OPERATIONAL) == 0))
1509 return(0);
1510 */
1511
1512 synth->dispatch[index].routine(synth,
1513 global.controlfd, synth->sid,
1514 synth->dispatch[index].controller,
1515 synth->dispatch[index].operator,
1516 sendvalue);
1517
1518 return(0);
1519 }
1520
1521 static void
cs80WaveLevel(guiSynth * synth,int fd,int chan,int c,int o,int v)1522 cs80WaveLevel(guiSynth *synth, int fd, int chan, int c, int o, int v)
1523 {
1524 if (v != 0)
1525 {
1526 if (c == 1)
1527 {
1528 /* CH-I */
1529 if (o == 0) {
1530 if (synth->mem.param[3] == 0)
1531 v = 0;
1532 else
1533 v = synth->mem.param[80] * C_RANGE_MIN_1;
1534 } else {
1535 if (synth->mem.param[4] == 0)
1536 v = 0;
1537 else
1538 v = synth->mem.param[81] * C_RANGE_MIN_1;
1539 }
1540 } else {
1541 /* CH-II */
1542 if (o == 0) {
1543 if (synth->mem.param[29] == 0)
1544 v = 0;
1545 else
1546 v = synth->mem.param[96] * C_RANGE_MIN_1;
1547 } else {
1548 if (synth->mem.param[30] == 0)
1549 v = 0;
1550 else
1551 v = synth->mem.param[97] * C_RANGE_MIN_1;
1552 }
1553 }
1554 }
1555
1556 printf("%i %i %i\n", c, o, v);
1557 bristolMidiSendMsg(global.controlfd, synth->sid, c, o, v);
1558 }
1559
1560 static void
cs80Release(guiSynth * synth,int fd,int chan,int c,int o,int v)1561 cs80Release(guiSynth *synth, int fd, int chan, int c, int o, int v)
1562 {
1563 switch (c) {
1564 case 4:
1565 v = synth->mem.param[134] * synth->mem.param[14] * C_RANGE_MIN_1;
1566 break;
1567 case 5:
1568 v = synth->mem.param[134] * synth->mem.param[20] * C_RANGE_MIN_1;
1569 break;
1570 case 10:
1571 v = synth->mem.param[134] * synth->mem.param[40] * C_RANGE_MIN_1;
1572 break;
1573 case 11:
1574 v = synth->mem.param[134] * synth->mem.param[46] * C_RANGE_MIN_1;
1575 break;
1576 case 126:
1577 bristolMidiSendMsg(global.controlfd, synth->sid, 4, 4, (int)
1578 (synth->mem.param[134] * synth->mem.param[14] * C_RANGE_MIN_1));
1579 bristolMidiSendMsg(global.controlfd, synth->sid, 5, 3, (int)
1580 (synth->mem.param[134] * synth->mem.param[20] * C_RANGE_MIN_1));
1581 bristolMidiSendMsg(global.controlfd, synth->sid, 10, 4, (int)
1582 (synth->mem.param[134] * synth->mem.param[40] * C_RANGE_MIN_1));
1583 bristolMidiSendMsg(global.controlfd, synth->sid, 11, 3, (int)
1584 (synth->mem.param[134] * synth->mem.param[46] * C_RANGE_MIN_1));
1585 return;
1586 }
1587
1588 bristolMidiSendMsg(global.controlfd, synth->sid, c, o, v);
1589 }
1590
1591 static void
cs80Resonance(guiSynth * synth,int fd,int chan,int c,int o,int v)1592 cs80Resonance(guiSynth *synth, int fd, int chan, int c, int o, int v)
1593 {
1594 switch (c) {
1595 case 2:
1596 v = synth->mem.param[71] * synth->mem.param[7] * C_RANGE_MIN_1;
1597 break;
1598 case 3:
1599 v = synth->mem.param[71] * synth->mem.param[9] * C_RANGE_MIN_1;
1600 break;
1601 case 8:
1602 v = synth->mem.param[71] * synth->mem.param[33] * C_RANGE_MIN_1;
1603 break;
1604 case 9:
1605 v = synth->mem.param[71] * synth->mem.param[35] * C_RANGE_MIN_1;
1606 break;
1607 case 126:
1608 bristolMidiSendMsg(global.controlfd, synth->sid, 2, 1, (int)
1609 (synth->mem.param[71] * synth->mem.param[7] * C_RANGE_MIN_1));
1610 bristolMidiSendMsg(global.controlfd, synth->sid, 3, 1, (int)
1611 (synth->mem.param[71] * synth->mem.param[9] * C_RANGE_MIN_1));
1612 bristolMidiSendMsg(global.controlfd, synth->sid, 8, 1, (int)
1613 (synth->mem.param[71] * synth->mem.param[33] * C_RANGE_MIN_1));
1614 bristolMidiSendMsg(global.controlfd, synth->sid, 9, 1, (int)
1615 (synth->mem.param[71] * synth->mem.param[35] * C_RANGE_MIN_1));
1616 return;
1617 }
1618
1619 bristolMidiSendMsg(global.controlfd, synth->sid, c, o, v);
1620 }
1621
1622 static void
cs80Pitchbend(guiSynth * synth,int fd,int chan,int c,int o,int v)1623 cs80Pitchbend(guiSynth *synth, int fd, int chan, int c, int o, int v)
1624 {
1625 if (global.libtest)
1626 return;
1627
1628 bristolMidiSendMsg(global.controlfd, synth->sid, BRISTOL_EVENT_PITCH, 0, v);
1629 }
1630
1631 static void
cs80Detune(guiSynth * synth,int fd,int chan,int c,int o,int v)1632 cs80Detune(guiSynth *synth, int fd, int chan, int c, int o, int v)
1633 {
1634 int value = v / 50;
1635
1636 if (o == 101) {
1637 if (!global.libtest) {
1638 bristolMidiSendNRP(global.controlfd, synth->sid,
1639 BRISTOL_NRP_DETUNE, value);
1640 }
1641 } else {
1642 /*
1643 * Channel 2 detune
1644 */
1645 bristolMidiSendMsg(global.controlfd, synth->sid, 7, 6, v);
1646 }
1647 }
1648
1649 /*
1650 * Any location initialisation required to run the callbacks. For bristol, this
1651 * will connect to the engine, and give it some base parameters.
1652 * May need to generate some application specific menus.
1653 * Will also then make specific requests to some of the devices to alter their
1654 * rendering.
1655 */
1656 static int
cs80Init(brightonWindow * win)1657 cs80Init(brightonWindow *win)
1658 {
1659 guiSynth *synth = findSynth(global.synths, win);
1660 int i;
1661
1662 if (synth == 0)
1663 {
1664 synth = findSynth(global.synths, 0);
1665 if (synth == 0)
1666 {
1667 printf("cannot init\n");
1668 return(0);
1669 }
1670 }
1671
1672 synth->win = win;
1673
1674 printf("Initialise the cs80 link to bristol: %p\n", synth->win);
1675
1676 scratch = (float *) brightonmalloc(DEVICE_COUNT * sizeof(float));
1677 synth->mem.param = (float *) brightonmalloc(DEVICE_COUNT * sizeof(float));
1678 synth->mem.count = DEVICE_COUNT;
1679 synth->mem.active = ACTIVE_DEVS;
1680 synth->dispatch = (dispatcher *)
1681 brightonmalloc(DEVICE_COUNT * sizeof(dispatcher));
1682
1683 /*
1684 * We really want to have three connection mechanisms. These should be
1685 * 1. Unix named sockets.
1686 * 2. UDP sockets.
1687 * 3. MIDI pipe.
1688 */
1689 if (!global.libtest)
1690 {
1691 if ((synth->sid = initConnection(&global, synth)) < 0)
1692 return(-1);
1693 }
1694 printf(" The SID are %i and %i\n", synth->sid, synth->sid2);
1695
1696 for (i = 0; i < DEVICE_COUNT; i++)
1697 {
1698 /* Default all controllers to send a message that is ignored */
1699 synth->dispatch[i].controller = 126;
1700 synth->dispatch[i].operator = 101;
1701 synth->dispatch[i].routine = (synthRoutine) cs80MidiSendMsg;
1702 }
1703
1704 /* LFO */
1705 synth->dispatch[0].controller = 0;
1706 synth->dispatch[0].operator = 0;
1707 synth->dispatch[1].controller = 126;
1708 synth->dispatch[1].operator = 24;
1709 synth->dispatch[2].controller = 1;
1710 synth->dispatch[2].operator = 5;
1711
1712 /* Square on/off, ramp on/off - will need shim for level later */
1713 synth->dispatch[3].controller = 1;
1714 synth->dispatch[3].operator = 0;
1715 synth->dispatch[3].routine = (synthRoutine) cs80WaveLevel;
1716 synth->dispatch[4].controller = 1;
1717 synth->dispatch[4].operator = 1;
1718 synth->dispatch[4].routine = (synthRoutine) cs80WaveLevel;
1719
1720 synth->dispatch[5].controller = 126;
1721 synth->dispatch[5].operator = 26; /* Noise level */
1722 synth->dispatch[6].controller = 2;
1723 synth->dispatch[6].operator = 0;
1724 synth->dispatch[7].controller = 2;
1725 synth->dispatch[7].operator = 1;
1726 synth->dispatch[7].routine = (synthRoutine) cs80Resonance;
1727 synth->dispatch[8].controller = 3;
1728 synth->dispatch[8].operator = 0;
1729 synth->dispatch[9].controller = 3;
1730 synth->dispatch[9].operator = 1;
1731 synth->dispatch[9].routine = (synthRoutine) cs80Resonance;
1732 synth->dispatch[10].controller = 4;
1733 synth->dispatch[10].operator = 0;
1734 synth->dispatch[11].controller = 4;
1735 synth->dispatch[11].operator = 1;
1736 synth->dispatch[12].controller = 4;
1737 synth->dispatch[12].operator = 2;
1738 synth->dispatch[13].controller = 4;
1739 synth->dispatch[13].operator = 3;
1740 synth->dispatch[14].controller = 4;
1741 synth->dispatch[14].operator = 4;
1742 synth->dispatch[14].routine = (synthRoutine) cs80Release;
1743 synth->dispatch[15].controller = 126;
1744 synth->dispatch[15].operator = 28;
1745 /* Sine level */
1746 synth->dispatch[16].controller = 1;
1747 synth->dispatch[16].operator = 2;
1748 synth->dispatch[17].controller = 5;
1749 synth->dispatch[17].operator = 0;
1750 synth->dispatch[18].controller = 5;
1751 synth->dispatch[18].operator = 1;
1752 synth->dispatch[19].controller = 5;
1753 synth->dispatch[19].operator = 2;
1754 synth->dispatch[20].controller = 5;
1755 synth->dispatch[20].operator = 3;
1756 synth->dispatch[20].routine = (synthRoutine) cs80Release;
1757 synth->dispatch[21].controller = 5;
1758 synth->dispatch[21].operator = 4;
1759
1760 /* Brill/Vol */
1761 synth->dispatch[22].controller = 126;
1762 synth->dispatch[22].operator = 11;
1763 synth->dispatch[23].controller = 126;
1764 synth->dispatch[23].operator = 12;
1765 synth->dispatch[24].controller = 126;
1766 synth->dispatch[24].operator = 13;
1767 synth->dispatch[25].controller = 126;
1768 synth->dispatch[25].operator = 14;
1769
1770 synth->dispatch[26].controller = 6;
1771 synth->dispatch[26].operator = 0;
1772 synth->dispatch[27].controller = 126;
1773 synth->dispatch[27].operator = 25;
1774 /* PW */
1775 synth->dispatch[28].controller = 7;
1776 synth->dispatch[28].operator = 5;
1777
1778 /* Sqr/Rmp on off will need shim for level */
1779 synth->dispatch[29].controller = 7;
1780 synth->dispatch[29].operator = 0;
1781 synth->dispatch[29].routine = (synthRoutine) cs80WaveLevel;
1782 synth->dispatch[30].controller = 7;
1783 synth->dispatch[30].operator = 1;
1784 synth->dispatch[30].routine = (synthRoutine) cs80WaveLevel;
1785 synth->dispatch[31].controller = 126;
1786 synth->dispatch[31].operator = 27; /* Noise level */
1787 synth->dispatch[32].controller = 8;
1788 synth->dispatch[32].operator = 0;
1789 synth->dispatch[33].controller = 8;
1790 synth->dispatch[33].operator = 1;
1791 synth->dispatch[33].routine = (synthRoutine) cs80Resonance;
1792 synth->dispatch[34].controller = 9;
1793 synth->dispatch[34].operator = 0;
1794 synth->dispatch[35].controller = 9;
1795 synth->dispatch[35].operator = 1;
1796 synth->dispatch[35].routine = (synthRoutine) cs80Resonance;
1797 synth->dispatch[36].controller = 10;
1798 synth->dispatch[36].operator = 0;
1799 synth->dispatch[37].controller = 10;
1800 synth->dispatch[37].operator = 1;
1801 synth->dispatch[38].controller = 10;
1802 synth->dispatch[38].operator = 2;
1803 synth->dispatch[39].controller = 10;
1804 synth->dispatch[39].operator = 3;
1805 synth->dispatch[40].controller = 10;
1806 synth->dispatch[40].operator = 4;
1807 synth->dispatch[40].routine = (synthRoutine) cs80Release;
1808 synth->dispatch[41].controller = 126;
1809 synth->dispatch[41].operator = 29;
1810 /* CH-II Sine */
1811 synth->dispatch[42].controller = 7;
1812 synth->dispatch[42].operator = 2;
1813 synth->dispatch[43].controller = 11;
1814 synth->dispatch[43].operator = 0;
1815 synth->dispatch[44].controller = 11;
1816 synth->dispatch[44].operator = 1;
1817 synth->dispatch[45].controller = 11;
1818 synth->dispatch[45].operator = 2;
1819 synth->dispatch[46].controller = 11;
1820 synth->dispatch[46].operator = 3;
1821 synth->dispatch[46].routine = (synthRoutine) cs80Release;
1822 synth->dispatch[47].controller = 11;
1823 synth->dispatch[47].operator = 4;
1824
1825 /* Brill/Vol */
1826 synth->dispatch[48].controller = 126;
1827 synth->dispatch[48].operator = 15;
1828 synth->dispatch[49].controller = 126;
1829 synth->dispatch[49].operator = 16;
1830 synth->dispatch[50].controller = 126;
1831 synth->dispatch[50].operator = 17;
1832 synth->dispatch[51].controller = 126;
1833 synth->dispatch[51].operator = 18;
1834 /* Channel-2 detune */
1835 synth->dispatch[52].controller = 126;
1836 synth->dispatch[52].operator = 100;
1837 synth->dispatch[52].routine = (synthRoutine) cs80Detune;
1838 synth->dispatch[53].controller = 126;
1839 synth->dispatch[53].operator = 101;
1840 synth->dispatch[54].controller = 126;
1841 synth->dispatch[54].operator = 101;
1842 synth->dispatch[55].controller = 126;
1843 synth->dispatch[55].operator = 101;
1844 synth->dispatch[56].controller = 126;
1845 synth->dispatch[56].operator = 101;
1846 synth->dispatch[57].controller = 126;
1847 synth->dispatch[57].operator = 101;
1848 /* LFO */
1849 synth->dispatch[58].controller = 126;
1850 synth->dispatch[58].operator = 20;
1851 /* Rate. Add in Key sync as global option if desired */
1852 synth->dispatch[59].controller = 15;
1853 synth->dispatch[59].operator = 0;
1854 synth->dispatch[60].controller = 126;
1855 synth->dispatch[60].operator = 21;
1856 synth->dispatch[61].controller = 126;
1857 synth->dispatch[61].operator = 22;
1858 synth->dispatch[62].controller = 126;
1859 synth->dispatch[62].operator = 23;
1860
1861 /* Osc transpose */
1862 synth->dispatch[63].controller = 1;
1863 synth->dispatch[63].operator = 7;
1864 synth->dispatch[64].controller = 7;
1865 synth->dispatch[64].operator = 7;
1866 synth->dispatch[65].controller = 126;
1867 synth->dispatch[65].operator = 101;
1868 synth->dispatch[66].controller = 126;
1869 synth->dispatch[66].operator = 101;
1870 synth->dispatch[67].controller = 126;
1871 synth->dispatch[67].operator = 101;
1872 synth->dispatch[68].controller = 126;
1873 synth->dispatch[68].operator = 101;
1874
1875 /* Channel level */
1876 synth->dispatch[69].controller = 126;
1877 synth->dispatch[69].operator = 5;
1878
1879 /* Overall brilliance */
1880 synth->dispatch[70].controller = 126;
1881 synth->dispatch[70].operator = 6;
1882 synth->dispatch[71].controller = 126;
1883 synth->dispatch[71].operator = 101;
1884 synth->dispatch[71].routine = (synthRoutine) cs80Resonance;
1885 synth->dispatch[72].controller = 126;
1886 synth->dispatch[72].operator = 101;
1887 synth->dispatch[73].controller = 126;
1888 synth->dispatch[73].operator = 101;
1889 synth->dispatch[74].controller = 126;
1890 synth->dispatch[74].operator = 101;
1891 synth->dispatch[75].controller = 126;
1892 synth->dispatch[75].operator = 101;
1893
1894 /* Key spreading Brill/Level */
1895 synth->dispatch[76].controller = 126;
1896 synth->dispatch[76].operator = 7;
1897 synth->dispatch[77].controller = 126;
1898 synth->dispatch[77].operator = 8;
1899 synth->dispatch[78].controller = 126;
1900 synth->dispatch[78].operator = 9;
1901 synth->dispatch[79].controller = 126;
1902 synth->dispatch[79].operator = 10;
1903
1904 /* 16x CH-I controls starting with Square gain, Tri gain and two brill */
1905 synth->dispatch[80].controller = 1;
1906 synth->dispatch[80].operator = 0;
1907 synth->dispatch[80].routine = (synthRoutine) cs80WaveLevel;
1908 synth->dispatch[81].controller = 1;
1909 synth->dispatch[81].operator = 1;
1910 synth->dispatch[81].routine = (synthRoutine) cs80WaveLevel;
1911 synth->dispatch[82].controller = 1;
1912 synth->dispatch[82].operator = 3;
1913 synth->dispatch[83].controller = 1;
1914 synth->dispatch[83].operator = 4;
1915 synth->dispatch[84].controller = 126;
1916 synth->dispatch[84].operator = 30; /* filter brill */
1917 synth->dispatch[85].controller = 126;
1918 synth->dispatch[85].operator = 3; /* Pan */
1919 synth->dispatch[86].controller = 126;
1920 synth->dispatch[86].operator = 101;
1921 synth->dispatch[87].controller = 126;
1922 synth->dispatch[87].operator = 101;
1923 synth->dispatch[88].controller = 126;
1924 synth->dispatch[88].operator = 101;
1925 synth->dispatch[89].controller = 126;
1926 synth->dispatch[89].operator = 101;
1927 synth->dispatch[90].controller = 126;
1928 synth->dispatch[90].operator = 101;
1929 synth->dispatch[91].controller = 126;
1930 synth->dispatch[91].operator = 101;
1931 synth->dispatch[92].controller = 126;
1932 synth->dispatch[92].operator = 101;
1933 synth->dispatch[93].controller = 126;
1934 synth->dispatch[93].operator = 101;
1935 synth->dispatch[94].controller = 126;
1936 synth->dispatch[94].operator = 101;
1937 synth->dispatch[95].controller = 126;
1938 synth->dispatch[95].operator = 101;
1939
1940 /* 16x CH-II controls starting with Square gain, Tri gain and two brill */
1941 synth->dispatch[96].controller = 7;
1942 synth->dispatch[96].operator = 0;
1943 synth->dispatch[96].routine = (synthRoutine) cs80WaveLevel;
1944 synth->dispatch[97].controller = 7;
1945 synth->dispatch[97].operator = 1;
1946 synth->dispatch[97].routine = (synthRoutine) cs80WaveLevel;
1947 synth->dispatch[98].controller = 7;
1948 synth->dispatch[98].operator = 3;
1949 synth->dispatch[99].controller = 7;
1950 synth->dispatch[99].operator = 4;
1951 synth->dispatch[100].controller = 126;
1952 synth->dispatch[100].operator = 31; /* Filter brill */
1953 synth->dispatch[101].controller = 126;
1954 synth->dispatch[101].operator = 4; /* Pan */
1955 synth->dispatch[102].controller = 126;
1956 synth->dispatch[102].operator = 101;
1957 synth->dispatch[103].controller = 126;
1958 synth->dispatch[103].operator = 101;
1959 synth->dispatch[104].controller = 126;
1960 synth->dispatch[104].operator = 101;
1961 synth->dispatch[105].controller = 126;
1962 synth->dispatch[105].operator = 101;
1963 synth->dispatch[106].controller = 126;
1964 synth->dispatch[106].operator = 101;
1965 synth->dispatch[107].controller = 126;
1966 synth->dispatch[107].operator = 101;
1967 synth->dispatch[108].controller = 126;
1968 synth->dispatch[108].operator = 101;
1969 synth->dispatch[109].controller = 126;
1970 synth->dispatch[109].operator = 101;
1971 synth->dispatch[110].controller = 126;
1972 synth->dispatch[110].operator = 101;
1973 synth->dispatch[111].controller = 126;
1974 synth->dispatch[111].operator = 101;
1975
1976 /* 16x global controls */
1977 synth->dispatch[112].controller = 126;
1978 synth->dispatch[112].operator = 101;
1979 synth->dispatch[112].routine = (synthRoutine) cs80Detune;
1980 synth->dispatch[113].controller = 126;
1981 synth->dispatch[113].operator = 101;
1982 synth->dispatch[114].controller = 126;
1983 synth->dispatch[114].operator = 101;
1984 synth->dispatch[115].controller = 126;
1985 synth->dispatch[115].operator = 101;
1986 synth->dispatch[116].controller = 126;
1987 synth->dispatch[116].operator = 101;
1988 synth->dispatch[117].controller = 126;
1989 synth->dispatch[117].operator = 101;
1990 synth->dispatch[118].controller = 126;
1991 synth->dispatch[118].operator = 101;
1992 synth->dispatch[119].controller = 126;
1993 synth->dispatch[119].operator = 101;
1994 synth->dispatch[120].controller = 126;
1995 synth->dispatch[120].operator = 101;
1996 synth->dispatch[121].controller = 126;
1997 synth->dispatch[121].operator = 101;
1998 synth->dispatch[122].controller = 126;
1999 synth->dispatch[122].operator = 101;
2000 synth->dispatch[123].controller = 126;
2001 synth->dispatch[123].operator = 101;
2002 synth->dispatch[124].controller = 126;
2003 synth->dispatch[124].operator = 101;
2004 synth->dispatch[125].controller = 126;
2005 synth->dispatch[125].operator = 101;
2006 synth->dispatch[126].controller = 126;
2007 synth->dispatch[126].operator = 101;
2008 synth->dispatch[127].controller = 126;
2009 synth->dispatch[127].operator = 101;
2010
2011 /* A few dummies */
2012 synth->dispatch[128].controller = 126;
2013 synth->dispatch[128].operator = 101;
2014 synth->dispatch[129].controller = 126;
2015 synth->dispatch[129].operator = 101;
2016 synth->dispatch[130].controller = 126;
2017 synth->dispatch[130].operator = 101;
2018 synth->dispatch[131].controller = 126;
2019 synth->dispatch[131].operator = 101;
2020 synth->dispatch[132].controller = 126;
2021 synth->dispatch[132].operator = 101;
2022
2023 /* Mods panel */
2024 synth->dispatch[133].controller = 126;
2025 synth->dispatch[133].operator = 101;
2026 synth->dispatch[134].controller = 126;
2027 synth->dispatch[134].operator = 101;
2028 synth->dispatch[134].routine = (synthRoutine) cs80Release;
2029 synth->dispatch[135].controller = 126;
2030 synth->dispatch[135].operator = 101;
2031 synth->dispatch[136].controller = 126;
2032 synth->dispatch[136].operator = 101;
2033 synth->dispatch[137].controller = 126;
2034 synth->dispatch[137].operator = 101;
2035 synth->dispatch[138].controller = 126;
2036 synth->dispatch[138].operator = 101;
2037 synth->dispatch[139].controller = 126;
2038 synth->dispatch[139].operator = 101;
2039 synth->dispatch[140].controller = 126;
2040 synth->dispatch[140].operator = 101;
2041 synth->dispatch[141].controller = 126;
2042 synth->dispatch[141].operator = 101;
2043 synth->dispatch[142].controller = 126;
2044 synth->dispatch[142].operator = 101;
2045 synth->dispatch[143].controller = 126;
2046 synth->dispatch[143].operator = 101;
2047 synth->dispatch[144].controller = 126;
2048 synth->dispatch[144].operator = 101;
2049
2050 /* Global tune and gain */
2051 synth->dispatch[145].controller = 126;
2052 synth->dispatch[145].operator = 1;
2053 synth->dispatch[146].controller = 126;
2054 synth->dispatch[146].operator = 2;
2055
2056 synth->dispatch[147].controller = CS_UB;
2057 synth->dispatch[147].operator = 0;
2058 synth->dispatch[147].routine = (synthRoutine) cs80Memory;
2059 synth->dispatch[148].controller = CS_UB;
2060 synth->dispatch[148].operator = 1;
2061 synth->dispatch[148].routine = (synthRoutine) cs80Memory;
2062 synth->dispatch[149].controller = CS_UB;
2063 synth->dispatch[149].operator = 2;
2064 synth->dispatch[149].routine = (synthRoutine) cs80Memory;
2065 synth->dispatch[150].controller = CS_UB;
2066 synth->dispatch[150].operator = 3;
2067 synth->dispatch[150].routine = (synthRoutine) cs80Memory;
2068
2069 synth->dispatch[151].controller = CS_UP;
2070 synth->dispatch[151].operator = 0;
2071 synth->dispatch[151].routine = (synthRoutine) cs80Memory;
2072 synth->dispatch[152].controller = CS_UP;
2073 synth->dispatch[152].operator = 1;
2074 synth->dispatch[152].routine = (synthRoutine) cs80Memory;
2075 synth->dispatch[153].controller = CS_UP;
2076 synth->dispatch[153].operator = 2;
2077 synth->dispatch[153].routine = (synthRoutine) cs80Memory;
2078 synth->dispatch[154].controller = CS_UP;
2079 synth->dispatch[154].operator = 3;
2080 synth->dispatch[154].routine = (synthRoutine) cs80Memory;
2081 synth->dispatch[155].controller = CS_UP;
2082 synth->dispatch[155].operator = 4;
2083 synth->dispatch[155].routine = (synthRoutine) cs80Memory;
2084 synth->dispatch[156].controller = CS_UP;
2085 synth->dispatch[156].operator = 5;
2086 synth->dispatch[156].routine = (synthRoutine) cs80Memory;
2087 synth->dispatch[157].controller = CS_UP;
2088 synth->dispatch[157].operator = 6;
2089 synth->dispatch[157].routine = (synthRoutine) cs80Memory;
2090 synth->dispatch[158].controller = CS_UP;
2091 synth->dispatch[158].operator = 7;
2092 synth->dispatch[158].routine = (synthRoutine) cs80Memory;
2093 synth->dispatch[159].controller = CS_UP;
2094 synth->dispatch[159].operator = 8;
2095 synth->dispatch[159].routine = (synthRoutine) cs80Memory;
2096 synth->dispatch[160].controller = CS_UP;
2097 synth->dispatch[160].operator = 9;
2098 synth->dispatch[160].routine = (synthRoutine) cs80Memory;
2099 synth->dispatch[161].controller = CS_LOAD;
2100 synth->dispatch[161].operator = 0;
2101 synth->dispatch[161].routine = (synthRoutine) cs80Memory;
2102
2103 synth->dispatch[163].controller = CS_LB;
2104 synth->dispatch[163].operator = 0;
2105 synth->dispatch[163].routine = (synthRoutine) cs80Memory;
2106 synth->dispatch[164].controller = CS_LB;
2107 synth->dispatch[164].operator = 1;
2108 synth->dispatch[164].routine = (synthRoutine) cs80Memory;
2109 synth->dispatch[165].controller = CS_LB;
2110 synth->dispatch[165].operator = 2;
2111 synth->dispatch[165].routine = (synthRoutine) cs80Memory;
2112 synth->dispatch[166].controller = CS_LB;
2113 synth->dispatch[166].operator = 3;
2114 synth->dispatch[166].routine = (synthRoutine) cs80Memory;
2115
2116 synth->dispatch[167].controller = CS_LP;
2117 synth->dispatch[167].operator = 0;
2118 synth->dispatch[167].routine = (synthRoutine) cs80Memory;
2119 synth->dispatch[168].controller = CS_LP;
2120 synth->dispatch[168].operator = 1;
2121 synth->dispatch[168].routine = (synthRoutine) cs80Memory;
2122 synth->dispatch[169].controller = CS_LP;
2123 synth->dispatch[169].operator = 2;
2124 synth->dispatch[169].routine = (synthRoutine) cs80Memory;
2125 synth->dispatch[170].controller = CS_LP;
2126 synth->dispatch[170].operator = 3;
2127 synth->dispatch[170].routine = (synthRoutine) cs80Memory;
2128 synth->dispatch[171].controller = CS_LP;
2129 synth->dispatch[171].operator = 4;
2130 synth->dispatch[171].routine = (synthRoutine) cs80Memory;
2131 synth->dispatch[172].controller = CS_LP;
2132 synth->dispatch[172].operator = 5;
2133 synth->dispatch[172].routine = (synthRoutine) cs80Memory;
2134 synth->dispatch[173].controller = CS_LP;
2135 synth->dispatch[173].operator = 6;
2136 synth->dispatch[173].routine = (synthRoutine) cs80Memory;
2137 synth->dispatch[174].controller = CS_LP;
2138 synth->dispatch[174].operator = 7;
2139 synth->dispatch[174].routine = (synthRoutine) cs80Memory;
2140 synth->dispatch[175].controller = CS_LP;
2141 synth->dispatch[175].operator = 8;
2142 synth->dispatch[175].routine = (synthRoutine) cs80Memory;
2143 synth->dispatch[176].controller = CS_LP;
2144 synth->dispatch[176].operator = 9;
2145 synth->dispatch[176].routine = (synthRoutine) cs80Memory;
2146
2147 synth->dispatch[177].controller = CS_SAVE;
2148 synth->dispatch[177].operator = 0;
2149 synth->dispatch[177].routine = (synthRoutine) cs80Memory;
2150
2151 synth->dispatch[178].controller = 126;
2152 synth->dispatch[178].operator = 101;
2153
2154 synth->dispatch[179].routine = (synthRoutine) cs80Pitchbend;
2155
2156 /* Tune CH-1 */
2157 bristolMidiSendMsg(global.controlfd, synth->sid, 1, 6, CONTROLLER_RANGE/2);
2158 bristolMidiSendMsg(global.controlfd, synth->sid, 7, 6, CONTROLLER_RANGE/2);
2159 /* PWM LFO Key Sync */
2160 bristolMidiSendMsg(global.controlfd, synth->sid, 0, 1, 1);
2161 bristolMidiSendMsg(global.controlfd, synth->sid, 6, 1, 1);
2162 /* No touch on Filter env, HP filt, mods */
2163 bristolMidiSendMsg(global.controlfd, synth->sid, 4, 5, 0);
2164 bristolMidiSendMsg(global.controlfd, synth->sid, 10, 5, 0);
2165 bristolMidiSendMsg(global.controlfd, synth->sid, 2, 6, 2);
2166 bristolMidiSendMsg(global.controlfd, synth->sid, 3, 6, 0);
2167 bristolMidiSendMsg(global.controlfd, synth->sid, 8, 6, 2);
2168 bristolMidiSendMsg(global.controlfd, synth->sid, 9, 6, 0);
2169 bristolMidiSendMsg(global.controlfd, synth->sid, 2, 2, C_RANGE_MIN_1);
2170 bristolMidiSendMsg(global.controlfd, synth->sid, 3, 2, C_RANGE_MIN_1);
2171 bristolMidiSendMsg(global.controlfd, synth->sid, 8, 2, C_RANGE_MIN_1);
2172 bristolMidiSendMsg(global.controlfd, synth->sid, 9, 2, C_RANGE_MIN_1);
2173 /* Noise gain */
2174 bristolMidiSendMsg(global.controlfd, synth->sid, 15, 0, 8192);
2175
2176 return(0);
2177 }
2178
2179 /*
2180 * This will be called to make any routine specific parameters available.
2181 */
2182 static int
cs80Configure(brightonWindow * win)2183 cs80Configure(brightonWindow *win)
2184 {
2185 guiSynth *synth = findSynth(global.synths, win);
2186 brightonEvent event;
2187
2188 if (synth == 0)
2189 {
2190 printf("problems going operational\n");
2191 return(-1);
2192 }
2193
2194 if (synth->flags & OPERATIONAL)
2195 return(0);
2196
2197 printf("going operational\n");
2198
2199 synth->keypanel = KEY_PANEL;
2200
2201 if (synth->location == 0)
2202 {
2203 synth->bank = 10;
2204 synth->location = 1;
2205 } else if (synth->location > 0) {
2206 if ((mw = synth->location / 10) == 0)
2207 synth->bank = 10;
2208 else {
2209 synth->bank = mw % 10;
2210 mw -= synth->bank;
2211 mw *= 10;
2212 synth->bank *= 10;
2213 }
2214 if ((synth->location = (synth->location % 10)) == 0)
2215 synth->location = 1;
2216 }
2217
2218 if (cs80Debug(synth, 2))
2219 printf("weight %i, bank %i, mem %i\n", mw, synth->bank,synth->location);
2220
2221 configureGlobals(synth);
2222
2223 synth->keypanel2 = -1;
2224 synth->transpose = 24;
2225
2226 synth->flags |= OPERATIONAL;
2227
2228 dc1 = brightonGetDCTimer(win->dcTimeout);
2229
2230 /*
2231 * Hm. This is a hack for a few bits of bad rendering of a keyboard. Only
2232 * occurs on first paint, so we suppress the first paint, and then request
2233 * an expose here.
2234 */
2235 event.type = BRIGHTON_EXPOSE;
2236 event.intvalue = 1;
2237 brightonParamChange(synth->win, KEY_PANEL, -1, &event);
2238 brightonParamChange(synth->win, KEY_PANEL + 2, -1, &event);
2239
2240 /* Push some radio buttons to set their starting point */
2241 event.value = 1.0;
2242 synth->dispatch[RADIO_UB].other1 = RADIO_UB;
2243 synth->dispatch[RADIO_LB].other1 = RADIO_LB;
2244 synth->dispatch[RADIO_UP].other1 = RADIO_UP;
2245 synth->dispatch[RADIO_LP].other1 = RADIO_LP;
2246 brightonParamChange(synth->win, 1, RADIO_UB, &event);
2247 brightonParamChange(synth->win, 1, RADIO_LB, &event);
2248 brightonParamChange(synth->win, 1, RADIO_UP, &event);
2249 brightonParamChange(synth->win, 1, RADIO_LP, &event);
2250
2251 brightonPut(win,
2252 "bitmaps/blueprints/cs80shade.xpm", 0, 0, win->width, win->height);
2253 width = win->width;
2254
2255 /* Then set some defaults for volume, balance and tuning */
2256 event.type = BRIGHTON_FLOAT;
2257 event.value = 0.9;
2258 brightonParamChange(synth->win, 1, 146, &event);
2259 event.value = 0.5;
2260 brightonParamChange(synth->win, 1, 145, &event);
2261 event.value = 1.0; /* On/Off switch for Opts panel */
2262 brightonParamChange(synth->win, 4, 0, &event);
2263
2264 /* Then set the load button twice to get a memory loaded */
2265 cs80MemoryLoad(synth, 0, 0, 0);
2266
2267 if (cs80Debug(synth, 3))
2268 printf("dct = %i\n", win->dcTimeout);
2269
2270 return(0);
2271 }
2272
2273