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 #include <fcntl.h>
24
25 #include "brighton.h"
26 #include "brightonMini.h"
27 #include "brightoninternals.h"
28
29 static int voxM2Init();
30 static int voxM2Configure();
31 static int voxM2Callback(brightonWindow *, int, int, float);
32 static int midiCallback(brightonWindow *, int, int, float);
33
34 extern guimain global;
35
36 #include "brightonKeys.h"
37
38 static guimain manual;
39 static int dc;
40
41 #define MOD_PANEL 0
42 #define OPTS_PANEL 1
43 #define KEY_PANEL 2
44 #define VARS_PANEL 4
45 #define KEY_PANEL2 (KEY_PANEL + 1)
46
47 #define FIRST_DEV 0
48
49 #define MOD_COUNT 44
50 #define DUMMY_OFFSET 26
51 #define OPTS_COUNT 4
52 #define VARS_COUNT 11
53
54 #define MOD_START 0
55 #define OPTS_START MOD_COUNT
56 #define MEM_START (MOD_COUNT - 7)
57
58 #define ACTIVE_DEVS (MOD_COUNT - 7)
59 #define DEVICE_COUNT (MOD_COUNT + OPTS_COUNT)
60 #define DISPLAY_DEV (DEVICE_COUNT - 1)
61 #define MEM_MGT ACTIVE_DEVS
62
63 #define MIDI_MGT (MEM_MGT + 12)
64
65
66 /*
67 * This structure is for device definition. The structure is defined in
68 * include/brighton.h, further definitions in brighton/brightonDevtable.h and
69 * include/brightoninternals.h
70 *
71 * typedef int (*brightonCallback)(int, float);
72 * typedef struct BrightonLocations {
73 * int device; 0=rotary, 1=scale, etc.
74 * float relx, rely; relative position with regards to 1000 by 1000 window
75 * float relw, relh; relative height.
76 * int from, to;
77 * brightonCallback callback; specific to this dev
78 * char *image; bitmap. If zero take a device default.
79 * int flags;
80 * } brightonLocations;
81 *
82 * This example is for a voxM2Bristol type synth interface.
83 */
84
85 #define R1 230
86
87 #define W1 20
88 #define L1 850
89 #define L2 300
90
91 #define D1 25
92 #define D2 20
93
94 /* 2 + 4+2 + 5+2 */
95 #define C1 240
96 #define C2 (C1 + D1)
97
98 #define C3 340
99 #define C4 (C3 + D1)
100 #define C5 (C4 + D1)
101 #define C6 (C5 + D1)
102 #define C7 (C6 + D1 + 20)
103 #define C8 (C7 + D1)
104
105 #define C9 570
106 #define C10 (C9 + D1)
107 #define C11 (C10 + D1)
108 #define C12 (C11 + D1)
109 #define C13 (C12 + D1)
110 #define C14 (C13 + D1 + 20)
111 #define C15 (C14 + D1)
112
113 #define C16 835
114 #define C17 (C16 + D2)
115 #define C18 (C17 + D2)
116 #define C19 (C18 + D2)
117
118 #define C20 40
119 #define C21 (C20 + D2)
120 #define C22 (C21 + D2)
121 #define C23 (C22 + D2)
122 #define C24 (C23 + D2)
123 #define C25 (C24 + D2)
124 #define C26 (C25 + D2)
125
126 static brightonLocations locations[MOD_COUNT] = {
127 /* 0 - Drawbars, lower, upper then bass */
128 {"Lower 8'", 1, C3, R1, W1, L1, 0, 8, 0,
129 "bitmaps/knobs/hammondwhite.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
130 {"Lower 4'", 1, C4, R1, W1, L1, 0, 8, 0,
131 "bitmaps/knobs/hammondwhite.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
132 {"Lower 2'", 1, C5, R1, W1, L1, 0, 8, 0,
133 "bitmaps/knobs/hammondwhite.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
134 {"Lower IV'", 1, C6, R1, W1, L1, 0, 8, 0,
135 "bitmaps/knobs/hammondwhite.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
136 {"Lower Flute", 1, C7, R1, W1, L1, 0, 8, 0,
137 "bitmaps/knobs/hammondbrown.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
138 {"Lower Reed", 1, C8, R1, W1, L1, 0, 8, 0,
139 "bitmaps/knobs/hammondbrown.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
140 {"Upper 16'", 1, C9, R1, W1, L1, 0, 8, 0,
141 "bitmaps/knobs/hammondwhite.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
142 {"Upper 8'", 1, C10, R1, W1, L1, 0, 8, 0,
143 "bitmaps/knobs/hammondwhite.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
144 {"Upper 4'", 1, C11, R1, W1, L1, 0, 8, 0,
145 "bitmaps/knobs/hammondwhite.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
146 {"Upper II'", 1, C12, R1, W1, L1, 0, 8, 0,
147 "bitmaps/knobs/hammondwhite.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
148 {"Upper III'", 1, C13, R1, W1, L1, 0, 8, 0,
149 "bitmaps/knobs/hammondwhite.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
150 {"Upper Flute", 1, C14, R1, W1, L1, 0, 8, 0,
151 "bitmaps/knobs/hammondbrown.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
152 {"Upper Reed", 1, C15, R1, W1, L1, 0, 8, 0,
153 "bitmaps/knobs/hammondbrown.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
154 {"Bass Flute", 1, C1, R1, W1, L1, 0, 8, 0,
155 "bitmaps/knobs/hammondbrown.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
156 {"Bass Reed", 1, C2, R1, W1, L1, 0, 8, 0,
157 "bitmaps/knobs/hammondbrown.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
158
159 /* 15 - Percussive buttons, 4 of them */
160 {"Perc-I", 2, C16, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushout.xpm",
161 "bitmaps/buttons/pushin.xpm", 0},
162 {"Perc-II", 2, C17, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushout.xpm",
163 "bitmaps/buttons/pushin.xpm", 0},
164 {"Perc-L", 2, C18, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
165 "bitmaps/buttons/pushinw.xpm", 0},
166 {"Perc-S", 2, C19, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
167 "bitmaps/buttons/pushinw.xpm", 0},
168
169 /* 19 - Dummies, 12 in total for opts and vars */
170 {"", 2, C16, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushout.xpm",
171 "bitmaps/buttons/pushin.xpm", BRIGHTON_WITHDRAWN},
172 {"", 2, C17, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushout.xpm",
173 "bitmaps/buttons/pushin.xpm", BRIGHTON_WITHDRAWN},
174 {"", 2, C18, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
175 "bitmaps/buttons/pushinw.xpm", BRIGHTON_WITHDRAWN},
176 {"", 2, C19, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
177 "bitmaps/buttons/pushinw.xpm", BRIGHTON_WITHDRAWN},
178 {"", 2, C19, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
179 "bitmaps/buttons/pushinw.xpm", BRIGHTON_WITHDRAWN},
180 {"", 2, C16, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushout.xpm",
181 "bitmaps/buttons/pushin.xpm", BRIGHTON_WITHDRAWN},
182 {"", 2, C17, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushout.xpm",
183 "bitmaps/buttons/pushin.xpm", BRIGHTON_WITHDRAWN},
184 {"", 2, C18, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
185 "bitmaps/buttons/pushinw.xpm", BRIGHTON_WITHDRAWN},
186 {"", 2, C19, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
187 "bitmaps/buttons/pushinw.xpm", BRIGHTON_WITHDRAWN},
188 {"", 2, C19, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
189 "bitmaps/buttons/pushinw.xpm", BRIGHTON_WITHDRAWN},
190 {"", 2, C16, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushout.xpm",
191 "bitmaps/buttons/pushin.xpm", BRIGHTON_WITHDRAWN},
192 {"", 2, C17, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushout.xpm",
193 "bitmaps/buttons/pushin.xpm", BRIGHTON_WITHDRAWN},
194 /*
195 * Dummies, 6. Note that the first set, above, are used to save the Opts
196 * controls for Bass register/sustain and vibrato so to maintain the
197 * memories between releases they should remain reserved, the rest are
198 * used as placeholders for the VARS panel. The following six remain free
199 * however they may become reverb depth and level.
200 * 31 - 36
201 */
202 {"", 2, C18, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
203 "bitmaps/buttons/pushinw.xpm", BRIGHTON_WITHDRAWN},
204 {"", 2, C19, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
205 "bitmaps/buttons/pushinw.xpm", BRIGHTON_WITHDRAWN},
206 {"", 2, C18, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
207 "bitmaps/buttons/pushinw.xpm", BRIGHTON_WITHDRAWN},
208 {"", 2, C19, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
209 "bitmaps/buttons/pushinw.xpm", BRIGHTON_WITHDRAWN},
210 {"", 2, C18, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
211 "bitmaps/buttons/pushinw.xpm", BRIGHTON_WITHDRAWN},
212 {"", 2, C19, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
213 "bitmaps/buttons/pushinw.xpm", BRIGHTON_WITHDRAWN},
214
215 /* Memory buttons, 7 buttons for 6 locations and save */
216 {"", 2, C20, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
217 "bitmaps/buttons/pushinw.xpm", 0},
218 {"", 2, C21, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
219 "bitmaps/buttons/pushinw.xpm", 0},
220 {"", 2, C22, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
221 "bitmaps/buttons/pushinw.xpm", 0},
222 {"", 2, C23, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
223 "bitmaps/buttons/pushinw.xpm", 0},
224 {"", 2, C24, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
225 "bitmaps/buttons/pushinw.xpm", 0},
226 {"", 2, C25, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushoutw.xpm",
227 "bitmaps/buttons/pushinw.xpm", 0},
228 {"", 2, C26, R1, W1, L2, 0, 1, 0, "bitmaps/buttons/pushout.xpm",
229 "bitmaps/buttons/pushin.xpm", BRIGHTON_CHECKBUTTON},
230 };
231
232 static brightonLocations options[OPTS_COUNT] = {
233 {"", 2, 420, 300, 100, 300, 0, 1, 0, "bitmaps/buttons/rockersmoothBW.xpm",
234 "bitmaps/buttons/rockersmoothBWd.xpm", 0},
235 {"", 0, 600, 300, 250, 250, 0, 1, 0, 0, 0, 0},
236 {"", 2, 850, 300, 100, 300, 0, 1, 0, "bitmaps/buttons/rockersmoothBW.xpm",
237 "bitmaps/buttons/rockersmoothBWd.xpm", 0},
238 {"", 2, 100, 300, 170, 300, 0, 1, 0, "bitmaps/buttons/rockersmoothBWR.xpm",
239 "bitmaps/buttons/rockersmoothBWRd.xpm", 0},
240 };
241
242 static brightonLocations variables[VARS_COUNT] = {
243 {"", 0, 35, 280, 100, 400, 0, 1, 0, 0, 0, BRIGHTON_NOSHADOW},
244 {"", 0, 110, 280, 100, 400, 0, 1, 0, 0, 0, BRIGHTON_NOSHADOW},
245 {"", 0, 185, 280, 100, 400, 0, 1, 0, 0, 0, BRIGHTON_NOSHADOW},
246 {"", 2, 270, 280, 25, 400, 0, 1, 0, "bitmaps/buttons/rockersmoothBW.xpm",
247 "bitmaps/buttons/rockersmoothBWd.xpm", 0},
248 {"", 0, 335, 280, 100, 400, 0, 1, 0, 0, 0, BRIGHTON_NOSHADOW},
249 {"", 0, 410, 280, 100, 400, 0, 1, 0, 0, 0, BRIGHTON_NOSHADOW},
250 {"", 0, 485, 280, 100, 400, 0, 1, 0, 0, 0, BRIGHTON_NOSHADOW},
251 {"", 0, 560, 280, 100, 400, 0, 1, 0, 0, 0, BRIGHTON_NOSHADOW},
252 /* Reverb params - 3 */
253 {"", 0, 635, 280, 100, 400, 0, 1, 0, 0, 0, BRIGHTON_NOSHADOW|BRIGHTON_WITHDRAWN},
254 {"", 0, 710, 280, 100, 400, 0, 1, 0, 0, 0, BRIGHTON_NOSHADOW|BRIGHTON_WITHDRAWN},
255 {"", 0, 775, 280, 100, 400, 0, 1, 0, 0, 0, BRIGHTON_NOSHADOW|BRIGHTON_WITHDRAWN},
256 };
257
258 static void
memFix(brightonWindow * win,guiSynth * synth)259 memFix(brightonWindow* win, guiSynth *synth)
260 {
261 brightonEvent event;
262 int i;
263
264 event.command = BRIGHTON_PARAMCHANGE;
265 event.type = BRIGHTON_FLOAT;
266
267 for (i = 0; i < 19; i++)
268 {
269 event.value = synth->mem.param[i];
270 brightonParamChange(synth->win, 0, i, &event);
271 }
272
273 /* MODS */
274 event.value = synth->mem.param[19 + 0];
275 brightonParamChange(synth->win, OPTS_PANEL, 0, &event);
276 event.value = synth->mem.param[19 + 1];
277 brightonParamChange(synth->win, OPTS_PANEL, 1, &event);
278 event.value = synth->mem.param[19 + 2];
279 brightonParamChange(synth->win, OPTS_PANEL, 2, &event);
280 /* VARS */
281 event.value = synth->mem.param[23 + 0];
282 brightonParamChange(synth->win, VARS_PANEL, 0, &event);
283 event.value = synth->mem.param[23 + 1];
284 brightonParamChange(synth->win, VARS_PANEL, 1, &event);
285 event.value = synth->mem.param[23 + 2];
286 brightonParamChange(synth->win, VARS_PANEL, 2, &event);
287 event.value = synth->mem.param[23 + 3];
288 brightonParamChange(synth->win, VARS_PANEL, 3, &event);
289 event.value = synth->mem.param[23 + 4];
290 brightonParamChange(synth->win, VARS_PANEL, 4, &event);
291 event.value = synth->mem.param[23 + 5];
292 brightonParamChange(synth->win, VARS_PANEL, 5, &event);
293 event.value = synth->mem.param[23 + 6];
294 brightonParamChange(synth->win, VARS_PANEL, 6, &event);
295 event.value = synth->mem.param[23 + 7];
296 brightonParamChange(synth->win, VARS_PANEL, 7, &event);
297 }
298
299 static int
memCallback(brightonWindow * win,int panel,int index,float value)300 memCallback(brightonWindow* win, int panel, int index, float value)
301 {
302 guiSynth *synth = findSynth(global.synths, win);
303
304 if (synth->flags & SUPPRESS)
305 return(0);
306
307 /*
308 * The first ten buttons are exclusive highlighting, we use the first mem
309 * pointer to handle this.
310 */
311 if (synth->dispatch[MEM_START].other2)
312 {
313 synth->dispatch[MEM_START].other2 = 0;
314 return(0);
315 }
316
317 /* Is this the save key, double clicked? */
318 if (index == MOD_COUNT - 1)
319 {
320 if (brightonDoubleClick(dc)) {
321 synth->location = synth->dispatch[MEM_START].other1 - MEM_START;
322 saveMemory(synth, "voxM2", 0, synth->bank + synth->location, 0);
323 }
324 return(0);
325 }
326
327 /*
328 * Is this one of the presets?
329 *
330 * We should consider making these require a doubleclick also.
331 */
332 if (index >= MEM_START)
333 {
334 brightonEvent event;
335
336 event.command = BRIGHTON_PARAMCHANGE;
337 event.type = BRIGHTON_FLOAT;
338 event.value = 0;
339
340 /*
341 * This is a numeric. We need to force exclusion.
342 */
343 if (synth->dispatch[MEM_START].other1 != -1)
344 {
345 synth->dispatch[MEM_START].other2 = 1;
346
347 if (synth->dispatch[MEM_START].other1 != index)
348 event.value = 0;
349 else
350 event.value = 1;
351
352 brightonParamChange(synth->win, panel,
353 synth->dispatch[MEM_START].other1, &event);
354 }
355
356 synth->location = index - MEM_START;
357
358 loadMemory(synth, "voxM2", 0, synth->bank + synth->location,
359 synth->mem.active, 0, BRISTOL_NOCALLS);
360
361 memFix(win, synth);
362
363 synth->dispatch[MEM_START].other1 = index;
364 }
365
366 return(0);
367 }
368
369 int
voxloadMemory(guiSynth * synth,char * algo,char * name,int location,int active,int skip,int flags)370 voxloadMemory(guiSynth *synth, char *algo, char *name, int location,
371 int active, int skip, int flags)
372 {
373 loadMemory(synth, "voxM2", 0, location,
374 synth->mem.active, 0, BRISTOL_NOCALLS);
375
376 memFix(synth->win, synth);
377
378 return(0);
379 }
380
381 int
voxPedalCallback(brightonWindow * win,int panel,int index,float value)382 voxPedalCallback(brightonWindow *win, int panel, int index, float value)
383 {
384 guiSynth *synth = findSynth(global.synths, win);
385
386 if ((synth->flags & OPERATIONAL) == 0)
387 return(0);
388
389 /*
390 * Want to send a note event, on or off, for this index + transpose.
391 */
392 if (value > 0)
393 bristolMidiSendMsg(global.controlfd, synth->midichannel,
394 BRISTOL_EVENT_KEYON, 0, index + 24);
395 else
396 bristolMidiSendMsg(global.controlfd, synth->midichannel,
397 BRISTOL_EVENT_KEYOFF, 0, index + 24);
398
399 return(0);
400 }
401
402 int
voxkeyCallback(brightonWindow * win,int panel,int index,float value)403 voxkeyCallback(brightonWindow *win, int panel, int index, float value)
404 {
405 guiSynth *synth = findSynth(global.synths, win);
406 int chan = 0, transp = 0;
407
408 if (global.libtest)
409 return(0);
410
411 if (panel == KEY_PANEL2)
412 {
413 transp = 12;
414 chan = 1;
415 }
416
417 /*printf("keycallback(%x, %i, %i, %f): %i %i\n", synth, panel, index, value, */
418 /* synth->transpose, global.controlfd); */
419
420 /*
421 * Want to send a note event, on or off, for this index + transpose.
422 */
423 if (value)
424 bristolMidiSendMsg(global.controlfd, synth->midichannel + chan,
425 BRISTOL_EVENT_KEYON, 0, index + synth->transpose + transp);
426 else
427 bristolMidiSendMsg(global.controlfd, synth->midichannel + chan,
428 BRISTOL_EVENT_KEYOFF, 0, index + synth->transpose + transp);
429
430 return(0);
431 }
432
433 /*
434 * This is a set of globals for the main window rendering. Again taken from
435 * include/brighton.h
436 */
437 brightonApp voxM2App = {
438 "voxM2",
439 0, /* no blueprint on wood background. */
440 "bitmaps/textures/leather.xpm",
441 0,
442 voxM2Init,
443 voxM2Configure, /* 3 callbacks */
444 midiCallback,
445 destroySynth,
446 {-1, 0, 2, 2, 5, 520, 0, 0},
447 520, 310, 0, 0,
448 9, /* panel count */
449 {
450 {
451 "Drawbars", /* and percussive selections */
452 "bitmaps/blueprints/voxm2.xpm",
453 0,
454 BRIGHTON_STRETCH,
455 0,
456 0,
457 voxM2Callback,
458 19, 184, 970, 190,
459 MOD_COUNT,
460 locations
461 },
462 {
463 "Mods", /* Bass sustain, vibrato on/off */
464 "bitmaps/blueprints/voxM2.xpm",
465 "bitmaps/textures/leather.xpm",
466 0,
467 0,
468 0,
469 voxM2Callback,
470 19, 386, 194, 210,
471 OPTS_COUNT,
472 options
473 },
474 {
475 "Keyboard",
476 0,
477 "bitmaps/keys/vkbg.xpm",
478 0x020|BRIGHTON_STRETCH,
479 0,
480 0,
481 voxkeyCallback,
482 55, 612, 710, 210,
483 VKEY_COUNT,
484 vkeys
485 },
486 {
487 "Keyboard",
488 0,
489 "bitmaps/keys/vkbg.xpm",
490 0x020|BRIGHTON_STRETCH,
491 0,
492 0,
493 voxkeyCallback,
494 224, 386, 730, 210,
495 VKEY_COUNT,
496 vkeys
497 },
498 {
499 "Variables",
500 "bitmaps/blueprints/voxM2vars.xpm",
501 "bitmaps/textures/leather.xpm",
502 0, /* flags */
503 0,
504 0,
505 voxM2Callback,
506 16, 24, 970, 160,
507 VARS_COUNT,
508 variables
509 },
510 {
511 "Top Panel",
512 0,
513 "bitmaps/textures/orangeleather.xpm",
514 0, /* flags */
515 0,
516 0,
517 0,
518 16, 24, 970, 160,
519 0,
520 0
521 },
522 {
523 "Pedalboard",
524 0,
525 "bitmaps/keys/vkbg.xpm",
526 BRIGHTON_STRETCH, /* flags */
527 0,
528 0,
529 voxPedalCallback,
530 250, 850, 500, 150,
531 12, /* KEY_COUNT_PEDAL, */
532 pedalBoard
533 },
534 {
535 /* Underneath keyboards */
536 "Bottom Panel",
537 0,
538 "bitmaps/textures/metal6.xpm",
539 BRIGHTON_STRETCH|BRIGHTON_REVERSE, /* flags */
540 0,
541 0,
542 0,
543 16, 386, 966, 440,
544 0,
545 0
546 },
547 {
548 "Pedalboard",
549 0,
550 "bitmaps/keys/vkbg.xpm",
551 BRIGHTON_STRETCH, /* flags */
552 0,
553 0,
554 0,
555 0, 850, 1000, 150,
556 0,
557 0
558 },
559 },
560 };
561
562 static int shade_id = 0;
563
564 static void
panelSwitch(guiSynth * id,int fd,int chan,int cont,int op,int value)565 panelSwitch(guiSynth *id, int fd, int chan, int cont, int op, int value)
566 {
567 brightonEvent event;
568
569 /*
570 * If the sendvalue is zero, then withdraw the opts window, draw the
571 * slider window, and vice versa.
572 */
573 if (value == 0)
574 {
575 brightonRemove(id->win, shade_id);
576
577 event.type = BRIGHTON_EXPOSE;
578 event.intvalue = 0;
579 brightonParamChange(id->win, 5, -1, &event);
580 event.intvalue = 1;
581 brightonParamChange(id->win, 4, -1, &event);
582
583 shade_id = brightonPut(id->win, "bitmaps/blueprints/voxshade.xpm", 0, 0,
584 id->win->width, id->win->height);
585 } else {
586 brightonRemove(id->win, shade_id);
587
588 event.type = BRIGHTON_EXPOSE;
589 event.intvalue = 0;
590 brightonParamChange(id->win, 4, -1, &event);
591 event.intvalue = 1;
592 brightonParamChange(id->win, 5, -1, &event);
593
594 shade_id = brightonPut(id->win, "bitmaps/blueprints/voxshade.xpm", 0, 0,
595 id->win->width, id->win->height);
596 }
597 }
598
599 static int
midiCallback(brightonWindow * win,int controller,int value,float n)600 midiCallback(brightonWindow *win, int controller, int value, float n)
601 {
602 guiSynth *synth = findSynth(global.synths, win);
603
604 /* printf("midi callback: %x, %i\n", controller, value); */
605
606 switch(controller)
607 {
608 case MIDI_PROGRAM:
609 printf("midi program: %x, %i\n", controller, value);
610 synth->location = value;
611 loadMemory(synth, synth->resources->name, 0, synth->bank
612 + synth->location,
613 synth->mem.active, FIRST_DEV, BRISTOL_NOCALLS);
614
615 memFix(win, synth);
616
617 break;
618 case MIDI_BANK_SELECT:
619 printf("midi banksel: %x, %i\n", controller, value);
620 synth->bank = value * 10;
621 break;
622 }
623 return(0);
624 }
625
626 static int
voxM2MidiSendMsg(void * synth,int fd,int chan,int c,int o,int v)627 voxM2MidiSendMsg(void *synth, int fd, int chan, int c, int o, int v)
628 {
629 /* printf("%i, %i, %i\n", c, o, v); */
630 bristolMidiSendMsg(fd, chan, c, o, v);
631 return(0);
632 }
633
634 /*
635 * For the sake of ease of use, links have been placed here to be called
636 * by any of the devices created. They would be better in some other file,
637 * perhaps with this as a dispatch.
638 *
639 * Param refers to the device index in the locations table given below.
640 */
641 static int
voxM2Callback(brightonWindow * win,int panel,int index,float value)642 voxM2Callback(brightonWindow *win, int panel, int index, float value)
643 {
644 guiSynth *synth = findSynth(global.synths, win);
645 int sendvalue;
646
647 if (synth == 0)
648 return(0);
649
650 if ((index >= DEVICE_COUNT) || ((synth->flags & OPERATIONAL) == 0))
651 return(0);
652
653 if (voxM2App.resources[panel].devlocn[index].to == 1)
654 sendvalue = value * C_RANGE_MIN_1;
655 else
656 sendvalue = value;
657
658 if (panel == OPTS_PANEL)
659 index += 19;
660
661 if (index == 22)
662 {
663 synth->dispatch[index].routine(synth,
664 global.controlfd, synth->sid,
665 synth->dispatch[index].controller,
666 synth->dispatch[index].operator,
667 sendvalue);
668 return(0);
669 }
670
671 if (panel == VARS_PANEL)
672 index += 23;
673
674 synth->mem.param[index] = value;
675
676 if (index >= ACTIVE_DEVS) {
677 memCallback(win, panel, index, value);
678 return(0);
679 }
680
681 if ((!global.libtest) || (index >= ACTIVE_DEVS))
682 synth->dispatch[index].routine(synth,
683 global.controlfd, synth->sid,
684 synth->dispatch[index].controller,
685 synth->dispatch[index].operator,
686 sendvalue);
687 #define DEBUG
688 #ifdef DEBUG
689 else
690 printf("dispatch[%p,%i](%i, %i, %i, %i, %i)\n", synth, index,
691 global.controlfd, synth->sid,
692 synth->dispatch[index].controller,
693 synth->dispatch[index].operator,
694 sendvalue);
695 #endif
696
697 return(0);
698 }
699
700 static void
voxM2Drawbar(guiSynth * synth,int fd,int chan,int cont,int op,int value)701 voxM2Drawbar(guiSynth *synth, int fd, int chan, int cont, int op, int value)
702 {
703 int sval;
704
705 /* printf("voxM2Drawbar(%x, %i, %i, %i, %i, %i)\n",
706 synth, fd, chan, cont, op, value); */
707
708 /*
709 * We have to take care of dual/triple manual stuff here. Also need to
710 * block the upper manual 4' and II (which we are going to use for perc)
711 * if they are selected on controllers 15 and 16.
712 */
713 sval = cont * 16 + value;
714
715 if ((op == 1) && (cont == 2) && (synth->mem.param[15] != 0))
716 {
717 sval = cont * 16 + 8;
718 bristolMidiSendMsg(global.controlfd, synth->sid2, 0, 0, sval);
719 return;
720 }
721
722 if ((op == 1) && (cont == 6) && (synth->mem.param[16] != 0))
723 {
724 sval = cont * 16 + 8;
725 bristolMidiSendMsg(global.controlfd, synth->sid2, 0, 0, sval);
726 return;
727 }
728
729 switch (op) {
730 case 0:
731 bristolMidiSendMsg(global.controlfd, synth->sid, 0, 0, sval);
732 break;
733 case 1:
734 bristolMidiSendMsg(global.controlfd, synth->sid2, 0, 0, sval);
735 break;
736 }
737 }
738
739 static void
voxM2Vibrato(guiSynth * id,int fd,int chan,int cont,int op,int value)740 voxM2Vibrato(guiSynth *id, int fd, int chan, int cont, int op, int value)
741 {
742 bristolMidiSendMsg(global.controlfd, chan, cont, op, value);
743 bristolMidiSendMsg(global.controlfd, chan + 1, cont, op, value);
744 }
745
746 static void
voxM2Volume(guiSynth * id,int fd,int chan,int cont,int op,int value)747 voxM2Volume(guiSynth *id, int fd, int chan, int cont, int op, int value)
748 {
749 bristolMidiSendMsg(global.controlfd, chan, 0, 1, value);
750 bristolMidiSendMsg(global.controlfd, chan+1, 0, 1, value);
751 bristolMidiSendMsg(global.controlfd, chan+1, 2, 1, value);
752 }
753
754 static void
voxM2Option(guiSynth * synth,int fd,int chan,int cont,int op,int value)755 voxM2Option(guiSynth *synth, int fd, int chan, int cont, int op, int value)
756 {
757 int actual;
758
759 /*
760 * We deal with two values representing vibrato speed and depth, then with
761 * percussive decays.
762 */
763 switch (cont) {
764 case 24:
765 /* Vibra Speed */
766 bristolMidiSendMsg(global.controlfd, synth->sid, 1, 0, value);
767 bristolMidiSendMsg(global.controlfd, synth->sid2, 1, 0, value);
768 return;
769 case 25:
770 /* Vibra Depth */
771 bristolMidiSendMsg(global.controlfd, synth->sid, 1, 1, value);
772 bristolMidiSendMsg(global.controlfd, synth->sid2, 1, 1, value);
773 return;
774 case 26:
775 /* Vibra Chorus */
776 bristolMidiSendMsg(global.controlfd, synth->sid, 1, 2, value);
777 bristolMidiSendMsg(global.controlfd, synth->sid2, 1, 2, value);
778 return;
779 case 27:
780 /*
781 * The next 4 are percusive controls. We have to see if they are
782 * active and get their values before we send the requests.
783 *
784 * We have short/long/soft/loud
785 *
786 * Here - if L is not selected then short - set value.
787 */
788 actual = synth->mem.param[27] * C_RANGE_MIN_1 / 2;
789 if (synth->mem.param[17] == 0)
790 bristolMidiSendMsg(global.controlfd, synth->sid2, 3, 1, actual);
791 return;
792 case 28:
793 /*
794 * Here - if L is selected then short - set value.
795 */
796 actual = synth->mem.param[28] * C_RANGE_MIN_1 / 2;
797 if (synth->mem.param[17] != 0)
798 bristolMidiSendMsg(global.controlfd, synth->sid2, 3, 1, actual);
799 return;
800 case 29:
801 /*
802 * Here - if S is selected then soft - set value.
803 */
804 actual = synth->mem.param[29] * C_RANGE_MIN_1;
805 if (synth->mem.param[18] != 0)
806 bristolMidiSendMsg(global.controlfd, synth->sid2, 3, 4, actual);
807 return;
808 case 30:
809 /*
810 * Here - if S is not selected then loud - set value.
811 */
812 actual = synth->mem.param[30] * C_RANGE_MIN_1;
813 if (synth->mem.param[18] == 0)
814 bristolMidiSendMsg(global.controlfd, synth->sid2, 3, 4, actual);
815 return;
816 }
817 }
818 /*
819 * Called when a wave selector button
820 */
821 static void
voxM2Waves(guiSynth * synth,int fd,int chan,int cont,int op,int value)822 voxM2Waves(guiSynth *synth, int fd, int chan, int cont, int op, int value)
823 {
824 int tval;
825
826 /* printf("waves %i %i %i\n", cont, op, value); */
827 if (value != 0)
828 {
829 bristolMidiSendMsg(global.controlfd, synth->sid2, cont, op, value);
830 /* We just set the percussive option, must also send full on drawbar */
831 if (op == 2)
832 bristolMidiSendMsg(global.controlfd, synth->sid2, 0, 0, 2 * 16 + 8);
833 else
834 bristolMidiSendMsg(global.controlfd, synth->sid2, 0, 0, 6 * 16 + 8);
835 return;
836 }
837
838 /*
839 * Ok, so we are turning the percussive off, that means we have to change
840 * back to the drawbar current setting and disable percussive.
841 */
842 bristolMidiSendMsg(global.controlfd, synth->sid2, cont, op, value);
843
844 if (op == 2)
845 tval = 2 * 16 + synth->mem.param[8];
846 else
847 tval = 6 * 16 + synth->mem.param[9];
848 bristolMidiSendMsg(global.controlfd, synth->sid2, 0, 0, tval);
849 }
850
851 static void
voxM2Bass(guiSynth * synth,int fd,int chan,int cont,int op,int value)852 voxM2Bass(guiSynth *synth, int fd, int chan, int cont, int op, int value)
853 {
854 switch (op) {
855 case 0:
856 bristolMidiSendMsg(global.controlfd, synth->sid, 2, 0,
857 value == 0? 16:24);
858 break;
859 case 4:
860 case 5:
861 bristolMidiSendMsg(global.controlfd, synth->sid, 2, 0,
862 op * 16 + value);
863 break;
864 }
865 }
866
867 /*
868 * This is called when the percussive wave selection buttons are pressed.
869 * It needs to set wave gains and request perc options.
870 */
871 static void
voxM2Perc(guiSynth * synth,int fd,int chan,int cont,int op,int value)872 voxM2Perc(guiSynth *synth, int fd, int chan, int cont, int op, int value)
873 {
874 int v;
875
876 /* printf("perc %i %i %i\n", cont, op, value); */
877 switch (op) {
878 default:
879 if (value == 0)
880 v = synth->mem.param[27] * C_RANGE_MIN_1 / 4;
881 else
882 v = synth->mem.param[28] * C_RANGE_MIN_1 / 4;
883 break;
884 case 4:
885 if (value == 0)
886 v = synth->mem.param[30] * C_RANGE_MIN_1;
887 else
888 v = synth->mem.param[29] * C_RANGE_MIN_1;
889 break;
890 }
891 bristolMidiSendMsg(global.controlfd, synth->sid2, cont, op, v);
892 }
893
894 static void
voxM2Reverb(guiSynth * synth,int fd,int chan,int cont,int op,int value)895 voxM2Reverb(guiSynth *synth, int fd, int chan, int cont, int op, int value)
896 {
897 bristolMidiSendMsg(global.controlfd, synth->sid2, cont, op, value);
898 }
899
900 /*
901 * Any location initialisation required to run the callbacks. For bristol, this
902 * will connect to the engine, and give it some base parameters.
903 * May need to generate some application specific menus.
904 * Will also then make specific requests to some of the devices to alter their
905 * rendering.
906 */
907 static int
voxM2Init(brightonWindow * win)908 voxM2Init(brightonWindow* win)
909 {
910 guiSynth *synth = findSynth(global.synths, win);
911 dispatcher *dispatch;
912 int i;
913
914 if (synth == 0)
915 {
916 synth = findSynth(global.synths, 0);
917 if (synth == 0)
918 {
919 printf("cannot init\n");
920 return(0);
921 }
922 }
923
924 synth->win = win;
925
926 printf("Initialise the voxM2 link to bristol: %p\n", synth->win);
927
928 synth->mem.param = (float *) brightonmalloc(DEVICE_COUNT * sizeof(float));
929 synth->mem.count = DEVICE_COUNT;
930 synth->mem.active = ACTIVE_DEVS;
931 synth->dispatch = (dispatcher *)
932 brightonmalloc(DEVICE_COUNT * sizeof(dispatcher));
933 dispatch = synth->dispatch;
934
935 /*
936 * We really want to have three connection mechanisms. These should be
937 * 1. Unix named sockets.
938 * 2. UDP sockets.
939 * 3. MIDI pipe.
940 */
941 if (!global.libtest)
942 {
943 if (synth->midichannel > 14)
944 synth->midichannel--;
945 bcopy(&global, &manual, sizeof(guimain));
946 synth->synthtype = BRISTOL_VOX;
947 if ((synth->sid = initConnection(&global, synth)) < 0)
948 return(-1);
949
950 /* Crank up another VOX for the upper manual */
951 manual.flags |= BRISTOL_CONN_FORCE|BRIGHTON_NOENGINE;
952 manual.port = global.port;
953 manual.host = global.host;
954 synth->synthtype = BRISTOL_VOXM2;
955 synth->midichannel++;
956
957 if ((synth->sid2 = initConnection(&manual, synth)) < 0)
958 return(-1);
959
960 global.manualfd = manual.controlfd;
961 global.manual = &manual;
962 manual.manual = &global;
963
964 synth->midichannel--;
965 }
966
967 for (i = 0; i < DEVICE_COUNT; i++)
968 synth->dispatch[i].routine = voxM2MidiSendMsg;
969
970 /* Lower manual basic VOX oscillator */
971 synth->dispatch[MOD_START + 0].operator = 0;
972 synth->dispatch[MOD_START + 0].controller = 0;
973 synth->dispatch[MOD_START + 1].operator = 0;
974 synth->dispatch[MOD_START + 1].controller = 1;
975 synth->dispatch[MOD_START + 2].operator = 0;
976 synth->dispatch[MOD_START + 2].controller = 2;
977 synth->dispatch[MOD_START + 3].operator = 0;
978 synth->dispatch[MOD_START + 3].controller = 3;
979 synth->dispatch[MOD_START + 4].operator = 0;
980 synth->dispatch[MOD_START + 4].controller = 4;
981 synth->dispatch[MOD_START + 5].operator = 0;
982 synth->dispatch[MOD_START + 5].controller = 5;
983 synth->dispatch[MOD_START + 0].routine
984 = synth->dispatch[MOD_START + 1].routine
985 = synth->dispatch[MOD_START + 2].routine
986 = synth->dispatch[MOD_START + 3].routine
987 = synth->dispatch[MOD_START + 4].routine
988 = synth->dispatch[MOD_START + 5].routine
989 = (synthRoutine) voxM2Drawbar;
990
991 /* Upper manual basic VOX oscillator */
992 synth->dispatch[MOD_START + 6].operator = 1;
993 synth->dispatch[MOD_START + 6].controller = 0;
994 synth->dispatch[MOD_START + 7].operator = 1;
995 synth->dispatch[MOD_START + 7].controller = 1;
996 synth->dispatch[MOD_START + 8].operator = 1;
997 synth->dispatch[MOD_START + 8].controller = 2;
998 synth->dispatch[MOD_START + 9].operator = 1;
999 synth->dispatch[MOD_START + 9].controller = 6;
1000 synth->dispatch[MOD_START + 10].operator = 1;
1001 synth->dispatch[MOD_START + 10].controller = 7;
1002 synth->dispatch[MOD_START + 11].operator = 1;
1003 synth->dispatch[MOD_START + 11].controller = 4;
1004 synth->dispatch[MOD_START + 12].operator = 1;
1005 synth->dispatch[MOD_START + 12].controller = 5;
1006 synth->dispatch[MOD_START + 6].routine
1007 = synth->dispatch[MOD_START + 7].routine
1008 = synth->dispatch[MOD_START + 8].routine
1009 = synth->dispatch[MOD_START + 9].routine
1010 = synth->dispatch[MOD_START + 10].routine
1011 = synth->dispatch[MOD_START + 11].routine
1012 = synth->dispatch[MOD_START + 12].routine
1013 = (synthRoutine) voxM2Drawbar;
1014
1015 /*
1016 * 13 and 14 are the Bass drawbars
1017 */
1018 synth->dispatch[MOD_START + 13].controller = 2;
1019 synth->dispatch[MOD_START + 13].operator = 4;
1020 synth->dispatch[MOD_START + 13].routine = (synthRoutine) voxM2Bass;
1021 synth->dispatch[MOD_START + 14].controller = 2;
1022 synth->dispatch[MOD_START + 14].operator = 5;
1023 synth->dispatch[MOD_START + 14].routine = (synthRoutine) voxM2Bass;
1024
1025 /*
1026 * 15 and 16 are the percussive selectors that need to be sent to the
1027 * modified vox oscillator. We need a shim since they go to the second
1028 * manual.
1029 */
1030 synth->dispatch[MOD_START + 15].controller = 0;
1031 synth->dispatch[MOD_START + 15].operator = 2;
1032 synth->dispatch[MOD_START + 16].controller = 0;
1033 synth->dispatch[MOD_START + 16].operator = 3;
1034 synth->dispatch[MOD_START + 15].routine
1035 = synth->dispatch[MOD_START + 16].routine = (synthRoutine) voxM2Waves;
1036
1037 /*
1038 * Percussive harmonics then envelope
1039 */
1040 synth->dispatch[MOD_START + 17].controller = 2;
1041 synth->dispatch[MOD_START + 17].operator = 1;
1042 synth->dispatch[MOD_START + 18].controller = 2;
1043 synth->dispatch[MOD_START + 18].operator = 4;
1044 synth->dispatch[MOD_START + 17].routine
1045 = synth->dispatch[MOD_START + 18].routine = (synthRoutine) voxM2Perc;
1046
1047 /* Bass harmonics */
1048 synth->dispatch[MOD_START + 19].controller = 2;
1049 synth->dispatch[MOD_START + 19].operator = 0;
1050 synth->dispatch[MOD_START + 19].routine = (synthRoutine) voxM2Bass;
1051 /* Bass sustain (actualy env release). */
1052 synth->dispatch[MOD_START + 20].controller = 3;
1053 synth->dispatch[MOD_START + 20].operator = 3;
1054
1055 /* Vibrato */
1056 synth->dispatch[MOD_START + 21].controller = 126;
1057 synth->dispatch[MOD_START + 21].operator = 0;
1058 synth->dispatch[MOD_START + 21].routine = (synthRoutine) voxM2Vibrato;
1059 /* Panel switch */
1060 synth->dispatch[MOD_START + 22].routine = (synthRoutine) panelSwitch;
1061
1062 /* Volume */
1063 synth->dispatch[MOD_START + 23].routine = (synthRoutine) voxM2Volume;
1064
1065 /* Options */
1066 synth->dispatch[MOD_START + 24].controller = 24;
1067 synth->dispatch[MOD_START + 24].routine = (synthRoutine) voxM2Option;
1068 synth->dispatch[MOD_START + 25].controller = 25;
1069 synth->dispatch[MOD_START + 25].routine = (synthRoutine) voxM2Option;
1070 synth->dispatch[MOD_START + 26].controller = 26;
1071 synth->dispatch[MOD_START + 26].routine = (synthRoutine) voxM2Option;
1072 synth->dispatch[MOD_START + 27].controller = 27;
1073 synth->dispatch[MOD_START + 27].routine = (synthRoutine) voxM2Option;
1074 synth->dispatch[MOD_START + 28].controller = 28;
1075 synth->dispatch[MOD_START + 28].routine = (synthRoutine) voxM2Option;
1076 synth->dispatch[MOD_START + 29].controller = 29;
1077 synth->dispatch[MOD_START + 29].routine = (synthRoutine) voxM2Option;
1078 synth->dispatch[MOD_START + 30].controller = 30;
1079 synth->dispatch[MOD_START + 30].routine = (synthRoutine) voxM2Option;
1080
1081 /* Dummies need to be covered */
1082 synth->dispatch[MOD_START + 31].controller = 99;
1083 synth->dispatch[MOD_START + 31].operator = 0;
1084 synth->dispatch[MOD_START + 32].controller = 99;
1085 synth->dispatch[MOD_START + 32].operator = 1;
1086 synth->dispatch[MOD_START + 33].controller = 99;
1087 synth->dispatch[MOD_START + 33].operator = 2;
1088 synth->dispatch[MOD_START + 31].routine
1089 = synth->dispatch[MOD_START + 32].routine
1090 = synth->dispatch[MOD_START + 33].routine = (synthRoutine) voxM2Reverb;
1091
1092 synth->dispatch[MOD_START + 34].operator = 100;
1093 synth->dispatch[MOD_START + 34].controller = 100;
1094 synth->dispatch[MOD_START + 35].operator = 100;
1095 synth->dispatch[MOD_START + 35].controller = 100;
1096 synth->dispatch[MOD_START + 36].operator = 100;
1097 synth->dispatch[MOD_START + 36].controller = 100;
1098 synth->dispatch[MOD_START + 37].operator = 100;
1099 synth->dispatch[MOD_START + 37].controller = 100;
1100
1101 synth->dispatch[MEM_START + 0].routine
1102 = synth->dispatch[MEM_START + 1].routine
1103 = synth->dispatch[MEM_START + 2].routine
1104 = synth->dispatch[MEM_START + 3].routine
1105 = synth->dispatch[MEM_START + 4].routine
1106 = synth->dispatch[MEM_START + 5].routine
1107 = (synthRoutine) memCallback;
1108
1109 /* Vox Mark-II Oscillator */
1110 bristolMidiSendMsg(global.controlfd, synth->sid2, 0, 4, 1);
1111 /* Bass Osc 8' (actually remapped to 4') */
1112 bristolMidiSendMsg(global.controlfd, synth->sid, 2, 0, 40);
1113 /*
1114 * We have to setup the vibra with speed and depth defaults
1115 */
1116 bristolMidiSendMsg(global.controlfd, synth->sid, 1, 0, 500);
1117 bristolMidiSendMsg(global.controlfd, synth->sid, 1, 1, 2000);
1118 bristolMidiSendMsg(global.controlfd, synth->sid, 1, 2, 0);
1119 bristolMidiSendMsg(global.controlfd, synth->sid2, 1, 0, 500);
1120 bristolMidiSendMsg(global.controlfd, synth->sid2, 1, 1, 2000);
1121 bristolMidiSendMsg(global.controlfd, synth->sid2, 1, 2, 0);
1122 /* Gain */
1123 bristolMidiSendMsg(global.controlfd, synth->sid, 0, 1, 16383);
1124 bristolMidiSendMsg(global.controlfd, synth->sid, 2, 1, 16383);
1125 /* Perc env parameters */
1126 bristolMidiSendMsg(global.controlfd, synth->sid2, 2, 0, 5);
1127 bristolMidiSendMsg(global.controlfd, synth->sid2, 2, 1, 2048);
1128 bristolMidiSendMsg(global.controlfd, synth->sid2, 2, 2, 0);
1129 bristolMidiSendMsg(global.controlfd, synth->sid2, 2, 3, 0);
1130 bristolMidiSendMsg(global.controlfd, synth->sid2, 2, 4, 16383);
1131 /* Bass env parameters ADSG, R is in the panel */
1132 bristolMidiSendMsg(global.controlfd, synth->sid, 3, 0, 100);
1133 bristolMidiSendMsg(global.controlfd, synth->sid, 3, 1, 100);
1134 bristolMidiSendMsg(global.controlfd, synth->sid, 3, 2, 16383);
1135 bristolMidiSendMsg(global.controlfd, synth->sid, 3, 4, 12000);
1136
1137 return(0);
1138 }
1139
1140 /*
1141 * This will be called to make any routine specific parameters available.
1142 */
1143 static int
voxM2Configure(brightonWindow * win)1144 voxM2Configure(brightonWindow *win)
1145 {
1146 guiSynth *synth = findSynth(global.synths, win);
1147 brightonEvent event;
1148
1149 if (synth == 0)
1150 {
1151 printf("problems going operational\n");
1152 return(-1);
1153 }
1154
1155 if (synth->flags & OPERATIONAL)
1156 return(0);
1157
1158 printf("going operational\n");
1159
1160 synth->flags |= OPERATIONAL;
1161 synth->keypanel = KEY_PANEL;
1162 synth->keypanel2 = KEY_PANEL2;
1163 synth->transpose = 36;
1164 synth->bank = synth->location - (synth->location % 10);
1165 synth->location -= synth->bank;
1166 loadMemory(synth, "voxM2", 0, synth->bank + synth->location,
1167 synth->mem.active, FIRST_DEV, BRISTOL_NOCALLS);
1168
1169 memFix(win, synth);
1170
1171 /*
1172 * Hm. This is a hack for a few bits of bad rendering of a keyboard. Only
1173 * occurs on first paint, so we suppress the first paint, and then request
1174 * an expose here.
1175 */
1176 event.type = BRIGHTON_EXPOSE;
1177 event.intvalue = 1;
1178 brightonParamChange(synth->win, KEY_PANEL, -1, &event);
1179 brightonParamChange(synth->win, KEY_PANEL2, -1, &event);
1180 brightonParamChange(synth->win, 6, -1, &event);
1181 brightonParamChange(synth->win, 1, -1, &event);
1182 event.type = BRIGHTON_FLOAT;
1183 event.value = 1;
1184 brightonParamChange(synth->win, 1, 3, &event);
1185 configureGlobals(synth);
1186
1187 synth->dispatch[MEM_START].other1 = MEM_START + synth->location;
1188 synth->dispatch[MEM_START].other2 = 1;
1189 event.type = BRIGHTON_FLOAT;
1190 event.value = 1.0;
1191 brightonParamChange(synth->win, 0, synth->location + MEM_START, &event);
1192
1193 dc = brightonGetDCTimer(win->dcTimeout);
1194
1195 synth->loadMemory = (loadRoutine) voxloadMemory;
1196
1197 return(0);
1198 }
1199
1200