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 voxInit();
30 static int voxConfigure();
31 static int voxCallback(brightonWindow *, int, int, float);
32 static int midiCallback(brightonWindow *, int, int, float);
33
34 extern guimain global;
35
36 #include "brightonKeys.h"
37
38 #define OPTS_PANEL 0
39 #define MOD_PANEL 1
40 #define MEM_PANEL 2
41 #define KEY_PANEL 3
42
43 #define FIRST_DEV 0
44
45 #define MOD_COUNT 8
46 #define OPTS_COUNT 4
47 #define MEM_COUNT 17
48
49 #define OPTS_START 0
50 #define MOD_START OPTS_COUNT
51 #define MEM_START (MOD_COUNT + MOD_START)
52
53 #define ACTIVE_DEVS (OPTS_COUNT + 7 + FIRST_DEV)
54 #define DEVICE_COUNT (MOD_COUNT + OPTS_COUNT + MEM_COUNT)
55 #define DISPLAY_DEV (DEVICE_COUNT - 1)
56 #define MEM_MGT ACTIVE_DEVS
57
58 #define MIDI_MGT (MEM_MGT + 12)
59
60
61 /*
62 * This structure is for device definition. The structure is defined in
63 * include/brighton.h, further definitions in brighton/brightonDevtable.h and
64 * include/brightoninternals.h
65 *
66 * typedef int (*brightonCallback)(int, float);
67 * typedef struct BrightonLocations {
68 * int device; 0=rotary, 1=scale, etc.
69 * float relx, rely; relative position with regards to 1000 by 1000 window
70 * float relw, relh; relative height.
71 * int from, to;
72 * brightonCallback callback; specific to this dev
73 * char *image; bitmap. If zero take a device default.
74 * int flags;
75 * } brightonLocations;
76 *
77 * This example is for a voxBristol type synth interface.
78 */
79
80 #define R1 0
81
82 #define W1 100
83 #define L1 600
84
85 #define C1 40
86 #define C2 190
87 #define C3 340
88 #define C4 490
89 #define C5 700
90 #define C6 850
91
92 static brightonLocations locations[DEVICE_COUNT] = {
93 {"Drawbar 16", 1, C1, R1, W1, L1, 0, 8, 0,
94 "bitmaps/knobs/hammondwhite.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
95 {"Drawbar 8", 1, C2, R1, W1, L1, 0, 8, 0,
96 "bitmaps/knobs/hammondwhite.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
97 {"Drawbar 4", 1, C3, R1, W1, L1, 0, 8, 0,
98 "bitmaps/knobs/hammondwhite.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
99 {"Drawbar IV", 1, C4, R1, W1, L1, 0, 8, 0,
100 "bitmaps/knobs/hammondwhite.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
101 {"Drawbar Sine", 1, C5, R1, W1, L1, 0, 8, 0,
102 "bitmaps/knobs/hammondbrown.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
103 {"Drawbar Ramp", 1, C6, R1, W1, L1, 0, 8, 0,
104 "bitmaps/knobs/hammondbrown.xpm", 0, BRIGHTON_REVERSE|BRIGHTON_HSCALE},
105 {"Opts", 2, 650, 775, 75, 200, 0, 1, 0,
106 "bitmaps/buttons/rockerwhite.xpm", 0, BRIGHTON_VERTICAL},
107 {"Vibrato", 2, 250, 775, 75, 200, 0, 1, 0,
108 "bitmaps/buttons/rockerwhite.xpm", 0, BRIGHTON_VERTICAL},
109 };
110
111 #define S1 200
112
113 static brightonLocations options[OPTS_COUNT] = {
114 {"", 0, 500, 100, S1, S1, 0, 1, 0, 0, 0, 0},
115 {"", 0, 200, 500, S1, S1, 0, 1, 0, 0, 0, 0},
116 {"", 0, 500, 500, S1, S1, 0, 1, 0, 0, 0, 0},
117 {"", 2, 800, 500, 75, 200, 0, 1, 0,
118 "bitmaps/buttons/rockerwhite.xpm", 0, BRIGHTON_VERTICAL},
119 };
120
121 #define mR1 100
122 #define mR2 300
123 #define mR3 550
124 #define mR4 800
125
126 #define mC1 100
127 #define mC2 293
128 #define mC3 486
129 #define mC4 679
130 #define mC5 875
131
132 #define mC11 100
133 #define mC12 255
134 #define mC13 410
135 #define mC14 565
136 #define mC15 720
137 #define mC16 874
138
139 #define S4 80
140 #define S5 150
141
142 brightonLocations mem[MEM_COUNT] = {
143 /* memories */
144 {"", 2, mC1, mR3, S4, S5, 0, 1, 0,
145 "bitmaps/buttons/pressoff.xpm",
146 "bitmaps/buttons/presson.xpm", 0},
147 {"", 2, mC2, mR3, S4, S5, 0, 1, 0,
148 "bitmaps/buttons/pressoff.xpm",
149 "bitmaps/buttons/presson.xpm", 0},
150 {"", 2, mC3, mR3, S4, S5, 0, 1, 0,
151 "bitmaps/buttons/pressoff.xpm",
152 "bitmaps/buttons/presson.xpm", 0},
153 {"", 2, mC4, mR3, S4, S5, 0, 1, 0,
154 "bitmaps/buttons/pressoff.xpm",
155 "bitmaps/buttons/presson.xpm", 0},
156 {"", 2, mC5, mR3, S4, S5, 0, 1, 0,
157 "bitmaps/buttons/pressoff.xpm",
158 "bitmaps/buttons/presson.xpm", 0},
159 {"", 2, mC1, mR4, S4, S5, 0, 1, 0,
160 "bitmaps/buttons/pressoff.xpm",
161 "bitmaps/buttons/presson.xpm", 0},
162 {"", 2, mC2, mR4, S4, S5, 0, 1, 0,
163 "bitmaps/buttons/pressoff.xpm",
164 "bitmaps/buttons/presson.xpm", 0},
165 {"", 2, mC3, mR4, S4, S5, 0, 1, 0,
166 "bitmaps/buttons/pressoff.xpm",
167 "bitmaps/buttons/presson.xpm", 0},
168 {"", 2, mC4, mR4, S4, S5, 0, 1, 0,
169 "bitmaps/buttons/pressoff.xpm",
170 "bitmaps/buttons/presson.xpm", 0},
171 {"", 2, mC5, mR4, S4, S5, 0, 1, 0,
172 "bitmaps/buttons/pressoff.xpm",
173 "bitmaps/buttons/presson.xpm", 0},
174 /* mem U/D, midi U/D, Load + Save */
175 {"", 2, mC11, mR2, S4, S5, 0, 1, 0,
176 "bitmaps/buttons/pressoffg.xpm",
177 "bitmaps/buttons/pressong.xpm", BRIGHTON_CHECKBUTTON},
178 {"", 2, mC12, mR2, S4, S5, 0, 1, 0,
179 "bitmaps/buttons/pressoffg.xpm",
180 "bitmaps/buttons/pressong.xpm", BRIGHTON_CHECKBUTTON},
181 {"", 2, mC13, mR2, S4, S5, 0, 1, 0,
182 "bitmaps/buttons/pressoffo.xpm",
183 "bitmaps/buttons/pressono.xpm", BRIGHTON_CHECKBUTTON},
184 {"", 2, mC14, mR2, S4, S5, 0, 1, 0,
185 "bitmaps/buttons/pressoff.xpm",
186 "bitmaps/buttons/presson.xpm", BRIGHTON_CHECKBUTTON},
187 {"", 2, mC15, mR2, S4, S5, 0, 1, 0,
188 "bitmaps/buttons/pressoffg.xpm",
189 "bitmaps/buttons/pressong.xpm", BRIGHTON_CHECKBUTTON},
190 {"", 2, mC16, mR2, S4, S5, 0, 1, 0,
191 "bitmaps/buttons/pressoffg.xpm",
192 "bitmaps/buttons/pressong.xpm", BRIGHTON_CHECKBUTTON},
193 /* display */
194 {"", 3, mC1, mR1, 875, 125, 0, 1, 0, 0, 0, 0},
195 };
196
197 /*
198 * Should try and make this one as generic as possible, and try to use it as
199 * a general memory routine. has Midi u/d, mem u/d, load/save and a display.
200 */
201 int
memCallback(brightonWindow * win,int panel,int index,float value)202 memCallback(brightonWindow* win, int panel, int index, float value)
203 {
204 guiSynth *synth = findSynth(global.synths, win);
205 int i, memindex = 0;
206
207 /* printf("memCallback(%i, %i, %f) %i, %s\n", panel, index, value, */
208 /* synth->mem.active, synth->resources->name); */
209
210 if (synth->flags & SUPPRESS)
211 return(0);
212
213 /*
214 * We need to convert the index into an offset into the mem structure.
215 * To do this we make a simple parse of the panels preceeding this panel.
216 */
217 for (i = 0; i < panel; i++)
218 memindex += synth->resources->resources[i].ndevices;
219
220 /* printf("memindex is %i\n", memindex); */
221
222 /*
223 * The first ten buttons are exclusive highlighting, we use the first mem
224 * pointer to handle this.
225 */
226 if (synth->dispatch[memindex].other2)
227 {
228 synth->dispatch[memindex].other2 = 0;
229 return(0);
230 }
231
232 if (index < 10)
233 {
234 brightonEvent event;
235
236 /*
237 * This is a numeric. We need to force exclusion.
238 */
239 if (synth->dispatch[memindex].other1 != -1)
240 {
241 synth->dispatch[memindex].other2 = 1;
242
243 if (synth->dispatch[memindex].other1 != index)
244 event.value = 0;
245 else
246 event.value = 1;
247
248 brightonParamChange(synth->win, panel,
249 synth->dispatch[memindex].other1, &event);
250 }
251 synth->dispatch[memindex].other1 = index;
252
253 if ((synth->location = synth->location * 10 + index) >= 1000)
254 synth->location = index;
255
256 if (loadMemory(synth, synth->resources->name, 0, synth->location,
257 synth->mem.active, FIRST_DEV, BRISTOL_STAT) < 0)
258 displayPanelText(synth, "FREE", synth->location, panel,
259 MEM_COUNT - 1);
260 else
261 displayPanelText(synth, "PROG", synth->location, panel,
262 MEM_COUNT - 1);
263 } else {
264 int newchan;
265
266 /*
267 * This is a control button.
268 */
269 switch(index) {
270 case 10:
271 /*
272 * Midi Down
273 */
274 if ((newchan = synth->midichannel - 1) < 0)
275 {
276 synth->midichannel = 0;
277 return(0);
278 }
279
280 bristolMidiSendMsg(global.controlfd, synth->sid,
281 127, 0, BRISTOL_MIDICHANNEL|newchan);
282
283 synth->midichannel = newchan;
284
285 displayPanelText(synth, "MIDI", synth->midichannel + 1,
286 panel, MEM_COUNT - 1);
287 break;
288 case 11:
289 /*
290 * Midi Up
291 */
292 if ((newchan = synth->midichannel + 1) > 15)
293 {
294 synth->midichannel = 15;
295 return(0);
296 }
297
298 bristolMidiSendMsg(global.controlfd, synth->sid,
299 127, 0, BRISTOL_MIDICHANNEL|newchan);
300
301 synth->midichannel = newchan;
302
303 displayPanelText(synth, "MIDI", synth->midichannel + 1,
304 panel, MEM_COUNT - 1);
305 break;
306 case 12:
307 /*
308 * Save
309 */
310 saveMemory(synth, synth->resources->name, 0, synth->location,
311 FIRST_DEV);
312 displayPanelText(synth, "PROG", synth->location,
313 panel, MEM_COUNT - 1);
314 break;
315 case 13:
316 default:
317 /*
318 * Load
319 */
320 synth->flags |= MEM_LOADING;
321 loadMemory(synth, synth->resources->name, 0, synth->location,
322 synth->mem.active, FIRST_DEV, 0);
323 synth->flags &= ~MEM_LOADING;
324 displayPanelText(synth, "PROG", synth->location,
325 panel, MEM_COUNT - 1);
326 break;
327 case 14:
328 /*
329 * Mem Down - these are going to be seek routines - find the
330 * next programmed memory.
331 */
332 if (--synth->location < 0)
333 synth->location = 999;
334 synth->flags |= MEM_LOADING;
335 while (loadMemory(synth, synth->resources->name, 0,
336 synth->location, synth->mem.active, FIRST_DEV, 0) < 0)
337 {
338 if (--synth->location < 0)
339 synth->location = 999;
340 }
341 synth->flags &= ~MEM_LOADING;
342 displayPanelText(synth, "PROG", synth->location,
343 panel, MEM_COUNT - 1);
344 break;
345 case 15:
346 /*
347 * Mem Up - seek routine, find next programmed memory.
348 */
349 if (++synth->location >= 1000)
350 synth->location = 0;
351 synth->flags |= MEM_LOADING;
352 while (loadMemory(synth, synth->resources->name, 0,
353 synth->location, synth->mem.active, FIRST_DEV, 0) < 0)
354 {
355 if (++synth->location >= 1000)
356 synth->location = 0;
357 }
358 synth->flags &= ~MEM_LOADING;
359 displayPanelText(synth, "PROG", synth->location,
360 panel, MEM_COUNT - 1);
361 break;
362 }
363 }
364 return(0);
365 }
366
367 /*
368 * This is a set of globals for the main window rendering. Again taken from
369 * include/brighton.h
370 */
371 brightonApp voxApp = {
372 "vox",
373 0, /* no blueprint on wood background. */
374 "bitmaps/textures/leather.xpm",
375 0,
376 voxInit,
377 voxConfigure, /* 3 callbacks */
378 midiCallback,
379 destroySynth,
380 {-1, 0, 2, 2, 5, 520, 0, 1},
381 550, 250, 0, 0,
382 7, /* panel count */
383 {
384 {
385 "Opts",
386 "bitmaps/blueprints/voxopts.xpm",
387 "bitmaps/textures/metal5.xpm", /* flags */
388 0x020,
389 0,
390 0,
391 voxCallback,
392 19, 40, 500, 570,
393 OPTS_COUNT,
394 options
395 },
396 {
397 "Mods",
398 "bitmaps/blueprints/vox.xpm",
399 "bitmaps/textures/metal6.xpm", /* flags */
400 BRIGHTON_STRETCH,
401 0,
402 0,
403 voxCallback,
404 15, 662, 150, 310,
405 MOD_COUNT,
406 locations
407 },
408 {
409 "Mem",
410 "bitmaps/blueprints/genmem.xpm",
411 "bitmaps/textures/metal5.xpm", /* flags */
412 0x020,
413 0,
414 0,
415 memCallback,
416 519, 40, 462, 570,
417 MEM_COUNT,
418 mem
419 },
420 {
421 "Keyboard",
422 0,
423 "bitmaps/keys/vkbg.xpm", /* flags */
424 0x020|BRIGHTON_STRETCH,
425 0,
426 0,
427 keyCallback,
428 200, 662, 780, 305,
429 VKEY_COUNT,
430 vkeys
431 },
432 {
433 "Vox",
434 0,
435 "bitmaps/textures/redleather.xpm",
436 0, /* flags */
437 0,
438 0,
439 0,
440 /*15, 600, 970, 50, */
441 15, 35, 970, 625,
442 0,
443 0
444 },
445 {
446 "Vox",
447 0,
448 "bitmaps/textures/orangeleather.xpm",
449 0, /* flags */
450 0,
451 0,
452 0,
453 19, 40, 962, 570,
454 0,
455 0
456 },
457 {
458 "backing",
459 0,
460 "bitmaps/textures/metal5.xpm", /* flags */
461 BRIGHTON_STRETCH,
462 0,
463 0,
464 0,
465 170, 662, 30, 305,
466 0,
467 0
468 },
469 }
470 };
471
472 /*static dispatcher dispatch[DEVICE_COUNT]; */
473
474 static int
midiCallback(brightonWindow * win,int controller,int value,float n)475 midiCallback(brightonWindow *win, int controller, int value, float n)
476 {
477 guiSynth *synth = findSynth(global.synths, win);
478
479 printf("midi callback: %x, %i\n", controller, value);
480
481 switch(controller)
482 {
483 case MIDI_PROGRAM:
484 printf("midi program: %x, %i\n", controller, value);
485 synth->location = value;
486 loadMemory(synth, synth->resources->name, 0, synth->bank + synth->location,
487 synth->mem.active, FIRST_DEV, 0);
488 break;
489 case MIDI_BANK_SELECT:
490 printf("midi banksel: %x, %i\n", controller, value);
491 synth->bank = value;
492 break;
493 }
494 return(0);
495 }
496
497 static int
voxMidiSendMsg(void * synth,int fd,int chan,int c,int o,int v)498 voxMidiSendMsg(void *synth, int fd, int chan, int c, int o, int v)
499 {
500 /* printf("%i, %i, %i\n", c, o, v); */
501 bristolMidiSendMsg(fd, chan, c, o, v);
502 return(0);
503 }
504
505 /*
506 * For the sake of ease of use, links have been placed here to be called
507 * by any of the devices created. They would be better in some other file,
508 * perhaps with this as a dispatch.
509 *
510 * Param refers to the device index in the locations table given below.
511 */
512 static int
voxCallback(brightonWindow * win,int panel,int index,float value)513 voxCallback(brightonWindow *win, int panel, int index, float value)
514 {
515 guiSynth *synth = findSynth(global.synths, win);
516 int sendvalue;
517
518 /* printf("voxCallback(%i, %i, %f): %x\n", panel, index, value, synth); */
519
520 if (synth == 0)
521 return(0);
522
523 if ((index >= DEVICE_COUNT) || ((synth->flags & OPERATIONAL) == 0))
524 return(0);
525
526 if (voxApp.resources[panel].devlocn[index].to == 1)
527 sendvalue = value * C_RANGE_MIN_1;
528 else
529 sendvalue = value;
530
531 switch (panel) {
532 case OPTS_PANEL:
533 index += OPTS_START;
534 break;
535 case MOD_PANEL:
536 index += MOD_START;
537 break;
538 case MEM_PANEL:
539 index += MEM_START;
540 break;
541 }
542
543 /* printf("index is now %i\n", index); */
544 synth->mem.param[index] = value;
545
546 if ((!global.libtest) || (index >= ACTIVE_DEVS))
547 synth->dispatch[index].routine(synth,
548 global.controlfd, synth->sid,
549 synth->dispatch[index].controller,
550 synth->dispatch[index].operator,
551 sendvalue);
552 #define DEBUG
553 #ifdef DEBUG
554 else
555 printf("dispatch[%p,%i](%i, %i, %i, %i, %i)\n", synth, index,
556 global.controlfd, synth->sid,
557 synth->dispatch[index].controller,
558 synth->dispatch[index].operator,
559 sendvalue);
560 #endif
561
562 return(0);
563 }
564
565 static void
voxDrawbar(guiSynth * synth,int fd,int chan,int cont,int op,int value)566 voxDrawbar(guiSynth *synth, int fd, int chan, int cont, int op, int value)
567 {
568 int slidervalue;
569
570 /*
571 printf("voxDrawbar(%x, %i, %i, %i, %i, %i)\n",
572 (size_t) synth, fd, chan, cont, op, value);
573 */
574
575 slidervalue = cont * 16 + value;
576
577 bristolMidiSendMsg(global.controlfd, synth->sid, 0, 0,
578 slidervalue);
579 }
580
581 static void
panelSwitch(guiSynth * id,int fd,int chan,int cont,int op,int value)582 panelSwitch(guiSynth *id, int fd, int chan, int cont, int op, int value)
583 {
584 brightonEvent event;
585
586 /*
587 * If the sendvalue is zero, then withdraw the opts window, draw the
588 * slider window, and vice versa.
589 */
590 if (value == 0)
591 {
592 event.type = BRIGHTON_EXPOSE;
593 event.intvalue = 0;
594 brightonParamChange(id->win, 0, -1, &event);
595 event.intvalue = 0;
596 brightonParamChange(id->win, 2, -1, &event);
597 event.intvalue = 1;
598 brightonParamChange(id->win, 5, -1, &event);
599 } else {
600 event.type = BRIGHTON_EXPOSE;
601 event.intvalue = 0;
602 brightonParamChange(id->win, 5, -1, &event);
603 event.intvalue = 1;
604 brightonParamChange(id->win, 0, -1, &event);
605 event.intvalue = 1;
606 brightonParamChange(id->win, 2, -1, &event);
607 }
608 }
609
610 static void
voxVolume(guiSynth * id,int fd,int chan,int cont,int op,int value)611 voxVolume(guiSynth *id, int fd, int chan, int cont, int op, int value)
612 {
613 /* printf("voxVolume\n"); */
614 bristolMidiSendMsg(global.controlfd, chan, 0, 1, value);
615 }
616
617 static void
voxOption(guiSynth * synth,int fd,int chan,int cont,int op,int value)618 voxOption(guiSynth *synth, int fd, int chan, int cont, int op, int value)
619 {
620 /* printf("voxOption(%i, %i, %i)\n", cont, op, value); */
621 bristolMidiSendMsg(global.controlfd, synth->sid, 1, cont, value);
622 }
623
624 /*
625 * Any location initialisation required to run the callbacks. For bristol, this
626 * will connect to the engine, and give it some base parameters.
627 * May need to generate some application specific menus.
628 * Will also then make specific requests to some of the devices to alter their
629 * rendering.
630 */
631 static int
voxInit(brightonWindow * win)632 voxInit(brightonWindow* win)
633 {
634 guiSynth *synth = findSynth(global.synths, win);
635 dispatcher *dispatch;
636 int i;
637
638 if (synth == 0)
639 {
640 synth = findSynth(global.synths, 0);
641 if (synth == 0)
642 {
643 printf("cannot init\n");
644 return(0);
645 }
646 }
647
648 synth->win = win;
649
650 printf("Initialise the vox link to bristol: %p\n", synth->win);
651
652 synth->mem.param = (float *) brightonmalloc(DEVICE_COUNT * sizeof(float));
653 synth->mem.count = DEVICE_COUNT;
654 synth->mem.active = ACTIVE_DEVS;
655 synth->dispatch = (dispatcher *)
656 brightonmalloc(DEVICE_COUNT * sizeof(dispatcher));
657 dispatch = synth->dispatch;
658
659 /*
660 * We really want to have three connection mechanisms. These should be
661 * 1. Unix named sockets.
662 * 2. UDP sockets.
663 * 3. MIDI pipe.
664 */
665 if (!global.libtest)
666 if ((synth->sid = initConnection(&global, synth)) < 0)
667 return(-1);
668
669 for (i = 0; i < DEVICE_COUNT; i++)
670 synth->dispatch[i].routine = voxMidiSendMsg;
671
672 /*
673 * First parameter are for the single oscillator. This should pass through
674 * an encaps operator.
675 *
676 * We have 16', 8', 4' pipes, one "IV" composite, flute (sine) and reed
677 * (saw) waves.
678 */
679
680 synth->dispatch[OPTS_START + 0].routine = (synthRoutine) voxVolume;
681
682 synth->dispatch[OPTS_START + 1].routine
683 = synth->dispatch[OPTS_START + 2].routine
684 = (synthRoutine) voxOption;
685 synth->dispatch[OPTS_START + 1].controller = 0;
686 synth->dispatch[OPTS_START + 2].controller = 1;
687
688 synth->dispatch[OPTS_START + 3].controller = 0;
689 synth->dispatch[OPTS_START + 3].operator = 5;
690
691 synth->dispatch[MOD_START + 0].routine
692 = synth->dispatch[MOD_START + 1].routine
693 = synth->dispatch[MOD_START + 2].routine
694 = synth->dispatch[MOD_START + 3].routine
695 = synth->dispatch[MOD_START + 4].routine
696 = synth->dispatch[MOD_START + 5].routine
697 = (synthRoutine) voxDrawbar;
698
699 synth->dispatch[MOD_START + 0].operator = 0;
700 synth->dispatch[MOD_START + 0].controller = 0;
701 synth->dispatch[MOD_START + 1].operator = 0;
702 synth->dispatch[MOD_START + 1].controller = 1;
703 synth->dispatch[MOD_START + 2].operator = 0;
704 synth->dispatch[MOD_START + 2].controller = 2;
705 synth->dispatch[MOD_START + 3].operator = 0;
706 synth->dispatch[MOD_START + 3].controller = 3;
707 synth->dispatch[MOD_START + 4].operator = 0;
708 synth->dispatch[MOD_START + 4].controller = 4;
709 synth->dispatch[MOD_START + 5].operator = 0;
710 synth->dispatch[MOD_START + 5].controller = 5;
711
712 /*
713 * And one parameter for vibrato. This also needs to be a composite of
714 * a few parameters? Er, no, we just need to initialise the vibra values to
715 * vibra only, and a speed. This is just an on/off switch for the vibra
716 */
717 synth->dispatch[MOD_START + 6].operator = 0;
718 synth->dispatch[MOD_START + 6].controller = 126;
719
720 /*
721 * Panel switcher.
722 */
723 synth->dispatch[MOD_START + 7].routine = (synthRoutine) panelSwitch;
724
725 /*
726 * These will be replaced by some opts controllers.
727 */
728 bristolMidiSendMsg(global.controlfd, synth->sid, 1, 0, 550);
729 bristolMidiSendMsg(global.controlfd, synth->sid, 1, 1, 1600);
730 bristolMidiSendMsg(global.controlfd, synth->sid, 1, 2, 0);
731
732 return(0);
733 }
734
735 /*
736 * This will be called to make any routine specific parameters available.
737 */
738 static int
voxConfigure(brightonWindow * win)739 voxConfigure(brightonWindow *win)
740 {
741 guiSynth *synth = findSynth(global.synths, win);
742 brightonEvent event;
743
744 if (synth == 0)
745 {
746 printf("problems going operational\n");
747 return(-1);
748 }
749
750 if (synth->flags & OPERATIONAL)
751 return(0);
752
753 printf("going operational\n");
754
755 synth->flags |= OPERATIONAL;
756 synth->keypanel = 3;
757 synth->keypanel2 = -1;
758 synth->transpose = 36;
759 loadMemory(synth, "vox", 0, synth->location, synth->mem.active,
760 FIRST_DEV, 0);
761 displayPanelText(synth, "PROG", synth->location, MEM_PANEL, MEM_COUNT - 1);
762
763 /*
764 * Hm. This is a hack for a few bits of bad rendering of a keyboard. Only
765 * occurs on first paint, so we suppress the first paint, and then request
766 * an expose here.
767 */
768 event.type = BRIGHTON_EXPOSE;
769 event.intvalue = 1;
770 brightonParamChange(synth->win, KEY_PANEL, -1, &event);
771 configureGlobals(synth);
772 return(0);
773 }
774
775