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 /* ARP Axxe */
23
24 #include <fcntl.h>
25
26 #include "brighton.h"
27 #include "brightonMini.h"
28 #include "brightoninternals.h"
29
30 static int initmem;
31
32 static int odysseyInit();
33 static int odysseyConfigure();
34 static int odysseyCallback(brightonWindow *, int, int, float);
35 /*static int keyCallback(void *, int, int, float); */
36 static int odysseyMemory(brightonWindow *, int, int, float);
37 static void odysseyPanelSwitch(brightonWindow *);
38 static int odysseyMidi(guiSynth *, int);
39 static int midiCallback(brightonWindow *, int, int, float);
40
41 extern guimain global;
42
43 #include "brightonKeys.h"
44
45 #define DEVICE_COUNT 61
46 #define ACTIVE_DEVS 61 /* Actually 57 - should not sve pitch control. */
47 #define MEM_START 0
48 #define MIDI_START (MEM_START + 18)
49
50 #define RADIOSET_1 (ACTIVE_DEVS - 2)
51 #define RADIOSET_2 (RADIOSET_1 + 1)
52
53 #define KEY_PANEL 1
54
55 #define CDIFF 34
56 #define CDIFF2 15
57
58 #define C0 35
59 #define C1 85
60
61 #define C2 132
62 #define C3 (C2 + CDIFF)
63 #define C4 (C3 + CDIFF)
64 #define C5 (C4 + CDIFF)
65 #define C6 (C5 + CDIFF + CDIFF2)
66 #define C7 (C6 + CDIFF)
67 #define C8 (C7 + CDIFF)
68 #define C9 (C8 + CDIFF)
69 #define C10 (C9 + CDIFF + CDIFF2)
70 #define C11 (C10 + CDIFF)
71 #define C12 (C11 + CDIFF + CDIFF)
72 #define C13 (C12 + CDIFF)
73 #define C14 (C13 + CDIFF)
74 #define C15 (C14 + CDIFF)
75 #define C16 (C15 + CDIFF)
76 #define C17 (C16 + CDIFF)
77 #define C18 (C17 + CDIFF)
78 #define C19 (C18 + CDIFF + CDIFF + CDIFF2)
79 #define C20 (C19 + CDIFF)
80 #define C21 (C20 + CDIFF)
81 #define C22 (C21 + CDIFF)
82 #define C23 (C22 + CDIFF)
83
84 #define R4 98
85 #define R0 (R4 + 428)
86 #define R1 (R0 + 205)
87 #define R2 (R0 + 75)
88 #define R5 (R0 + 332)
89
90 #define W1 12
91 #define W2 15
92 #define L1 242
93
94 /*
95 * This structure is for device definition. The structure is defined in
96 * include/brighton.h, further definitions in brighton/brightonDevtable.h and
97 * include/brightoninternals.h
98 *
99 * typedef int (*brightonCallback)(int, float);
100 * typedef struct BrightonLocations {
101 * int device; 0=rotary, 1=scale, etc.
102 * float relx, rely; relative position with regards to 1000 by 1000 window
103 * float relw, relh; relative height.
104 * int from, to;
105 * brightonCallback callback; specific to this dev
106 * char *image; bitmap. If zero take a device default.
107 * int flags;
108 * } brightonLocations;
109 *
110 * This example is for a odysseyBristol type synth interface.
111 */
112
113 static brightonLocations locations[DEVICE_COUNT] = {
114 /* Glide/Tranpose - 0 */
115 {"Glide", 1, C0 - 4, R0, W2, L1, 0, 1, 0,
116 "bitmaps/knobs/sliderArpBlack.xpm", 0, 0},
117 {"Transpose", 2, C1, R2 + 20, 15, L1/2 - 40, 0, 2, 0, 0, 0,
118 BRIGHTON_THREEWAY|BRIGHTON_NOSHADOW},
119
120 /* VCO - 2 */
121 {"VCO1-FM-1", 1, C2, R0, W2, L1, 0, 1, 0,
122 "bitmaps/knobs/sliderArpBlue.xpm", 0, 0},
123 {"VCO1-FM-2", 1, C3, R0, W2, L1, 0, 1, 0,
124 "bitmaps/knobs/sliderArpRed.xpm", 0, 0},
125 {"VCO1-PW", 1, C4, R0, W2, L1, 0, 1, 0,
126 "bitmaps/knobs/sliderArpBlack.xpm", 0, 0},
127 {"VCO1-PWM", 1, C5, R0, W2, L1, 0, 1, 0,
128 "bitmaps/knobs/sliderArpYellow.xpm", 0, 0},
129 {"VCO1-Coarse", 1, C2, R4, W2, L1, 0, 1, 0,
130 "bitmaps/knobs/sliderArpBlue.xpm", 0, BRIGHTON_NOTCH},
131 {"VCO1-Fine", 1, C3, R4, W2, L1, 0, 1, 0,
132 "bitmaps/knobs/sliderArpRed.xpm", 0, BRIGHTON_NOTCH},
133
134 {"VCO1-Mod1-SinSqr", 2, C2, R5, W1 * 3/2, 60, 0, 1, 0,
135 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
136 {"VCO1-Mod2-SH/Env", 2, C3, R5, W1 * 3/2, 60, 0, 1, 0,
137 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
138 {"VCO1-PWM-Sine/Env", 2, C5, R5, W1 * 3/2, 60, 0, 1, 0,
139 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
140 {"VCO1-KBD/LFO", 2, C4, R4, W1 * 3/2, 60, 0, 1, 0,
141 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
142
143 /* VCO2 - 12 */
144 {"VCO2-FM-1", 1, C6, R0, W2, L1, 0, 1, 0,
145 "bitmaps/knobs/sliderArpBlue.xpm", 0, 0},
146 {"VCO2-FM-2", 1, C7, R0, W2, L1, 0, 1, 0,
147 "bitmaps/knobs/sliderArpRed.xpm", 0, 0},
148 {"VCO2-PW", 1, C8, R0, W2, L1, 0, 1, 0,
149 "bitmaps/knobs/sliderArpBlack.xpm", 0, 0},
150 {"VCO2-PWM", 1, C9, R0, W2, L1, 0, 1, 0,
151 "bitmaps/knobs/sliderArpYellow.xpm", 0, 0},
152 {"VCO2-Coarse", 1, C6, R4, W2, L1, 0, 1, 0,
153 "bitmaps/knobs/sliderArpBlue.xpm", 0, BRIGHTON_NOTCH},
154 {"VCO2-Fine", 1, C7, R4, W2, L1, 0, 1, 0,
155 "bitmaps/knobs/sliderArpRed.xpm", 0, BRIGHTON_NOTCH},
156
157 {"VCO2-Mod1-SinS/H", 2, C6, R5, W1 * 3/2, 60, 0, 1, 0,
158 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
159 {"VCO2-Mod2-SH/Env", 2, C7, R5, W1 * 3/2, 60, 0, 1, 0,
160 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
161 {"VCO2-PWM-Sine/Env", 2, C9, R5, W1 * 3/2, 60, 0, 1, 0,
162 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
163 {"VCO2-Sync", 2, C8, R4, W1 * 3/2, 60, 0, 1, 0,
164 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
165
166 /* Mods - 22 */
167 {"S/H-Mix-1", 1, C10, R0, W2, L1, 0, 1, 0,
168 "bitmaps/knobs/sliderArpWhite.xpm", 0, 0},
169 {"S/H-Mix-2", 1, C11, R0, W2, L1, 0, 1, 0,
170 "bitmaps/knobs/sliderArpWhite.xpm", 0, 0},
171 {"S/H-Gain", 1, C12, R0, W2, L1, 0, 1, 0,
172 "bitmaps/knobs/sliderArpBlack.xpm", 0, 0},
173 {"LFO-Freq", 1, C12, R4, W2, L1, 0, 1, 0,
174 "bitmaps/knobs/sliderArpBlack.xpm", 0, 0},
175
176 {"S/H-Mix1-RampSqr", 2, C10, R5, W1 * 3/2, 60, 0, 1, 0,
177 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
178 {"S/H-Mix2-NoiseVCO2", 2, C11, R5, W1 * 3/2, 60, 0, 1, 0,
179 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
180 {"S/H-Trig-KBD/LFO", 2, C12 - CDIFF, R5, W1 * 3/2, 60, 0, 1, 0,
181 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
182
183 /* Filter, etc - 29 */
184 {"Mix-1-Lvl", 1, C13, R0, W2, L1, 0, 1, 0,
185 "bitmaps/knobs/sliderArpYellow.xpm", 0, 0},
186 {"Mix-2-Lvl", 1, C14, R0, W2, L1, 0, 1, 0,
187 "bitmaps/knobs/sliderArpBlue.xpm", 0, 0},
188 {"Mix-3-Lvl", 1, C15, R0, W2, L1, 0, 1, 0,
189 "bitmaps/knobs/sliderArpRed.xpm", 0, 0},
190 {"VCF-Mod-1", 1, C16, R0, W2, L1, 0, 1, 0,
191 "bitmaps/knobs/sliderArpGreen.xpm", 0, 0},
192 {"VCF-Mod-2", 1, C17, R0, W2, L1, 0, 1, 0,
193 "bitmaps/knobs/sliderArpGreen.xpm", 0, 0},
194 {"VCF-Mod-3", 1, C18, R0, W2, L1, 0, 1, 0,
195 "bitmaps/knobs/sliderArpGreen.xpm", 0, 0},
196 {"VCA-EnvLvl", 1, C19, R0, W2, L1, 0, 1, 0,
197 "bitmaps/knobs/sliderArpRed.xpm", 0, 0},
198 {"VCF-Cutoff", 1, C13, R4, W2, L1, 0, 1, 0,
199 "bitmaps/knobs/sliderArpWhite.xpm", 0, 0},
200 {"VCF-Res", 1, C14, R4, W2, L1, 0, 1, 0,
201 "bitmaps/knobs/sliderArpWhite.xpm", 0, 0},
202 {"HPF-Cutoff", 1, C18, R4, W2, L1, 0, 1, 0,
203 "bitmaps/knobs/sliderArpGreen.xpm", 0, 0},
204 {"VCA-Gain", 1, C19, R4, W2, L1, 0, 1, 0,
205 "bitmaps/knobs/sliderArpRed.xpm", 0, 0},
206 /* And its routing - 40 */
207 {"MIX-Noise/RM", 2, C13, R5, W1 * 3/2, 60, 0, 1, 0,
208 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
209 {"MIX-VCO1-RampSqr", 2, C14, R5, W1 * 3/2, 60, 0, 1, 0,
210 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
211 {"MIX-VCO2-RampSqr", 2, C15, R5, W1 * 3/2, 60, 0, 1, 0,
212 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
213 {"VCO-Mod1-KBD/SH", 2, C16, R5, W1 * 3/2, 60, 0, 1, 0,
214 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
215 {"VCO-Mod2-SH/LFO", 2, C17, R5, W1 * 3/2, 60, 0, 1, 0,
216 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
217 {"VCO-Mod3-ADSR/SR", 2, C18, R5, W1 * 3/2, 60, 0, 1, 0,
218 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
219 {"VCA-ADSR/AR", 2, C19, R5, W1 * 3/2, 60, 0, 1, 0,
220 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
221
222 /* ADSR - 47 */
223 {"Attack", 1, C20, R0, W2, L1, 0, 1, 0,
224 "bitmaps/knobs/sliderArpRed.xpm", 0, 0},
225 {"Decay", 1, C21, R0, W2, L1, 0, 1, 0,
226 "bitmaps/knobs/sliderArpRed.xpm", 0, 0},
227 {"Sustain", 1, C22, R0, W2, L1, 0, 1, 0,
228 "bitmaps/knobs/sliderArpRed.xpm", 0, 0},
229 {"Release", 1, C23, R0, W2, L1, 0, 1, 0,
230 "bitmaps/knobs/sliderArpRed.xpm", 0, 0},
231 {"AR-Attack", 1, C20, R4, W2, L1, 0, 1, 0,
232 "bitmaps/knobs/sliderArpRed.xpm", 0, 0},
233 {"AR-Release", 1, C21, R4, W2, L1, 0, 1, 0,
234 "bitmaps/knobs/sliderArpRed.xpm", 0, 0},
235
236 {"ADSR-KBD/REPEAT", 2, C20, R5, W1 * 3/2, 60, 0, 1, 0,
237 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
238 {"ADSR-KBD/AUTO", 2, C22, R5, W1 * 3/2, 60, 0, 1, 0,
239 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
240 {"AR-KBD/REPEAT", 2, C23, R5, W1 * 3/2, 60, 0, 1, 0,
241 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
242
243 /* Pink/White noise - 56 */
244 {"Noise-White/Pink", 2, C1, R4, W1 * 3/2, 60, 0, 1, 0,
245 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
246
247 /* Pitch Control - 57 */
248 {"Pitch-Flat", 2, 25, R5, 30, 60, 0, 1, 0, "bitmaps/buttons/touchnlw.xpm",
249 "bitmaps/buttons/touchnlw.xpm", 0},
250 {"Pitch-Trill", 2, 53, R5, 30, 60, 0, 1, 0, "bitmaps/buttons/touchnlw.xpm",
251 "bitmaps/buttons/touchnlw.xpm", 0},
252 {"Pitch-Sharp", 2, 80, R5, 30, 60, 0, 1, 0, "bitmaps/buttons/touchnlw.xpm",
253 "bitmaps/buttons/touchnlw.xpm", 0},
254
255 /* Dual osc frequencies */
256 {"VCO2-Dual", 2, C8, R4 + 160, W1 * 3/2, 60, 0, 1, 0,
257 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
258 };
259
260 static brightonLocations locations2[DEVICE_COUNT] = {
261 /* Glide/Tranpose - 0 */
262 {"", 1, C0, R0, W1, L1, 0, 1, 0,
263 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
264 // {"", 2, C1, R2, 15, L1/2 - 10, 0, 2, 0, 0, 0,
265 {"Transpose", 2, C1, R2 + 20, 15, L1/2 - 40, 0, 2, 0, 0, 0,
266 BRIGHTON_THREEWAY|BRIGHTON_NOSHADOW},
267
268 /* VCO - 2 */
269 {"", 1, C2, R0, W1, L1, 0, 1, 0,
270 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
271 {"", 1, C3, R0, W1, L1, 0, 1, 0,
272 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
273 {"", 1, C4, R0, W1, L1, 0, 1, 0,
274 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
275 {"", 1, C5, R0, W1, L1, 0, 1, 0,
276 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
277 {"", 1, C2, R4, W1, L1, 0, 1, 0,
278 "bitmaps/knobs/sliderblack3.xpm", 0, BRIGHTON_NOTCH},
279 {"", 1, C3, R4, W1, L1, 0, 1, 0,
280 "bitmaps/knobs/sliderblack3.xpm", 0, BRIGHTON_NOTCH},
281
282 {"", 2, C2, R5, W1 * 3/2, 60, 0, 1, 0,
283 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
284 {"", 2, C3, R5, W1 * 3/2, 60, 0, 1, 0,
285 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
286 {"", 2, C5, R5, W1 * 3/2, 60, 0, 1, 0,
287 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
288 {"", 2, C4, R4, W1 * 3/2, 60, 0, 1, 0,
289 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
290
291 /* VCO2 - 12 */
292 {"", 1, C6, R0, W1, L1, 0, 1, 0,
293 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
294 {"", 1, C7, R0, W1, L1, 0, 1, 0,
295 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
296 {"", 1, C8, R0, W1, L1, 0, 1, 0,
297 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
298 {"", 1, C9, R0, W1, L1, 0, 1, 0,
299 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
300 {"", 1, C6, R4, W1, L1, 0, 1, 0,
301 "bitmaps/knobs/sliderblack3.xpm", 0, BRIGHTON_NOTCH},
302 {"", 1, C7, R4, W1, L1, 0, 1, 0,
303 "bitmaps/knobs/sliderblack3.xpm", 0, BRIGHTON_NOTCH},
304
305 {"", 2, C6, R5, W1 * 3/2, 60, 0, 1, 0,
306 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
307 {"", 2, C7, R5, W1 * 3/2, 60, 0, 1, 0,
308 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
309 {"", 2, C9, R5, W1 * 3/2, 60, 0, 1, 0,
310 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
311 {"", 2, C8, R4, W1 * 3/2, 60, 0, 1, 0,
312 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
313
314 /* Mods - 22 */
315 {"", 1, C10, R0, W1, L1, 0, 1, 0,
316 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
317 {"", 1, C11, R0, W1, L1, 0, 1, 0,
318 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
319 {"", 1, C12, R0, W1, L1, 0, 1, 0,
320 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
321 {"", 1, C12, R4, W1, L1, 0, 1, 0,
322 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
323
324 {"", 2, C10, R5, W1 * 3/2, 60, 0, 1, 0,
325 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
326 {"", 2, C11, R5, W1 * 3/2, 60, 0, 1, 0,
327 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
328 {"", 2, C12 - CDIFF, R5, W1 * 3/2, 60, 0, 1, 0,
329 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
330
331 /* Filter, etc - 29 */
332 {"", 1, C13, R0, W1, L1, 0, 1, 0,
333 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
334 {"", 1, C14, R0, W1, L1, 0, 1, 0,
335 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
336 {"", 1, C15, R0, W1, L1, 0, 1, 0,
337 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
338 {"", 1, C16, R0, W1, L1, 0, 1, 0,
339 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
340 {"", 1, C17, R0, W1, L1, 0, 1, 0,
341 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
342 {"", 1, C18, R0, W1, L1, 0, 1, 0,
343 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
344 {"", 1, C19, R0, W1, L1, 0, 1, 0,
345 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
346 {"", 1, C13, R4, W1, L1, 0, 1, 0,
347 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
348 {"", 1, C14, R4, W1, L1, 0, 1, 0,
349 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
350 {"", 1, C18, R4, W1, L1, 0, 1, 0,
351 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
352 {"", 1, C19, R4, W1, L1, 0, 1, 0,
353 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
354 /* And its routing - 40 */
355 {"", 2, C13, R5, W1 * 3/2, 60, 0, 1, 0,
356 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
357 {"", 2, C14, R5, W1 * 3/2, 60, 0, 1, 0,
358 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
359 {"", 2, C15, R5, W1 * 3/2, 60, 0, 1, 0,
360 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
361 {"", 2, C16, R5, W1 * 3/2, 60, 0, 1, 0,
362 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
363 {"", 2, C17, R5, W1 * 3/2, 60, 0, 1, 0,
364 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
365 {"", 2, C18, R5, W1 * 3/2, 60, 0, 1, 0,
366 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
367 {"", 2, C19, R5, W1 * 3/2, 60, 0, 1, 0,
368 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
369
370 /* ADSR - 47 */
371 {"", 1, C20, R0, W1, L1, 0, 1, 0,
372 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
373 {"", 1, C21, R0, W1, L1, 0, 1, 0,
374 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
375 {"", 1, C22, R0, W1, L1, 0, 1, 0,
376 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
377 {"", 1, C23, R0, W1, L1, 0, 1, 0,
378 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
379 {"", 1, C20, R4, W1, L1, 0, 1, 0,
380 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
381 {"", 1, C21, R4, W1, L1, 0, 1, 0,
382 "bitmaps/knobs/sliderblack3.xpm", 0, 0},
383
384 {"", 2, C20, R5, W1 * 3/2, 60, 0, 1, 0,
385 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
386 {"", 2, C22, R5, W1 * 3/2, 60, 0, 1, 0,
387 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
388 {"", 2, C23, R5, W1 * 3/2, 60, 0, 1, 0,
389 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
390
391 /* Pink/White noise - 56 */
392 {"", 2, C1, R4, W1 * 3/2, 60, 0, 1, 0,
393 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
394
395 /* Pitch Control - 57 */
396 {"", 2, 25, R5, 30, 60, 0, 1, 0, "bitmaps/buttons/touchnlw.xpm",
397 "bitmaps/buttons/touchnlw.xpm", 0},
398 {"", 2, 53, R5, 30, 60, 0, 1, 0, "bitmaps/buttons/touchnlw.xpm",
399 "bitmaps/buttons/touchnlw.xpm", 0},
400 {"", 2, 80, R5, 30, 60, 0, 1, 0, "bitmaps/buttons/touchnlw.xpm",
401 "bitmaps/buttons/touchnlw.xpm", 0},
402
403 /* Dual osc frequencies */
404 {"VCO2-Dual", 2, C8, R4 + 160, W1 * 3/2, 60, 0, 1, 0,
405 "bitmaps/buttons/klunk.xpm", 0, BRIGHTON_VERTICAL},
406 };
407
408 #define BDIFF (CDIFF)
409 #define BDIFF2 (CDIFF2)
410
411 #define B0 190
412 #define B1 (B0 + BDIFF + BDIFF2)
413 #define B2 (B1 + BDIFF)
414 #define B3 (B2 + BDIFF)
415 #define B4 (B3 + BDIFF)
416 #define B5 (B4 + BDIFF)
417 #define B6 (B5 + BDIFF)
418 #define B7 (B6 + BDIFF)
419 #define B8 (B7 + BDIFF)
420 #define B9 (B8 + BDIFF + BDIFF2)
421 #define B10 (B9 + BDIFF)
422 #define B11 (B10 + BDIFF)
423 #define B12 (B11 + BDIFF)
424 #define B13 (B12 + BDIFF)
425 #define B14 (B13 + BDIFF)
426 #define B15 (B14 + BDIFF)
427 #define B16 (B15 + BDIFF)
428 #define B17 (B16 + BDIFF + BDIFF2)
429
430 #define B20 40
431 #define B18 (B20 + BDIFF + BDIFF2 + 10)
432 #define B19 (B18 + BDIFF + BDIFF2)
433
434 #define BL1 500
435
436 #define R3 200
437
438 static brightonLocations memories[21] = {
439 /* Memory Load, mem, Save - 61 */
440 {"", 2, B0, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffw.xpm",
441 "bitmaps/buttons/pressonw.xpm", BRIGHTON_CHECKBUTTON},
442
443 {"", 2, B1, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
444 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
445 {"", 2, B2, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
446 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
447 {"", 2, B3, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
448 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
449 {"", 2, B4, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
450 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
451 {"", 2, B5, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
452 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
453 {"", 2, B6, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
454 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
455 {"", 2, B7, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
456 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
457 {"", 2, B8, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
458 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
459
460 {"", 2, B9, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
461 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
462 {"", 2, B10, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
463 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
464 {"", 2, B11, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
465 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
466 {"", 2, B12, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
467 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
468 {"", 2, B13, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
469 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
470 {"", 2, B14, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
471 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
472 {"", 2, B15, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
473 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
474 {"", 2, B16, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffg.xpm",
475 "bitmaps/buttons/pressong.xpm", BRIGHTON_RADIOBUTTON},
476
477 {"", 2, B17, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffo.xpm",
478 "bitmaps/buttons/pressono.xpm", BRIGHTON_CHECKBUTTON},
479
480 /* MIDI */
481 {"", 2, B18, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffw.xpm",
482 "bitmaps/buttons/pressonw.xpm", BRIGHTON_CHECKBUTTON},
483 {"", 2, B19, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoffw.xpm",
484 "bitmaps/buttons/pressonw.xpm", BRIGHTON_CHECKBUTTON},
485
486 /* Panel switch */
487 {"", 2, B20, R3, 20, BL1, 0, 1, 0, "bitmaps/buttons/pressoff.xpm",
488 "bitmaps/buttons/presson.xpm", BRIGHTON_RADIOBUTTON},
489 };
490
491 /*
492 */
493
494 /*
495 * This is a set of globals for the main window rendering. Again taken from
496 * include/brighton.h
497 */
498 brightonApp odysseyApp = {
499 "odyssey",
500 0, /* no blueprint on background. */
501 "bitmaps/textures/metal4.xpm",
502 0, /* BRIGHTON_STRETCH, //flags */
503 odysseyInit,
504 odysseyConfigure, /* 3 callbacks, unused? */
505 midiCallback,
506 destroySynth,
507 {1, 100, 2, 2, 5, 520, 0, 0},
508 600, 450, 0, 0,
509 6, /* Panels */
510 {
511 {
512 "Odyssey",
513 "bitmaps/blueprints/odyssey2.xpm",
514 "bitmaps/textures/metal4.xpm",
515 BRIGHTON_REVERSE|BRIGHTON_STRETCH, /* flags */
516 0,
517 0,
518 odysseyCallback,
519 15, 0, 970, 680,
520 DEVICE_COUNT,
521 locations
522 },
523 {
524 "Keyboard",
525 0,
526 "bitmaps/newkeys/ekbg.xpm", /* flags */
527 0x020|BRIGHTON_STRETCH,
528 0,
529 0,
530 keyCallback,
531 60, 750, 900, 250,
532 KEY_COUNT_3OCTAVE,
533 keys3octave
534 },
535 {
536 "Odyssey",
537 0,
538 "bitmaps/textures/metal4.xpm",
539 BRIGHTON_STRETCH|BRIGHTON_VERTICAL, /* flags */
540 0,
541 0,
542 0,
543 0, 0, 15, 1000,
544 0,
545 0
546 },
547 {
548 "Odyssey",
549 0,
550 "bitmaps/textures/metal4.xpm",
551 BRIGHTON_STRETCH|BRIGHTON_VERTICAL, /* flags */
552 0,
553 0,
554 0,
555 985, 0, 15, 1000,
556 0,
557 0
558 },
559 {
560 "Odyssey",
561 "bitmaps/blueprints/odyssey.xpm",
562 "bitmaps/textures/metal6.xpm",
563 BRIGHTON_STRETCH, /* flags */
564 0,
565 0,
566 odysseyCallback,
567 15, 0, 970, 680,
568 DEVICE_COUNT,
569 locations2
570 },
571 {
572 "Odyssey",
573 "bitmaps/blueprints/odysseymem.xpm",
574 "bitmaps/textures/metal6.xpm",
575 BRIGHTON_STRETCH, /* flags */
576 0,
577 0,
578 odysseyMemory,
579 15, 680, 970, 70,
580 21,
581 memories
582 }
583 }
584 };
585
586 static int
midiCallback(brightonWindow * win,int controller,int value,float n)587 midiCallback(brightonWindow *win, int controller, int value, float n)
588 {
589 guiSynth *synth = findSynth(global.synths, win);
590
591 printf("midi callback: %x, %i\n", controller, value);
592
593 switch(controller)
594 {
595 case MIDI_PROGRAM:
596 printf("midi program: %x, %i\n", controller, value);
597 synth->location = value;
598 loadMemory(synth, "odyssey", 0, synth->bank + synth->location,
599 synth->mem.active, 0, 0);
600 break;
601 case MIDI_BANK_SELECT:
602 printf("midi banksel: %x, %i\n", controller, value);
603 synth->bank = value;
604 break;
605 }
606 return(0);
607 }
608
609 static int
odysseyMidiSendMsg(void * synth,int fd,int chan,int c,int o,int v)610 odysseyMidiSendMsg(void *synth, int fd, int chan, int c, int o, int v)
611 {
612 bristolMidiSendMsg(fd, chan, c, o, v);
613 return(0);
614 }
615
616 /*
617 * This will be called back with memories, midi and panel switch.
618 */
619 static int
odysseyMemory(brightonWindow * win,int panel,int index,float value)620 odysseyMemory(brightonWindow * win, int panel, int index, float value)
621 {
622 guiSynth *synth = findSynth(global.synths, win);
623 brightonEvent event;
624
625 /*printf("odysseyMemory(%i, %f)\n", index, value); */
626
627 switch(index) {
628 case 17:
629 saveMemory(synth, "odyssey", 0, synth->bank + synth->location, 0);
630 return(0);
631 break;
632 case 0:
633 loadMemory(synth, "odyssey", 0, synth->bank + synth->location,
634 synth->mem.active, 0, 0);
635 return(0);
636 break;
637 case 1:
638 case 2:
639 case 3:
640 case 4:
641 case 5:
642 case 6:
643 case 7:
644 case 8:
645 if (synth->dispatch[RADIOSET_1].other2)
646 {
647 synth->dispatch[RADIOSET_1].other2 = 0;
648 return(0);
649 }
650 if (synth->dispatch[RADIOSET_1].other1 != -1)
651 {
652 synth->dispatch[RADIOSET_1].other2 = 1;
653
654 if (synth->dispatch[RADIOSET_1].other1 != index)
655 event.value = 0;
656 else
657 event.value = 1;
658
659 brightonParamChange(synth->win, 5,
660 synth->dispatch[RADIOSET_1].other1 + MEM_START, &event);
661 }
662 synth->dispatch[RADIOSET_1].other1 = index;
663 synth->bank = index * 10;
664 break;
665 case 9:
666 case 10:
667 case 11:
668 case 12:
669 case 13:
670 case 14:
671 case 15:
672 case 16:
673 if (synth->dispatch[RADIOSET_2].other2)
674 {
675 synth->dispatch[RADIOSET_2].other2 = 0;
676 return(0);
677 }
678 if (synth->dispatch[RADIOSET_2].other1 != -1)
679 {
680 synth->dispatch[RADIOSET_2].other2 = 1;
681
682 if (synth->dispatch[RADIOSET_2].other1 != index)
683 event.value = 0;
684 else
685 event.value = 1;
686
687 brightonParamChange(synth->win, 5,
688 synth->dispatch[RADIOSET_2].other1 + MEM_START, &event);
689 }
690 synth->dispatch[RADIOSET_2].other1 = index;
691 /* Do radio buttons */
692 synth->location = index - 8;
693 break;
694 case 18:
695 /*
696 * Midi down
697 */
698 odysseyMidi(synth, 1);
699 break;
700 case 19:
701 /*
702 * Midi Up
703 */
704 odysseyMidi(synth, 0);
705 break;
706 case 20:
707 /*
708 * Midi Panel Switch
709 */
710 odysseyPanelSwitch(win);
711 break;
712 }
713 return(0);
714 }
715
716 static int
odysseyMidi(guiSynth * synth,int c)717 odysseyMidi(guiSynth *synth, int c)
718 {
719 int newchan;
720
721 if ((synth->flags & OPERATIONAL) == 0)
722 return(0);
723
724 if (c == 1) {
725 if ((newchan = synth->midichannel - 1) < 0)
726 {
727 synth->midichannel = 0;
728 return(0);
729 }
730 } else {
731 if ((newchan = synth->midichannel + 1) >= 16)
732 {
733 synth->midichannel = 15;
734 return(0);
735 }
736 }
737
738 if (global.libtest == 0)
739 {
740 /*
741 * To overcome that we should consider checking a sequence number in
742 * the message library? That is non trivial since it requires that
743 * our midi messges have a 'ack' flag included - we cannot check for
744 * ack here (actually, we could, and in the app is probably the right
745 * place to do it rather than the lib however both would have to be
746 * changed to suppor this - nc).
747 */
748 bristolMidiSendMsg(global.controlfd, synth->sid,
749 127, 0, BRISTOL_MIDICHANNEL|newchan);
750 }
751
752 synth->midichannel = newchan;
753
754 return(0);
755 }
756
757 static int oMark = 4;
758 static float *bs;
759
760 static void
odysseyPanelSwitch(brightonWindow * win)761 odysseyPanelSwitch(brightonWindow * win)
762 {
763 brightonEvent event;
764 guiSynth *synth = findSynth(global.synths, win);
765
766 /*printf("odysseyPanelSwitch()\n"); */
767 /* bcopy(synth->mem.param, bs, DEVICE_COUNT * sizeof(float)); */
768
769 if (oMark == 0)
770 {
771 event.type = BRIGHTON_EXPOSE;
772 event.intvalue = 0;
773 brightonParamChange(synth->win, 0, -1, &event);
774 event.intvalue = 1;
775 brightonParamChange(synth->win, 4, -1, &event);
776 oMark = 4;
777 /* And toggle the filter type - rooney. */
778 /*bristolMidiSendMsg(global.controlfd, synth->sid, 3, 4, 3); */
779 bristolMidiSendMsg(global.controlfd, synth->sid, 3, 4, 4);
780 } else {
781 event.type = BRIGHTON_EXPOSE;
782 event.intvalue = 0;
783 brightonParamChange(synth->win, 4, -1, &event);
784 event.intvalue = 1;
785 brightonParamChange(synth->win, 0, -1, &event);
786 oMark = 0;
787 /* And toggle the filter type - chamberlain. */
788 bristolMidiSendMsg(global.controlfd, synth->sid, 3, 4, 0);
789 }
790
791 /*
792 printf("odysseyPanelSwitch(%i)\n", oMark);
793 event.type = BRIGHTON_FLOAT;
794 for (i = 0; i < ACTIVE_DEVS; i++)
795 {
796 event.value = bs[i];
797 synth->mem.param[i] = bs[i] - 1;
798 brightonParamChange(synth->win, oMark, i, &event);
799 }
800 */
801 }
802
803 int calling = 0;
804 /*
805 * For the sake of ease of use, links have been placed here to be called
806 * by any of the devices created. They would be better in some other file,
807 * perhaps with this as a dispatch.
808 *
809 * Param refers to the device index in the locations table given below.
810 */
811 static int
odysseyCallback(brightonWindow * win,int panel,int index,float value)812 odysseyCallback(brightonWindow * win, int panel, int index, float value)
813 {
814 guiSynth *synth = findSynth(global.synths, win);
815 int sendvalue;
816
817 /*printf("odysseyCallback(%i, %f): %x\n", index, value, synth); */
818
819 if (synth == 0)
820 return(0);
821
822 if (panel != 0)
823 {
824 brightonEvent event;
825
826 /*
827 * We are in the second panel, alternative skin. The GUI will have
828 * changed, but call ourselves back in panel 0 for all other changes.
829 */
830 event.type = BRIGHTON_FLOAT;
831 event.value = value;
832 brightonParamChange(synth->win, 0, index, &event);
833
834 return(0);
835 } else {
836 brightonEvent event;
837 /*
838 * We were in panel 0, we need to adjust the parameter in the next
839 * layer
840 */
841 if (calling)
842 return(0);
843
844 calling = 1;
845
846 event.type = BRIGHTON_FLOAT;
847 event.value = value;
848 brightonParamChange(synth->win, 4, index, &event);
849
850 calling = 0;
851 }
852
853 if ((index >= DEVICE_COUNT) || ((synth->flags & OPERATIONAL) == 0))
854 return(0);
855
856 if (odysseyApp.resources[0].devlocn[index].to == 1.0)
857 sendvalue = value * (CONTROLLER_RANGE - 1);
858 else
859 sendvalue = value;
860
861 synth->mem.param[index] = value;
862
863 if ((!global.libtest) || (index >= ACTIVE_DEVS))
864 synth->dispatch[index].routine(synth,
865 global.controlfd, synth->sid,
866 synth->dispatch[index].controller,
867 synth->dispatch[index].operator,
868 sendvalue);
869
870 #ifdef DEBUG
871 else
872 printf("dispatch[%x,%i](%i, %i, %i, %i, %i)\n", synth, index,
873 global.controlfd, synth->sid,
874 synth->dispatch[index].controller,
875 synth->dispatch[index].operator,
876 sendvalue);
877 #endif
878
879 return(0);
880 }
881
882 static void
odysseyLFO(guiSynth * synth,int fd,int chan,int c,int o,int v)883 odysseyLFO(guiSynth *synth, int fd, int chan, int c, int o, int v)
884 {
885 if (v == 0)
886 bristolMidiSendMsg(global.controlfd, synth->sid, 0, 1, 10);
887 else
888 bristolMidiSendMsg(global.controlfd, synth->sid, 0, 1, 2);
889 }
890
891 static void
odysseyTranspose(guiSynth * synth,int fd,int chan,int c,int o,int v)892 odysseyTranspose(guiSynth *synth, int fd, int chan, int c, int o, int v)
893 {
894 switch (v)
895 {
896 case 0:
897 synth->transpose = 36;
898 break;
899 case 1:
900 synth->transpose = 48;
901 break;
902 case 2:
903 synth->transpose = 60;
904 break;
905 }
906 }
907
908 static void
odysseyFiltOpt(guiSynth * synth,int fd,int chan,int c,int o,int v)909 odysseyFiltOpt(guiSynth *synth, int fd, int chan, int c, int o, int v)
910 {
911 /*
912 * This filter mod is either SH MIX or Keyboard tracking. One causes a
913 * buffer selection, the other is a filter option.
914 */
915 /*printf("odysseyFiltOpt(%i, %i)\n", o, v); */
916 if (o == 23)
917 {
918 /*
919 * Continuous.
920 */
921 if (synth->mem.param[43] == 0)
922 bristolMidiSendMsg(global.controlfd, synth->sid, 126, 23, v);
923 else
924 bristolMidiSendMsg(global.controlfd, synth->sid, 3, 3, v);
925 } else {
926 if (v == 0)
927 {
928 /*
929 * Key tracking switch.
930 */
931 bristolMidiSendMsg(global.controlfd, synth->sid, 126, 31, 0);
932 bristolMidiSendMsg(global.controlfd, synth->sid, 126, 23, 0);
933 bristolMidiSendMsg(global.controlfd, synth->sid, 3, 3,
934 synth->mem.param[32] * C_RANGE_MIN_1);
935 } else {
936 bristolMidiSendMsg(global.controlfd, synth->sid, 126, 31, 1);
937 bristolMidiSendMsg(global.controlfd, synth->sid, 126, 23,
938 synth->mem.param[32] * C_RANGE_MIN_1);
939 bristolMidiSendMsg(global.controlfd, synth->sid, 3, 3, 0);
940 }
941 }
942 }
943
944 static void
arAutoTrig(guiSynth * synth,int fd,int chan,int c,int o,int v)945 arAutoTrig(guiSynth *synth, int fd, int chan, int c, int o, int v)
946 {
947 /*
948 * This takes the LFO value and sends it to the LFO, and if we have auto
949 * trig configured will also send a value to 126/19 for trigger repeat rate.
950 */
951 if (o == 55)
952 {
953 /*
954 * Repeat switch
955 */
956 if (v == 0)
957 {
958 /*
959 * Repeat. Send request and configure AR values
960 */
961 bristolMidiSendMsg(fd, chan, 126, 55, 1);
962
963 bristolMidiSendMsg(global.controlfd, synth->sid, 7, 2, 100);
964 } else {
965 bristolMidiSendMsg(fd, chan, 126, 55, 0);
966
967 bristolMidiSendMsg(global.controlfd, synth->sid, 7, 2, 16383);
968 }
969 return;
970 }
971 if (o == 3) {
972 bristolMidiSendMsg(global.controlfd, synth->sid, 7, 1,
973 (int) (synth->mem.param[52] * C_RANGE_MIN_1));
974 bristolMidiSendMsg(global.controlfd, synth->sid, 7, 3,
975 (int) (synth->mem.param[52] * C_RANGE_MIN_1));
976 return;
977 }
978 }
979
980 /*
981 * Any location initialisation required to run the callbacks. For bristol, this
982 * will connect to the engine, and give it some base parameters.
983 * May need to generate some application specific menus.
984 * Will also then make specific requests to some of the devices to alter their
985 * rendering.
986 */
987 static int
odysseyInit(brightonWindow * win)988 odysseyInit(brightonWindow *win)
989 {
990 guiSynth *synth = findSynth(global.synths, win);
991 dispatcher *dispatch;
992 int i;
993
994 if (synth == 0)
995 {
996 synth = findSynth(global.synths, (int) 0);
997 if (synth == 0)
998 {
999 printf("cannot init\n");
1000 return(0);
1001 }
1002 }
1003
1004 if ((initmem = synth->location) == 0)
1005 initmem = 11;
1006
1007 synth->win = win;
1008
1009 printf("Initialise the odyssey link to bristol: %p\n", synth->win);
1010
1011 synth->mem.param = (float *) brightonmalloc(DEVICE_COUNT * sizeof(float));
1012 bs = (float *) brightonmalloc(DEVICE_COUNT * sizeof(float));
1013 synth->mem.count = DEVICE_COUNT;
1014 synth->mem.active = ACTIVE_DEVS;
1015 synth->dispatch = (dispatcher *)
1016 brightonmalloc(DEVICE_COUNT * sizeof(dispatcher));
1017 dispatch = synth->dispatch;
1018
1019 /*
1020 * We really want to have three connection mechanisms. These should be
1021 * 1. Unix named sockets.
1022 * 2. UDP sockets.
1023 * 3. MIDI pipe.
1024 */
1025 if (!global.libtest)
1026 {
1027 if ((synth->sid = initConnection(&global, synth)) < 0)
1028 return(-1);
1029 }
1030
1031 for (i = 0; i < DEVICE_COUNT; i++)
1032 {
1033 synth->dispatch[i].routine = odysseyMidiSendMsg;
1034 }
1035
1036 /* Glide/Octave */
1037 dispatch[0].controller = 126;
1038 dispatch[0].operator = 0;
1039 dispatch[1].controller = 126;
1040 dispatch[1].operator = 0;
1041 dispatch[1].routine = (synthRoutine) odysseyTranspose;
1042
1043 /* Osc-1 FM MOD */
1044 dispatch[2].controller = 126;
1045 dispatch[2].operator = 2;
1046 dispatch[3].controller = 126;
1047 dispatch[3].operator = 3;
1048 /* Osc-1 PW MOD */
1049 dispatch[4].controller = 0;
1050 dispatch[4].operator = 0;
1051 dispatch[5].controller = 126;
1052 dispatch[5].operator = 4;
1053 /* Osc-1 Freq coarse/fine */
1054 dispatch[6].controller = 0;
1055 dispatch[6].operator = 2;
1056 dispatch[7].controller = 0;
1057 dispatch[7].operator = 10;
1058 /* Osc1 lfo/sh/etc */
1059 dispatch[8].controller = 126;
1060 dispatch[8].operator = 5;
1061 dispatch[9].controller = 126;
1062 dispatch[9].operator = 6;
1063 dispatch[10].controller = 126;
1064 dispatch[10].operator = 7;
1065 /* Osc-1 key/lfo - not done..... */
1066 dispatch[11].controller = 126;
1067 dispatch[11].operator = 100;
1068 dispatch[11].routine = (synthRoutine) odysseyLFO;
1069
1070 /* Osc-2 FM */
1071 dispatch[12].controller = 126;
1072 dispatch[12].operator = 8;
1073 dispatch[13].controller = 126;
1074 dispatch[13].operator = 9;
1075 /* Osc-2 PW */
1076 dispatch[14].controller = 1;
1077 dispatch[14].operator = 0;
1078 dispatch[15].controller = 126;
1079 dispatch[15].operator = 10;
1080 /* Osc-2 Freq coarse/fine */
1081 dispatch[16].controller = 1;
1082 dispatch[16].operator = 2;
1083 dispatch[17].controller = 1;
1084 dispatch[17].operator = 10;
1085 /* Osc-2 lfo/sh/etc */
1086 dispatch[18].controller = 126;
1087 dispatch[18].operator = 11;
1088 dispatch[19].controller = 126;
1089 dispatch[19].operator = 12;
1090 dispatch[20].controller = 126;
1091 dispatch[20].operator = 13;
1092 /* Osc-2 Sync */
1093 dispatch[21].controller = 1;
1094 dispatch[21].operator = 7;
1095
1096 /* SH mixer */
1097 dispatch[22].controller = 126;
1098 dispatch[22].operator = 14;
1099 dispatch[23].controller = 126;
1100 dispatch[23].operator = 15;
1101 /* SH Output? */
1102 dispatch[24].controller = 126;
1103 dispatch[24].operator = 16;
1104 /* LFO freq */
1105 dispatch[25].controller = 2;
1106 dispatch[25].operator = 0;
1107 /* SH Mods */
1108 dispatch[26].controller = 126;
1109 dispatch[26].operator = 17;
1110 dispatch[27].controller = 126;
1111 dispatch[27].operator = 18;
1112 dispatch[28].controller = 126;
1113 dispatch[28].operator = 19;
1114
1115 /* Audio Mixer */
1116 dispatch[29].controller = 126;
1117 dispatch[29].operator = 20;
1118 dispatch[30].controller = 126;
1119 dispatch[30].operator = 21;
1120 dispatch[31].controller = 126;
1121 dispatch[31].operator = 22;
1122 /* VCF Mods */
1123 dispatch[32].controller = 126;
1124 dispatch[32].operator = 23;
1125 dispatch[32].routine = (synthRoutine) odysseyFiltOpt;
1126 dispatch[33].controller = 126;
1127 dispatch[33].operator = 24;
1128 dispatch[34].controller = 126;
1129 dispatch[34].operator = 25;
1130 /* VCA Env */
1131 dispatch[35].controller = 126;
1132 dispatch[35].operator = 26;
1133 /* VCF Cutoff/Req */
1134 dispatch[36].controller = 3;
1135 dispatch[36].operator = 0;
1136 dispatch[37].controller = 3;
1137 dispatch[37].operator = 1;
1138 /* HPF Cutoff */
1139 dispatch[38].controller = 9;
1140 dispatch[38].operator = 0;
1141 /* VCA Gain */
1142 dispatch[39].controller = 126;
1143 dispatch[39].operator = 27;
1144 /* Diverse Mods */
1145 dispatch[40].controller = 126;
1146 dispatch[40].operator = 28;
1147 dispatch[41].controller = 126;
1148 dispatch[41].operator = 29;
1149 dispatch[42].controller = 126;
1150 dispatch[42].operator = 30;
1151 dispatch[43].controller = 126;
1152 dispatch[43].operator = 31;
1153 dispatch[43].routine = (synthRoutine) odysseyFiltOpt;
1154 dispatch[44].controller = 126;
1155 dispatch[44].operator = 32;
1156 dispatch[45].controller = 126;
1157 dispatch[45].operator = 33;
1158 dispatch[46].controller = 126;
1159 dispatch[46].operator = 34;
1160
1161 /* ADSR */
1162 dispatch[47].controller = 4;
1163 dispatch[47].operator = 0;
1164 dispatch[48].controller = 4;
1165 dispatch[48].operator = 1;
1166 dispatch[49].controller = 4;
1167 dispatch[49].operator = 2;
1168 dispatch[50].controller = 4;
1169 dispatch[50].operator = 3;
1170 /* AR */
1171 dispatch[51].controller = 7;
1172 dispatch[51].operator = 0;
1173 dispatch[52].controller = 7;
1174 dispatch[52].operator = 3;
1175 dispatch[52].routine = (synthRoutine) arAutoTrig;
1176 /* Env Mods */
1177 dispatch[53].controller = 126;
1178 dispatch[53].operator = 53;
1179 dispatch[54].controller = 126;
1180 dispatch[54].operator = 49;
1181 dispatch[55].controller = 126;
1182 dispatch[55].operator = 55;
1183 dispatch[55].routine = (synthRoutine) arAutoTrig;
1184
1185 /* Noise white/pink */
1186 dispatch[56].controller = 6;
1187 dispatch[56].operator = 1;
1188
1189 /* PPC */
1190 dispatch[57].controller = 126;
1191 dispatch[57].operator = 57;
1192 dispatch[58].controller = 126;
1193 dispatch[58].operator = 58;
1194 dispatch[59].controller = 126;
1195 dispatch[59].operator = 59;
1196 dispatch[60].controller = 126;
1197 dispatch[60].operator = 60;
1198
1199 /*
1200 * Need to specify env gain fixed, filter mod on, osc waveform.
1201 */
1202 bristolMidiSendMsg(global.controlfd, synth->sid, 4, 4, 16383);
1203 bristolMidiSendMsg(global.controlfd, synth->sid, 3, 2, 16383);
1204 bristolMidiSendMsg(global.controlfd, synth->sid, 3, 4, 4);
1205
1206 bristolMidiSendMsg(global.controlfd, synth->sid, 126, 49, 0);
1207 bristolMidiSendMsg(global.controlfd, synth->sid, 2, 1, 0);
1208
1209 /* These will change the ringmod osc */
1210 bristolMidiSendMsg(global.controlfd, synth->sid, 8, 3, 16383);
1211 bristolMidiSendMsg(global.controlfd, synth->sid, 8, 1, 5);
1212 bristolMidiSendMsg(global.controlfd, synth->sid, 8, 8, 16383);
1213
1214 /* AR envelope fixed parameters. */
1215 bristolMidiSendMsg(global.controlfd, synth->sid, 7, 1, 16383);
1216 bristolMidiSendMsg(global.controlfd, synth->sid, 7, 2, 16383);
1217 bristolMidiSendMsg(global.controlfd, synth->sid, 7, 4, 16383);
1218
1219 /* Ringmodd parameters. */
1220 bristolMidiSendMsg(global.controlfd, synth->sid, 8, 0, 16383);
1221 bristolMidiSendMsg(global.controlfd, synth->sid, 8, 1, 128);
1222 bristolMidiSendMsg(global.controlfd, synth->sid, 8, 2, 16383);
1223
1224 /*
1225 * Grooming env for 'gain' to amp. Short but not choppy attack, slightly
1226 * larger decay since the main env can shorten that if really desired.
1227 */
1228 bristolMidiSendMsg(global.controlfd, synth->sid, 10, 0, 20);
1229 bristolMidiSendMsg(global.controlfd, synth->sid, 10, 1, 1000);
1230 bristolMidiSendMsg(global.controlfd, synth->sid, 10, 2, 16383);
1231 bristolMidiSendMsg(global.controlfd, synth->sid, 10, 3, 50);
1232 bristolMidiSendMsg(global.controlfd, synth->sid, 10, 4, 16383);
1233 bristolMidiSendMsg(global.controlfd, synth->sid, 10, 5, 0); /* - velocity */
1234 bristolMidiSendMsg(global.controlfd, synth->sid, 10, 6, 0); /* - rezero */
1235
1236 return(0);
1237 }
1238
1239 /*
1240 * This will be called to make any routine specific parameters available.
1241 */
1242 static int
odysseyConfigure(brightonWindow * win)1243 odysseyConfigure(brightonWindow* win)
1244 {
1245 guiSynth *synth = findSynth(global.synths, win);
1246 brightonEvent event;
1247
1248 if (synth == 0)
1249 {
1250 printf("problems going operational\n");
1251 return(-1);
1252 }
1253
1254 if (synth->flags & OPERATIONAL)
1255 return(0);
1256
1257 printf("going operational\n");
1258
1259 synth->flags |= OPERATIONAL;
1260 synth->keypanel = 1;
1261 synth->keypanel2 = -1;
1262 synth->transpose = 36;
1263
1264 if (synth->location == 1)
1265 {
1266 synth->bank = 10;
1267 synth->location = 11;
1268 }
1269
1270 loadMemory(synth, "odyssey", 0, initmem, synth->mem.active, 0, 0);
1271
1272 event.value = 1;
1273 brightonParamChange(synth->win, 5, MEM_START + 1, &event);
1274 brightonParamChange(synth->win, 5, MEM_START + 9, &event);
1275
1276 brightonPut(win,
1277 "bitmaps/blueprints/odysseyshade.xpm", 0, 0, win->width, win->height);
1278
1279 /*
1280 * Hm. This is a hack for a few bits of bad rendering of a keyboard. Only
1281 * occurs on first paint, so we suppress the first paint, and then request
1282 * an expose here.
1283 */
1284 event.type = BRIGHTON_EXPOSE;
1285 event.intvalue = 1;
1286 brightonParamChange(synth->win, KEY_PANEL, -1, &event);
1287
1288 /*
1289 * Touch a key on/off
1290 */
1291 /* bristolMidiSendMsg(global.controlfd, synth->midichannel, */
1292 /* BRISTOL_EVENT_KEYON, 0, 10 + synth->transpose); */
1293 /* bristolMidiSendMsg(global.controlfd, synth->midichannel, */
1294 /* BRISTOL_EVENT_KEYOFF, 0, 10 + synth->transpose); */
1295 configureGlobals(synth);
1296 return(0);
1297 }
1298
1299