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 "brightonKeys.h"
28 #include "brightonMixer.h"
29 #include "brightonMixerMemory.h"
30 
31 static int mixInit();
32 static int mixConfigure();
33 static int mixCallback(brightonWindow *, int, int, float);
34 
35 extern guimain global;
36 
37 extern int functionOp(guiSynth *, int, int, int, float);
38 extern void mixerMemory(guiSynth *, int, int, int, float *);
39 extern int loadMixerMemory(guiSynth *, char *, int);
40 extern int setMixerMemory(mixerMem *, int, int, float *, char *);
41 
42 
43 static void mixSendMsg(guiSynth *, int, int, int, int, int);
44 
45 /* brightonMixerMemory.c */
46 extern void *initMixerMemory(int count);
47 
48 /*
49  * The last parameter, device count, was used to define a memory structure.
50  * This is used by the GUI parameter changes to store the parameter values. From
51  * here we should be able to save the structure.
52  *
53  * Personally I think we should define a memory structure that is overlayed
54  * onto the array of floats that defines the actual memory space. To allow for
55  * extensability then bussing should come first, then tracks listed from '1'.
56  * The function section which includes master volume is not saved.
57  */
58 
59 /*
60  * This structure is for device definition. The structure is defined in
61  * include/brighton.h, further definitions in brighton/brightonDevtable.h and
62  * include/brightoninternals.h
63  *
64  *	typedef int (*brightonCallback)(int, float);
65  *	typedef struct BrightonLocations {
66  *		int device; 0=rotary, 1=scale, etc.
67  *		float relx, rely; relative position with regards to 1000 by 1000 window
68  *		float relw, relh; relative height.
69  *		int from, to;
70  *		brightonCallback callback; specific to this dev
71  *		char *image; bitmap. If zero take a device default.
72  *		int flags;
73  *	} brightonLocations;
74  *
75  * This example is for a mixBristol type synth interface.
76  */
77 #define CD1 37
78 #define R1 46
79 #define R2 (R1 + CD1)
80 #define R3 (R2 + CD1)
81 #define R4 (R3 + CD1)
82 #define R5 (R4 + CD1)
83 #define R6 (R5 + CD1)
84 #define R7 (R6 + CD1)
85 #define R8 (R7 + CD1)
86 #define R9 (R8 + CD1)
87 #define R10 (R9 + CD1)
88 #define R11 (R10 + CD1)
89 #define R12 (R11 + CD1)
90 #define R13 (R12 + CD1)
91 #define R14 (R13 + CD1)
92 #define R15 (R14 + CD1)
93 #define R16 (R15 + CD1)
94 #define R17 (R16 + CD1)
95 #define R18 (R17 + CD1)
96 
97 #define RSL 741
98 #define RTX (RSL + 50)
99 
100 #define D1 180
101 
102 #define C0 120
103 #define C1 275
104 #define C2 100
105 #define C3 600
106 #define C4 350
107 
108 #define C5 75
109 #define C6 400
110 #define C7 725
111 
112 #define C8 30
113 #define C9 275
114 #define C10 525
115 #define C11 760
116 
117 #define C12 770
118 
119 #define S1 450
120 #define S2 40
121 #define SB3 225
122 #define SB4 11
123 #define SB5 20
124 #define SB6 200
125 #define SB7 9
126 
127 #define BH 10
128 #define BH1 9
129 
130 #define BB1 2
131 #define BB2 (BB1 + BH)
132 #define BB3 (BB2 + BH)
133 #define BB4 (BB3 + BH)
134 
135 #define BBR1 685
136 #define BBR2 (BBR1 + BH)
137 #define BBR3 (BBR2 + BH)
138 #define BBR4 (BBR3 + BH)
139 #define BBR5 (BBR4 + BH)
140 
141 /*
142  * This should be organised such that continuous controllers are located first,
143  * then buttons? The benefits of such an organisation is that the continuous
144  * controllers are likely to be extended, and the button groups tend to be
145  * exclusive, so whilst we have 16 IO selectors, for example, these are only
146  * represented by one parameter, the channel number.
147  */
148 static brightonLocations locations[MEM_COUNT] = {
149 	/*
150 	 * Input channel select buttons
151 	 */
152 	{"", 2, C8, BB1, SB3, SB4, 0, 1.01, 0,
153 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
154 	{"", 2, C9, BB1, SB3, SB4, 0, 1.01, 0,
155 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
156 	{"", 2, C10, BB1, SB3, SB4, 0, 1.01, 0,
157 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
158 	{"", 2, C11, BB1, SB3, SB4, 0, 1.01, 0,
159 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
160 	{"", 2, C8, BB2, SB3, SB4, 0, 1.01, 0,
161 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
162 	{"", 2, C9, BB2, SB3, SB4, 0, 1.01, 0,
163 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
164 	{"", 2, C10, BB2, SB3, SB4, 0, 1.01, 0,
165 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
166 	{"", 2, C11, BB2, SB3, SB4, 0, 1.01, 0,
167 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
168 	{"", 2, C8, BB3, SB3, SB4, 0, 1.01, 0,
169 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
170 	{"", 2, C9, BB3, SB3, SB4, 0, 1.01, 0,
171 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
172 	{"", 2, C10, BB3, SB3, SB4, 0, 1.01, 0,
173 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
174 	{"", 2, C11, BB3, SB3, SB4, 0, 1.01, 0,
175 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
176 	{"", 2, C8, BB4, SB3, SB4, 0, 1.01, 0,
177 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
178 	{"", 2, C9, BB4, SB3, SB4, 0, 1.01, 0,
179 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
180 	{"", 2, C10, BB4, SB3, SB4, 0, 1.01, 0,
181 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
182 	{"", 2, C11, BB4, SB3, SB4, 0, 1.01, 0,
183 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
184 
185 	/*
186 	 * presend select
187 	 */
188 	{"", 2, C12, R2, SB3, SB7, 0, 1.01, 0,
189 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW},
190 	{"", 2, C12, R2 + 10, SB3, SB7, 0, 1.01, 0,
191 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW},
192 	{"", 2, C12, R2 + 19, SB3, SB7, 0, 1.01, 0,
193 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW},
194 	{"", 2, C12, R2 + 29, SB3, SB7, 0, 1.01, 0,
195 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW},
196 
197 	/*
198 	 * Dynamics select
199 	{"", 2, C12, R3, SB3, SB7, 0, 1.01, 0,
200 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
201 	 */
202 	{"", 2, C12, R5 + 0, SB3, SB7, 0, 1.01, 0,
203 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
204 	{"", 2, C12, R5 + 10, SB3, SB7, 0, 1.01, 0,
205 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
206 	{"", 2, C12, R5 + 20, SB3, SB7, 0, 1.01, 0,
207 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
208 
209 	/*
210 	 * Filter select
211 	 */
212 	{"", 2, C12, R10 + 1, SB3, SB7, 0, 1.01, 0,
213 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
214 	{"", 2, C12, R10 + 11, SB3, SB7, 0, 1.01, 0,
215 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
216 	{"", 2, C12, R10 + 21, SB3, SB7, 0, 1.01, 0,
217 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
218 	{"", 2, C12, R10 + 31, SB3, SB7, 0, 1.01, 0,
219 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
220 
221 	/*
222 	 * postsend select
223 	 */
224 	{"", 2, C12, R13 + 0, SB3, SB7, 0, 1.01, 0,
225 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW},
226 	{"", 2, C12, R13 + 9, SB3, SB7, 0, 1.01, 0,
227 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW},
228 	{"", 2, C12, R13 + 19, SB3, SB7, 0, 1.01, 0,
229 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW},
230 	{"", 2, C12, R13 + 29, SB3, SB7, 0, 1.01, 0,
231 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW},
232 
233 	/*
234 	 * Effects select: reverb, echo, chorus, flanger, tremelo, vibrato, delay
235 	 */
236 	{"", 2, C12, R14 + 6, SB3, SB7, 0, 1.01, 0,
237 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
238 	{"", 2, C12, R14 + 16, SB3, SB7, 0, 1.01, 0,
239 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
240 	{"", 2, C12, R14 + 26, SB3, SB7, 0, 1.01, 0,
241 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
242 	{"", 2, C12, R14 + 35, SB3, SB7, 0, 1.01, 0,
243 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
244 	{"", 2, C12, R14 + 45, SB3, SB7, 0, 1.01, 0,
245 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
246 	{"", 2, C12, R14 + 55, SB3, SB7, 0, 1.01, 0,
247 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
248 	{"", 2, C12, R14 + 65, SB3, SB7, 0, 1.01, 0,
249 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
250 
251 	{"", 0, C1, R1, S1, S2, 0, 1, 0, "bitmaps/knobs/knobred.xpm", 0, 0},
252 	{"", 0, C0, R2, S1, S2, 0, 1, 0, "bitmaps/knobs/knobyellow.xpm", 0, 0},
253 	{"", 0, C0, R3, S1, S2, 0, 1, 0, "bitmaps/knobs/knob.xpm", 0, 0},
254 	{"", 0, C0, R4, S1, S2, 0, 1, 0, "bitmaps/knobs/knobblue.xpm", 0, 0},
255 	{"", 0, C0, R5, S1, S2, 0, 1, 0, "bitmaps/knobs/knobblue.xpm", 0, 0},
256 	{"", 0, C0, R6, S1, S2, 0, 1, 0, "bitmaps/knobs/knobblue.xpm", 0, 0},
257 	{"", 0, C0, R7, S1, S2, 0, 1, 0, "bitmaps/knobs/knobblue.xpm", 0, 0},
258 	{"", 0, C0, R8, S1, S2, 0, 1, 0, "bitmaps/knobs/knobgreen.xpm", 0, 0},
259 	{"", 0, C0, R9, S1, S2, 0, 1, 0, "bitmaps/knobs/knobgreen.xpm", 0, 0},
260 	{"", 0, C0, R10, S1, S2, 0, 1, 0, "bitmaps/knobs/knob.xpm", 0, 0},
261 	{"", 0, C0, R11, S1, S2, 0, 1, 0, "bitmaps/knobs/knobgreen.xpm", 0, 0},
262 	{"", 0, C0, R12, S1, S2, 0, 1, 0, "bitmaps/knobs/knobgreen.xpm", 0, 0},
263 	{"", 0, C0, R13, S1, S2, 0, 1, 0, "bitmaps/knobs/knobblue.xpm", 0, 0},
264 	{"", 0, C0, R14, S1, S2, 0, 1, 0, "bitmaps/knobs/knoborange.xpm", 0, 0},
265 	{"", 0, C0, R15, S1, S2, 0, 1, 0, "bitmaps/knobs/knoborange.xpm", 0, 0},
266 	{"", 0, C0, R16, S1, S2, 0, 1, 0, "bitmaps/knobs/knoborange.xpm", 0, 0},
267 	{"", 0, C1, R17, S1, S2, 0, 1, 0, "bitmaps/knobs/knobyellow.xpm", 0, BRIGHTON_NOTCH},
268 
269 	/*
270 	 * Mute/Solo/Boost
271 	 */
272 	{"", 2, C5, R18, SB3, SB4, 0, 1.01, 0,
273 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
274 	{"", 2, C6, R18, SB3, SB4, 0, 1.01, 0,
275 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
276 	{"", 2, C7, R18, SB3, SB4, 0, 1.01, 0,
277 		"bitmaps/buttons/pressoffS.xpm", "bitmaps/buttons/pressonS.xpm", BRIGHTON_NOSHADOW},
278 
279 	/*
280 	 * Output channel select buttons
281 	 */
282 	{"", 2, C8, BBR1, SB3, SB4, 0, 1.01, 0,
283 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
284 	{"", 2, C9, BBR1, SB3, SB4, 0, 1.01, 0,
285 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
286 	{"", 2, C10, BBR1, SB3, SB4, 0, 1.01, 0,
287 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
288 	{"", 2, C11, BBR1, SB3, SB4, 0, 1.01, 0,
289 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
290 	{"", 2, C8, BBR2, SB3, SB4, 0, 1.01, 0,
291 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
292 	{"", 2, C9, BBR2, SB3, SB4, 0, 1.01, 0,
293 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
294 	{"", 2, C10, BBR2, SB3, SB4, 0, 1.01, 0,
295 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
296 	{"", 2, C11, BBR2, SB3, SB4, 0, 1.01, 0,
297 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
298 	{"", 2, C8, BBR3, SB3, SB4, 0, 1.01, 0,
299 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
300 	{"", 2, C9, BBR3, SB3, SB4, 0, 1.01, 0,
301 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
302 	{"", 2, C10, BBR3, SB3, SB4, 0, 1.01, 0,
303 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
304 	{"", 2, C11, BBR3, SB3, SB4, 0, 1.01, 0,
305 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
306 	{"", 2, C8, BBR4, SB3, SB4, 0, 1.01, 0,
307 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
308 	{"", 2, C9, BBR4, SB3, SB4, 0, 1.01, 0,
309 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
310 	{"", 2, C10, BBR4, SB3, SB4, 0, 1.01, 0,
311 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
312 	{"", 2, C11, BBR4, SB3, SB4, 0, 1.01, 0,
313 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW},
314 
315 	/*
316 	 * Bus select buttons
317 	 */
318 	{"", 2, C8, BBR5, SB3, SB4, 0, 1.01, 0,
319 		"bitmaps/buttons/pressoffSb.xpm", "bitmaps/buttons/pressonSb.xpm", BRIGHTON_NOSHADOW},
320 	{"", 2, C9, BBR5, SB3, SB4, 0, 1.01, 0,
321 		"bitmaps/buttons/pressoffSb.xpm", "bitmaps/buttons/pressonSb.xpm", BRIGHTON_NOSHADOW},
322 	{"", 2, C10, BBR5, SB3, SB4, 0, 1.01, 0,
323 		"bitmaps/buttons/pressoffSb.xpm", "bitmaps/buttons/pressonSb.xpm", BRIGHTON_NOSHADOW},
324 	{"", 2, C11, BBR5, SB3, SB4, 0, 1.01, 0,
325 		"bitmaps/buttons/pressoffSb.xpm", "bitmaps/buttons/pressonSb.xpm", BRIGHTON_NOSHADOW},
326 
327 	{"", 1, C4 - 25, RSL, 360, 226, 0, 1, 0, "bitmaps/knobs/sliderblack2.xpm", 0, 0},
328 	/* Finally the display. This is the 80th location (0..79). */
329 	{"", 3, 0, 977, 1000, 13, 0, 1, 0, "bitmaps/digits/display2.xpm", 0, 0}
330 };
331 
332 #define BS1 80
333 #define BS2 70
334 
335 #define BRD1 100
336 #define BRD2 72
337 
338 #define BR1 11
339 #define BR2 (BR1 + BRD2)
340 #define BR3 (BR2 + BRD2)
341 #define BR4 (BR3 + BRD2)
342 #define BR5 (BR4 + BRD2)
343 #define BR6 (BR5 + BRD2)
344 #define BR7 (BR6 + BRD2)
345 #define BR8 (BR7 + BRD2)
346 #define BR9 (BR8 + BRD2)
347 
348 #define BR10 (BR9 + BRD2)
349 
350 #define BCD1 100
351 #define BCD2 125
352 
353 #define BC1 35
354 #define BC2 200
355 #define BC3 350
356 #define BC4 550
357 #define BC5 700
358 #define BC6 850
359 
360 #define BC7 (BC1 + BCD2)
361 #define BC8 (BC7 + BCD2)
362 #define BC9 (BC8 + BCD2)
363 #define BC10 (BC9 + BCD2)
364 #define BC11 (BC10 + BCD2)
365 #define BC12 (BC11 + BCD2)
366 #define BC13 (BC12 + BCD2)
367 
368 #define FRS1 125
369 
370 #define FBC0 5
371 #define FBC1 (115)
372 #define FBC2 (FBC1 + FRS1)
373 #define FBC3 (FBC2 + FRS1)
374 #define FBC4 (FBC3 + FRS1)
375 #define FBC5 (FBC4 + FRS1)
376 #define FBC6 (FBC5 + FRS1)
377 #define FBC7 860
378 
379 #define FBW1 35
380 #define FBW2 32
381 
382 #define FBH1 13
383 
384 #define FBS1 70
385 
386 /*
387  * One effect - FX select, some params, output channels selection.
388  */
389 
390 #define FXBUS(off) \
391 	{"", 0, FBC1, off, FBS1, FBS1, 0, 1, 0, \
392 		"bitmaps/knobs/knobgreen.xpm", 0, 0}, \
393 	{"", 0, FBC2, off, FBS1, FBS1, 0, 1, 0, \
394 		"bitmaps/knobs/knoborange.xpm", 0, 0}, \
395 	{"", 0, FBC3, off, FBS1, FBS1, 0, 1, 0, \
396 		"bitmaps/knobs/knoborange.xpm", 0, 0}, \
397 	{"", 0, FBC4, off, FBS1, FBS1, 0, 1, 0, \
398 		"bitmaps/knobs/knoborange.xpm", 0, 0}, \
399 	{"", 0, FBC5, off, FBS1, FBS1, 0, 1, 0, \
400 		"bitmaps/knobs/knobyellow.xpm", 0, BRIGHTON_NOTCH}, \
401 	{"", 0, FBC6, off, FBS1, FBS1, 0, 1, 0, \
402 		"bitmaps/knobs/knobred.xpm", 0, 0}, \
403 	{"", 2, FBC0, off + 0, FBW1, FBH1, 0, 1.01, 0, \
404 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW}, \
405 	{"", 2, FBC0, off + 13, FBW1, FBH1, 0, 1.01, 0, \
406 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW}, \
407 	{"", 2, FBC0, off + 26, FBW1, FBH1, 0, 1.01, 0, \
408 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW}, \
409 	{"", 2, FBC0, off + 39, FBW1, FBH1, 0, 1.01, 0, \
410 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW}, \
411 	{"", 2, FBC0 + FBW1 + 5, off + 0, FBW1, FBH1, 0, 1.01, 0, \
412 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW}, \
413 	{"", 2, FBC0 + FBW1 + 5, off + 13, FBW1, FBH1, 0, 1.01, 0, \
414 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW}, \
415 	{"", 2, FBC0 + FBW1 + 5, off + 26, FBW1, FBH1, 0, 1.01, 0, \
416 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW}, \
417 	{"", 2, FBC0 + FBW1 + 5, off + 39, FBW1, FBH1, 0, 1.01, 0, \
418 		"bitmaps/buttons/pressoffSy.xpm", "bitmaps/buttons/pressonSy.xpm", BRIGHTON_NOSHADOW}, \
419 	\
420 	{"", 2, FBC7 + FBW1 * 0 + 3, off + 0, FBW2, FBH1, 0, 1.01, 0, \
421 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}, \
422 	{"", 2, FBC7 + FBW1 * 1 + 1, off + 0, FBW2, FBH1, 0, 1.01, 0, \
423 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}, \
424 	{"", 2, FBC7 + FBW1 * 2, off + 0, FBW2, FBH1, 0, 1.01, 0, \
425 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}, \
426 	{"", 2, FBC7 + FBW1 * 3, off + 0, FBW2, FBH1, 0, 1.01, 0, \
427 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}, \
428 	{"", 2, FBC7 + FBW1 * 0 + 3, off + 13, FBW2, FBH1, 0, 1.01, 0, \
429 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}, \
430 	{"", 2, FBC7 + FBW1 * 1 + 1, off + 13, FBW2, FBH1, 0, 1.01, 0, \
431 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}, \
432 	{"", 2, FBC7 + FBW1 * 2, off + 13, FBW2, FBH1, 0, 1.01, 0, \
433 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}, \
434 	{"", 2, FBC7 + FBW1 * 3, off + 13, FBW2, FBH1, 0, 1.01, 0, \
435 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}, \
436 	{"", 2, FBC7 + FBW1 * 0 + 3, off + 26, FBW2, FBH1, 0, 1.01, 0, \
437 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}, \
438 	{"", 2, FBC7 + FBW1 * 1 + 1, off + 26, FBW2, FBH1, 0, 1.01, 0, \
439 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}, \
440 	{"", 2, FBC7 + FBW1 * 2, off + 26, FBW2, FBH1, 0, 1.01, 0, \
441 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}, \
442 	{"", 2, FBC7 + FBW1 * 3, off + 26, FBW2, FBH1, 0, 1.01, 0, \
443 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}, \
444 	{"", 2, FBC7 + FBW1 * 0 + 3, off + 39, FBW2, FBH1, 0, 1.01, 0, \
445 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}, \
446 	{"", 2, FBC7 + FBW1 * 1 + 1, off + 39, FBW2, FBH1, 0, 1.01, 0, \
447 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}, \
448 	{"", 2, FBC7 + FBW1 * 2, off + 39, FBW2, FBH1, 0, 1.01, 0, \
449 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}, \
450 	{"", 2, FBC7 + FBW1 * 3, off + 39, FBW2, FBH1, 0, 1.01, 0, \
451 		"bitmaps/buttons/pressoffSg.xpm", "bitmaps/buttons/pressonSg.xpm", BRIGHTON_NOSHADOW}
452 /*16 = 30 */
453 
454 /* FX Bus definitions: */
455 static brightonLocations busses[BUS_COUNT] = {
456 	/* Bus groups */
457 	FXBUS(BR1),
458 	FXBUS(BR2),
459 	FXBUS(BR3),
460 	FXBUS(BR4),
461 	FXBUS(BR5),
462 	FXBUS(BR6),
463 	FXBUS(BR7),
464 	FXBUS(BR8),
465 /* 40 * 8 = 320 */
466 #define BSL 299
467 	{"", 0, BC1 + 40, BR9, BS1, BS2, 0, 1, 0, "bitmaps/knobs/knob2.xpm", 0, BRIGHTON_NOTCH},
468 	{"", 1, BC1, BR10, 55, BSL, 0, 1, 0,
469 		"bitmaps/knobs/sliderblack2.xpm", 0, 0},
470 	{"", 1, BC7, BR10, 55, BSL, 0, 1, 0,
471 		"bitmaps/knobs/sliderblack2.xpm", 0, 0},
472 	{"", 0, BC8 + 40, BR9, BS1, BS2, 0, 1, 0, "bitmaps/knobs/knob2.xpm", 0, BRIGHTON_NOTCH},
473 	{"", 1, BC8, BR10, 55, BSL, 0, 1, 0,
474 		"bitmaps/knobs/sliderblack2.xpm", 0, 0},
475 	{"", 1, BC9, BR10, 55, BSL, 0, 1, 0,
476 		"bitmaps/knobs/sliderblack2.xpm", 0, 0},
477 	{"", 0, BC10 + 40, BR9, BS1, BS2, 0, 1, 0, "bitmaps/knobs/knob2.xpm", 0, BRIGHTON_NOTCH},
478 	{"", 1, BC10, BR10, 55, BSL, 0, 1, 0,
479 		"bitmaps/knobs/sliderblack2.xpm", 0, 0},
480 	{"", 1, BC11, BR10, 55, BSL, 0, 1, 0,
481 		"bitmaps/knobs/sliderblack2.xpm", 0, 0},
482 	{"", 0, BC12 + 40, BR9, BS1, BS2, 0, 1, 0, "bitmaps/knobs/knob2.xpm", 0, BRIGHTON_NOTCH},
483 	{"", 1, BC12, BR10, 55, BSL, 0, 1, 0,
484 		"bitmaps/knobs/sliderblack2.xpm", 0, 0},
485 	{"", 1, BC13, BR10, 55, BSL, 0, 1, 0,
486 		"bitmaps/knobs/sliderblack2.xpm", 0, 0},
487 /* total = 12 + 320 = 332 */
488 };
489 
490 #define MC1 150
491 #define MC2 200
492 #define MC3 650
493 
494 #define MS1 240
495 
496 /* Don't think we pack this?
497 static brightonLocations master[MASTER_COUNT] = {
498 	{"", 0, MC2, BR8, 600, 600, 0, 1, 0, 0, 0, 0},
499 	{"", 1, MC1 + 50, BR10, 130, BSL, 0, 1, 0,
500 		"bitmaps/knobs/sliderblack2.xpm", 0, 0},
501 	{"", 1, MC3, BR10, 130, BSL, 0, 1, 0,
502 		"bitmaps/knobs/sliderblack2.xpm", 0, 0},
503 	{"", 0, MC1, BR1, MS1, MS1, 0, 1, 0, "bitmaps/knobs/knob.xpm", 0, 0},
504 	{"", 0, MC1, BR2, MS1, MS1, 0, 1, 0, "bitmaps/knobs/knobblue.xpm", 0, 0},
505 	{"", 0, MC1, BR3, MS1, MS1, 0, 1, 0, "bitmaps/knobs/knobblue.xpm", 0, 0},
506 	{"", 0, MC1, BR4, MS1, MS1, 0, 1, 0, "bitmaps/knobs/knobblue.xpm", 0, 0},
507 	{"", 0, MC1, BR5, MS1, MS1, 0, 1, 0, "bitmaps/knobs/knobgreen.xpm", 0, 0},
508 	{"", 0, MC1, BR6, MS1, MS1, 0, 1, 0, "bitmaps/knobs/knobgreen.xpm", 0, 0},
509 	{"", 0, MC1, BR7, MS1, MS1, 0, 1, 0, "bitmaps/knobs/knobgreen.xpm", 0, 0},
510 	{"", 0, MC3, BR1, MS1, MS1, 0, 1, 0, "bitmaps/knobs/knob.xpm", 0, 0},
511 	{"", 0, MC3, BR2, MS1, MS1, 0, 1, 0, "bitmaps/knobs/knobblue.xpm", 0, 0},
512 	{"", 0, MC3, BR3, MS1, MS1, 0, 1, 0, "bitmaps/knobs/knobblue.xpm", 0, 0},
513 	{"", 0, MC3, BR4, MS1, MS1, 0, 1, 0, "bitmaps/knobs/knobblue.xpm", 0, 0},
514 	{"", 0, MC3, BR5, MS1, MS1, 0, 1, 0, "bitmaps/knobs/knobgreen.xpm", 0, 0},
515 	{"", 0, MC3, BR6, MS1, MS1, 0, 1, 0, "bitmaps/knobs/knobgreen.xpm", 0, 0},
516 	{"", 0, MC3, BR7, MS1, MS1, 0, 1, 0, "bitmaps/knobs/knobgreen.xpm", 0, 0},
517 };
518 */
519 
520 #define FD1 8
521 #define FD2 67
522 #define FD3 120
523 
524 #define FPS1 83
525 #define FPS2 650
526 #define FPS3 875
527 
528 #define FR1 25
529 
530 #define FR2 (FR1 + FPS1 * 5)
531 #define FR3 (FR2 + FPS1 - FD1)
532 #define FR4 (FR3 + FPS1 - FD1)
533 #define FR5 (FR4 + FPS1 - FD1)
534 #define FR6 (FR5 + FPS1 - FD1)
535 #define FR7 (FR6 + FPS1 - FD1)
536 #define FR8 (FR7 + FPS1 + FD1)
537 
538 #define FR10 (FR10 + 120)
539 
540 #define FC1 10
541 
542 #define FC2 (FC1 + FC1 + FD2)
543 #define FC3 (FC2 + FD2)
544 #define FC4 (FC3 + FD2)
545 #define FC5 (FC4 + FD2)
546 #define FC6 (FC5 + FD2)
547 #define FC7 (FC6 + FD2)
548 #define FC8 (FC7 + FD2)
549 #define FC9 (FC8 + FD2)
550 #define FC10 (FC9 + FD2)
551 #define FC11 (FC10 + FD2)
552 #define FC12 (FC11 + FD2)
553 #define FC13 (FC12 + FD2)
554 #define FC14 (FC13 + FD2)
555 
556 #define FC15 (FC14 + FD2 - 5)
557 
558 #define DISPLAY1 (FUNCTION_COUNT - 6)
559 #define DISPLAY2 (FUNCTION_COUNT - 5)
560 #define DISPLAY3 (FUNCTION_COUNT - 4)
561 #define DISPLAY4 (FUNCTION_COUNT - 3)
562 #define DISPLAY5 (FUNCTION_COUNT - 2)
563 #define DISPLAY6 (FUNCTION_COUNT - 1)
564 
565 #define FBBW 47
566 #define FBBH 70
567 
568 /*
569  * Display and memory select buttons.
570  * Should memory selection be panel operation
571  */
572 static brightonLocations functions[FUNCTION_COUNT] = {
573 	/* Master gain */
574 	{"", 0, 750, 75, 250, 250, 0, 1, 0, 0, 0, 0},
575 	/* Page left and right */
576 	{"", 2, FC1, FR2 - 5, FBBW, FBBH, 0, 1.01, 0,
577 		"bitmaps/buttons/touchnlb.xpm", "bitmaps/buttons/touchnlb.xpm", BRIGHTON_NOSHADOW},
578 	{"", 2, FC15, FR2 - 5, FBBW, FBBH, 0, 1.01, 0,
579 		"bitmaps/buttons/touchnrb.xpm", "bitmaps/buttons/touchnrb.xpm", BRIGHTON_NOSHADOW},
580 	/* left functions */
581 	{"", 2, FC1, FR3, FBBW, FBBH, 0, 1.01, 0,
582 		"bitmaps/buttons/touchnrb.xpm", "bitmaps/buttons/touchnrb.xpm", BRIGHTON_NOSHADOW},
583 	{"", 2, FC1, FR4, FBBW, FBBH, 0, 1.01, 0,
584 		"bitmaps/buttons/touchnrb.xpm", "bitmaps/buttons/touchnrb.xpm", BRIGHTON_NOSHADOW},
585 	{"", 2, FC1, FR5, FBBW, FBBH, 0, 1.01, 0,
586 		"bitmaps/buttons/touchnrb.xpm", "bitmaps/buttons/touchnrb.xpm", BRIGHTON_NOSHADOW},
587 	{"", 2, FC1, FR6, FBBW, FBBH, 0, 1.01, 0,
588 		"bitmaps/buttons/touchnrb.xpm", "bitmaps/buttons/touchnrb.xpm", BRIGHTON_NOSHADOW},
589 	{"", 2, FC1, FR7, FBBW, FBBH, 0, 1.01, 0,
590 		"bitmaps/buttons/touchnrb.xpm", "bitmaps/buttons/touchnrb.xpm", BRIGHTON_NOSHADOW},
591 	/* right functions */
592 	{"", 2, FC15, FR3, FBBW, FBBH, 0, 1.01, 0,
593 		"bitmaps/buttons/touchnlb.xpm", "bitmaps/buttons/touchnlb.xpm", BRIGHTON_NOSHADOW},
594 	{"", 2, FC15, FR4, FBBW, FBBH, 0, 1.01, 0,
595 		"bitmaps/buttons/touchnlb.xpm", "bitmaps/buttons/touchnlb.xpm", BRIGHTON_NOSHADOW},
596 	{"", 2, FC15, FR5, FBBW, FBBH, 0, 1.01, 0,
597 		"bitmaps/buttons/touchnlb.xpm", "bitmaps/buttons/touchnlb.xpm", BRIGHTON_NOSHADOW},
598 	{"", 2, FC15, FR6, FBBW, FBBH, 0, 1.01, 0,
599 		"bitmaps/buttons/touchnlb.xpm", "bitmaps/buttons/touchnlb.xpm", BRIGHTON_NOSHADOW},
600 	{"", 2, FC15, FR7, FBBW, FBBH, 0, 1.01, 0,
601 		"bitmaps/buttons/touchnlb.xpm", "bitmaps/buttons/touchnlb.xpm", BRIGHTON_NOSHADOW},
602 	/*
603 	 * Some more buttons for base, 0-9, up/down, etc.
604 	 *
605 	 * First the load function
606 	 */
607 	{"", 2, FC1, FR8, 40, 75, 0, 1.01, 0,
608 		"bitmaps/buttons/pressoffo.xpm",
609 			"bitmaps/buttons/pressono.xpm", BRIGHTON_CHECKBUTTON},
610 	/* 0 to nine */
611 	{"", 2, FC3, FR8, 40, 75, 0, 1.01, 0, "bitmaps/buttons/pressoffg.xpm",
612 		"bitmaps/buttons/pressong.xpm", BRIGHTON_CHECKBUTTON},
613 	{"", 2, FC4, FR8, 40, 75, 0, 1.01, 0,
614 		"bitmaps/buttons/pressoffg.xpm",
615 			"bitmaps/buttons/pressong.xpm", BRIGHTON_CHECKBUTTON},
616 	{"", 2, FC5, FR8, 40, 75, 0, 1.01, 0,
617 		"bitmaps/buttons/pressoffg.xpm",
618 			"bitmaps/buttons/pressong.xpm", BRIGHTON_CHECKBUTTON},
619 	{"", 2, FC6, FR8, 40, 75, 0, 1.01, 0,
620 		"bitmaps/buttons/pressoffg.xpm",
621 			"bitmaps/buttons/pressong.xpm", BRIGHTON_CHECKBUTTON},
622 	{"", 2, FC7, FR8, 40, 75, 0, 1.01, 0,
623 		"bitmaps/buttons/pressoffg.xpm",
624 			"bitmaps/buttons/pressong.xpm", BRIGHTON_CHECKBUTTON},
625 	{"", 2, FC8, FR8, 40, 75, 0, 1.01, 0,
626 		"bitmaps/buttons/pressoffg.xpm",
627 			"bitmaps/buttons/pressong.xpm", BRIGHTON_CHECKBUTTON},
628 	{"", 2, FC9, FR8, 40, 75, 0, 1.01, 0,
629 		"bitmaps/buttons/pressoffg.xpm",
630 			"bitmaps/buttons/pressong.xpm", BRIGHTON_CHECKBUTTON},
631 	{"", 2, FC10, FR8, 40, 75, 0, 1.01, 0,
632 		"bitmaps/buttons/pressoffg.xpm",
633 			"bitmaps/buttons/pressong.xpm", BRIGHTON_CHECKBUTTON},
634 	{"", 2, FC11, FR8, 40, 75, 0, 1.01, 0,
635 		"bitmaps/buttons/pressoffg.xpm",
636 			"bitmaps/buttons/pressong.xpm", BRIGHTON_CHECKBUTTON},
637 	{"", 2, FC12, FR8, 40, 75, 0, 1.01, 0,
638 		"bitmaps/buttons/pressoffg.xpm",
639 			"bitmaps/buttons/pressong.xpm", BRIGHTON_CHECKBUTTON},
640 	/* Memory load/save */
641 	{"", 2, FC14, FR8, 40, 75, 0, 1.01, 0,
642 		"bitmaps/buttons/pressoffo.xpm",
643 			"bitmaps/buttons/pressono.xpm", BRIGHTON_CHECKBUTTON},
644 	{"", 2, FC15, FR8, 40, 75, 0, 1.01, 0,
645 		"bitmaps/buttons/pressoffo.xpm",
646 			"bitmaps/buttons/pressono.xpm", BRIGHTON_CHECKBUTTON},
647 
648 /*	{"", 3, FC1, FR1, FPS2, FPS1 * 5 - 25, 0, 1, 0, */
649 	{"", 6, FC1 + 25, FR1 + 20, FPS2 - 14, FPS1 * 4 - 26, 0, 1, 0,
650 		"bitmaps/images/vu.xpm", "bitmaps/images/vumask.xpm", 0},
651 
652 	{"", 3, FC2 - FD1 * 2, FR2, FPS3, FPS1 - 10, 0, 1, 0, 0,
653 		"bitmaps/images/alphadisplay3.xpm", 0},
654 
655 	{"", 3, FC2 - FD1 * 2, FR3, FPS3, FPS1 - 1, 0, 1, 0, 0,
656 		"bitmaps/images/alphadisplay4.xpm", 0},
657 	{"", 3, FC2 - FD1 * 2, FR4, FPS3, FPS1, 0, 1, 0, 0,
658 		"bitmaps/images/alphadisplay5.xpm", 0},
659 	{"", 3, FC2 - FD1 * 2, FR5, FPS3, FPS1, 0, 1, 0, 0, 0, 0},
660 	{"", 3, FC2 - FD1 * 2, FR6, FPS3, FPS1, 0, 1, 0, 0, 0, 0},
661 	{"", 3, FC2 - FD1 * 2, FR7, FPS3, FPS1, 0, 1, 0, 0, 0, 0},
662 /*		"bitmaps/images/alphadisplay2.xpm", 0}, */
663 };
664 
665 /*
666  * Width is a function of track count. With 16 tracks this is about 965, which
667  * is equivalent to 16 + 5.5 tracks - this is used to scale to different widths.
668  */
669 #define WIDTH (965 * (CHAN_COUNT + 5.5) / 21.5)
670 #define PS1 ((int) (4 * 965 / WIDTH))
671 #define PV1 4
672 
673 #define PWB ((int) (20 * 965 / WIDTH))
674 
675 #define PW1 ((int) (((1000 - PWB * 2) / (CHAN_COUNT + 5.5)) - PS1))
676 #define PW2 ((int) (PW1 + PS1))
677 
678 #define PBH 760
679 
680 #define M1CHAN(offset) \
681 	{\
682 		"Mix",\
683 		"bitmaps/blueprints/m1chan.xpm",\
684 		"bitmaps/textures/metal5.xpm",\
685 		0,\
686 		0,\
687 		0,\
688 		mixCallback,\
689 		PWB + PS1 + PW2 * offset, PV1, PW1, 1000 - PV1 * 2,\
690 		PARAM_COUNT,\
691 		locations\
692 	}
693 
694 /*
695  * This is a set of globals for the main window rendering. Again taken from
696  * include/brighton.h
697  */
698 brightonApp mixApp = {
699 	"mixer",
700 	0, /* no blueprint on wood background. */
701 	"bitmaps/textures/metal6.xpm",
702 	BRIGHTON_STRETCH,
703 	mixInit,
704 	mixConfigure, /* 3 callbacks, unused? */
705 	0,
706 	destroySynth,
707 	{1, 0, 2, 1, 5, 520, 0, 0},
708 	WIDTH,
709 	720, 0, 0,
710 	CHAN_COUNT + 4, /* panel count == CHAN_COUNT + 4 */
711 	{
712 		{
713 			"Border Left",
714 			0,
715 			"bitmaps/textures/wood2.xpm",
716 			BRIGHTON_STRETCH|BRIGHTON_VERTICAL, /* flags */
717 			0,
718 			0,
719 			0,
720 			0, 0, PWB, 1000,
721 			0,
722 			0
723 		},
724 		{
725 			"Border Right",
726 			0,
727 			"bitmaps/textures/wood2.xpm",
728 			BRIGHTON_STRETCH|BRIGHTON_VERTICAL, /* flags */
729 			0,
730 			0,
731 			0,
732 			1000 - PWB, 0, PWB, 1000,
733 			0,
734 			0
735 		},
736 		{
737 			"Function Panel",
738 			"bitmaps/blueprints/display5.xpm",
739 			"bitmaps/textures/metal5.xpm",
740 			0, /* flags */
741 			0,
742 			0,
743 			mixCallback,
744 				PWB + PS1 + PW2 * CHAN_COUNT,
745 				PV1, /*PS1, */
746 				1000 - PWB - PS1 * 2 - PWB - PW2 * CHAN_COUNT,
747 				1000 - PBH - PV1,
748 			FUNCTION_COUNT,
749 			functions
750 		},
751 		{
752 			"Bussing",
753 			"bitmaps/blueprints/m1bus.xpm",
754 			"bitmaps/textures/metal5.xpm",
755 			0, /* flags */
756 			0,
757 			0,
758 			mixCallback,
759 				PWB + PS1 + PW2 * CHAN_COUNT,
760 				1000 - PBH + PV1, /*PS1, */
761 				1000 - PWB - PS1 * 2 - PWB - PW2 * CHAN_COUNT,
762 				PBH - PV1 * 2,/*1000 - PS1 * 2, */
763 			BUS_COUNT,
764 			busses
765 		},
766 		M1CHAN(0), M1CHAN(1), M1CHAN(2), M1CHAN(3),
767 		M1CHAN(4), M1CHAN(5), M1CHAN(6), M1CHAN(7),
768 		M1CHAN(8), M1CHAN(9), M1CHAN(10), M1CHAN(11),
769 		M1CHAN(12), M1CHAN(13), M1CHAN(14), M1CHAN(15),
770 		M1CHAN(16), M1CHAN(17), M1CHAN(18), M1CHAN(19),
771 		M1CHAN(20), M1CHAN(21), M1CHAN(22), M1CHAN(23),
772 		M1CHAN(24), M1CHAN(25), M1CHAN(26), M1CHAN(27),
773 		M1CHAN(28), M1CHAN(29), M1CHAN(30), M1CHAN(31),
774 		M1CHAN(32), M1CHAN(33), M1CHAN(34), M1CHAN(35),
775 		M1CHAN(36), M1CHAN(37), M1CHAN(38), M1CHAN(39),
776 		M1CHAN(40), M1CHAN(41), M1CHAN(42), M1CHAN(43),
777 		M1CHAN(44), M1CHAN(45), M1CHAN(46), M1CHAN(47),
778 		M1CHAN(48), M1CHAN(49), M1CHAN(50), M1CHAN(51),
779 		M1CHAN(52), M1CHAN(53), M1CHAN(54), M1CHAN(55),
780 		M1CHAN(56), M1CHAN(57), M1CHAN(58), M1CHAN(59),
781 	}
782 };
783 
784 /*static dispatcher dispatch[DEVICE_COUNT];
785 
786 static void
787 mixMemory(guiSynth *synth, int fd, int chan, int c, int o, int v)
788 {
789 printf("mixMemory()\n");
790 
791 	switch (c) {
792 		default:
793 		case 0:
794 			synth->location = synth->location * 10 + o;
795 
796 			if (synth->location >= 1000)
797 				synth->location = o;
798 			displayPanelText(synth, "PRG", synth->location,
799 				DISPLAY_PANEL, DISPLAY_DEV);
800 			break;
801 		case 1:
802 			loadMemory(synth, "mix", 0, synth->location,
803 				synth->mem.active, FIRST_DEV, 0);
804 			displayPanelText(synth, "PRG", synth->bank + synth->location,
805 				DISPLAY_PANEL, DISPLAY_DEV);
806 			break;
807 		case 2:
808 			saveMemory(synth, "mix", 0, synth->location, FIRST_DEV);
809 			displayPanelText(synth, "PRG", synth->bank + synth->location,
810 				DISPLAY_PANEL, DISPLAY_DEV);
811 			break;
812 	}
813 }
814 
815 static void
816 mixMidi(guiSynth *synth, int fd, int chan, int c, int o, int v)
817 {
818 	if ((synth->flags & OPERATIONAL) == 0)
819 		return;
820 
821 	if (c == 1) {
822 		if (--synth->midichannel < 0)
823 			synth->midichannel = 0;
824 	} else {
825 		if (++synth->midichannel >= 16)
826 			synth->midichannel = 15;
827 	}
828 
829 	bristolMidiSendMsg(global.controlfd, synth->sid,
830 		127, 0, BRISTOL_MIDICHANNEL|synth->midichannel);
831 
832 	displayPanelText(synth, "MIDI", synth->midichannel + 1,
833 		DISPLAY_PANEL, DISPLAY_DEV);
834 }
835 */
836 
837 /*
838  * Having these located here implies only one instance of the mixer. Not sure
839  * if that is reasonable, but if we implement multiple then this can be buried
840  * in a dispatch structure instead. I have not specified implementation of
841  * multiple mixers as this is realtime from the audio device. Multiple mixers
842  * would be in separate engines?
843  *
844  * Oops, should change since it is very non-conducive to memory selections.
845  * This is non-trivial, since the GUI does not support radio buttons, and the
846  * memory subsystem should not know about them. Consequently they have to be
847  * handled here, and it can create issues where the GUI, the mixer and its
848  * memory subsystem are not in agreament.
849 MARK
850  */
851 int currentInSelect[MAX_CHAN_COUNT] = {
852 	-1, -1, -1, -1, -1, -1, -1, -1,
853 	-1, -1, -1, -1, -1, -1, -1, -1
854 };
855 int currentDynSelect[MAX_CHAN_COUNT] = {
856 	-1, -1, -1, -1, -1, -1, -1, -1,
857 	-1, -1, -1, -1, -1, -1, -1, -1
858 };
859 int currentFiltSelect[MAX_CHAN_COUNT] = {
860 	-1, -1, -1, -1, -1, -1, -1, -1,
861 	-1, -1, -1, -1, -1, -1, -1, -1
862 };
863 int currentFXSelect[MAX_CHAN_COUNT] = {
864 	-1, -1, -1, -1, -1, -1, -1, -1,
865 	-1, -1, -1, -1, -1, -1, -1, -1
866 };
867 int currentBusSelect[MAX_CHAN_COUNT] = {
868 	-1, -1, -1, -1, -1, -1, -1, -1,
869 	-1, -1, -1, -1, -1, -1, -1, -1
870 };
871 int currentBusFXSelect[MAX_CHAN_COUNT] = {
872 	-1, -1, -1, -1, -1, -1, -1, -1,
873 	-1, -1, -1, -1, -1, -1, -1, -1
874 };
875 
876 /*
877  * May pull all this track/bus/function logic into a separate file, along with
878  * mixCallback() as access point. From a logical perspective the GUI should
879  * feed into the memory structures and to the engine. The memory save should
880  * push the memory structures out to storage, and the load routines should
881  * just feed into the GUI. This makes the memory rather bespoke, but there are
882  * a few issues that have to be taken care of for the mixer memories that will
883  * probably require such coding.
884  *
885  * Currently busOp is called from mixCallback.
886  */
887 int
busOp(guiSynth * synth,int panel,int track,int operator,float value)888 busOp(guiSynth *synth, int panel, int track, int operator, float value)
889 {
890 	int param = operator % 30;
891 
892 	if ((synth->flags & OPERATIONAL) == 0)
893 		return(-1);
894 
895 /*	printf("busOp(%x, %i, %i, %i, (%i) %f)\n", */
896 /*		synth, panel, track, operator, param, value); */
897 
898 	/*
899 	 * For now just try and get the first 16 devices to operate as radio
900 	 * buttons.
901 	 */
902 	if ((param < 14) && (param > 5))
903 	{
904 		/*
905 		 * See if we need to clear last value. Logic is:
906 		 *	last value = -1 -> send request for this track.
907 		 *	last value = other -> clear other bitmap, request this track.
908 		 *	last value = this -> clear this bitmap, clear track request.
909 		 */
910 		if (currentBusFXSelect[track] == -1)
911 		{
912 			currentBusFXSelect[track] = operator;
913 		} else if (currentBusFXSelect[track] == operator) {
914 			currentBusFXSelect[track] = -1;
915 		} else {
916 			brightonEvent event;
917 
918 			/*
919 			 * We now have to alter the bitmap for the previous element.
920 			 * This is a call to libbrighton....
921 			 * guiSynth has brightonApp *resources:
922 			 *	brightonResources[] resources = panel.
923 			 *  resources.callback()
924 			 *
925 			 * However, it is wrong that we need to know about all the brighton
926 			 * internals, so need to add a routine to libbrighton to allow me
927 			 * to set a value, and have the display reflect that change.
928 			 */
929 			event.type = BRIGHTON_FLOAT;
930 			event.value = 0.0;
931 
932 			brightonParamChange(synth->win, panel,
933 				currentBusFXSelect[track], &event);
934 
935 			currentBusFXSelect[track] = operator;
936 		}
937 
938 		return(0);
939 	}
940 	return(0);
941 }
942 
943 #define DYN_START (CHAN_COUNT + 4)
944 #define DYN_END (DYN_START + 3)
945 #define FILT_START (DYN_START + 3)
946 #define FILT_END (FILT_START + 4)
947 #define FX_START (FILT_START + 8)
948 #define FX_END (FX_START + 7)
949 #define BUS_START (FX_START + 43)
950 #define BUS_END (BUS_START + 4)
951 
952 /*
953  * May pull all this track/bus/function logic into a separate file, along with
954  * mixCallback() as access point. This takes calls from the bussing section and
955  * the mixing channels and covers all parameters. It does not receive calls
956  * from the control panel which includes the master volume, and I think I will
957  * keep it that way, ie, master volume is a manual configuration?
958  *
959  * This will put the configured option into its associated structure and send
960  * the value through to the engine, and the code will be bespoke for the mixer.
961  * Memory load and save will also be bespoke, they will save the values to a
962  * disk file and refill them from the file for loading, sending engine updates
963  * for changes.
964  *
965  * trackOp is called from the generic mixcallback.
966  */
967 static void
trackOp(guiSynth * synth,int panel,int track,int operator,float value)968 trackOp(guiSynth *synth, int panel, int track, int operator, float value)
969 {
970 	if ((synth->flags & OPERATIONAL) == 0)
971 		return;
972 
973 /*	printf("trackOp(%x, %i, %i, %i, %f)\n", */
974 /*		synth, panel, track, operator, value); */
975 
976 	/*
977 	 * For now just try and get the first 16 devices to operate as radio
978 	 * buttons.
979 	 */
980 	if (operator < CHAN_COUNT)
981 	{
982 		/*
983 		 * See if we need to clear last value. Logic is:
984 		 *	last value = -1 -> send request for this track.
985 		 *	last value = other -> clear other bitmap, request this track.
986 		 *	last value = this -> clear this bitmap, clear track request.
987 		 */
988 		if (currentInSelect[track] == -1) {
989 			currentInSelect[track] = operator;
990 		} else if (currentInSelect[track] == operator) {
991 			currentInSelect[track] = -1;
992 		} else {
993 			brightonEvent event;
994 
995 			/*
996 			 * We now have to alter the bitmap for the previous element.
997 			 * This is a call to libbrighton....
998 			 * guiSynth has brightonApp *resources:
999 			 *	brightonResources[] resources = panel.
1000 			 *  resources.callback()
1001 			 *
1002 			 * However, it is wrong that we need to know about all the brighton
1003 			 * internals, so need to add a routine to libbrighton to allow me
1004 			 * to set a value, and have the display reflect that change.
1005 			 */
1006 			event.type = BRIGHTON_FLOAT;
1007 			event.value = 0.0;
1008 
1009 			brightonParamChange(synth->win, panel,
1010 				currentInSelect[track], &event);
1011 
1012 			currentInSelect[track] = operator;
1013 		}
1014 
1015 		return;
1016 	}
1017 
1018 	/*
1019 	 * Dynamics radio buttons
1020 	 */
1021 	if ((operator < DYN_END) && (operator >= DYN_START))
1022 	{
1023 		if (currentDynSelect[track] == -1)
1024 		{
1025 			currentDynSelect[track] = operator;
1026 		} else if (currentDynSelect[track] == operator) {
1027 			currentDynSelect[track] = -1;
1028 		} else {
1029 			brightonEvent event;
1030 
1031 			/*
1032 			 * We now have to alter the bitmap for the previous element.
1033 			 * This is a call to libbrighton....
1034 			 * guiSynth has brightonApp *resources:
1035 			 *	brightonResources[] resources = panel.
1036 			 *  resources.callback()
1037 			 *
1038 			 * However, it is wrong that we need to know about all the brighton
1039 			 * internals, so need to add a routine to libbrighton to allow me
1040 			 * to set a value, and have the display reflect that change.
1041 			 */
1042 			event.type = BRIGHTON_FLOAT;
1043 			event.value = 0.0;
1044 
1045 			brightonParamChange(synth->win, panel,
1046 				currentDynSelect[track], &event);
1047 
1048 			currentDynSelect[track] = operator;
1049 		}
1050 
1051 		return;
1052 	}
1053 	/*
1054 	 * Filter select radio buttons
1055 	 */
1056 	if ((operator < FILT_END) && (operator >= FILT_START))
1057 	{
1058 		if (currentFiltSelect[track] == -1)
1059 		{
1060 			currentFiltSelect[track] = operator;
1061 		} else if (currentFiltSelect[track] == operator) {
1062 			currentFiltSelect[track] = -1;
1063 		} else {
1064 			brightonEvent event;
1065 
1066 			/*
1067 			 * We now have to alter the bitmap for the previous element.
1068 			 * This is a call to libbrighton....
1069 			 * guiSynth has brightonApp *resources:
1070 			 *	brightonResources[] resources = panel.
1071 			 *  resources.callback()
1072 			 *
1073 			 * However, it is wrong that we need to know about all the brighton
1074 			 * internals, so need to add a routine to libbrighton to allow me
1075 			 * to set a value, and have the display reflect that change.
1076 			 */
1077 			event.type = BRIGHTON_FLOAT;
1078 			event.value = 0.0;
1079 
1080 			brightonParamChange(synth->win, panel,
1081 				currentFiltSelect[track], &event);
1082 
1083 			currentFiltSelect[track] = operator;
1084 		}
1085 
1086 		return;
1087 	}
1088 	/*
1089 	 * FX radio buttons
1090 	 */
1091 	if ((operator < FX_END) && (operator >= FX_START))
1092 	{
1093 		if (currentFXSelect[track] == -1)
1094 		{
1095 			currentFXSelect[track] = operator;
1096 		} else if (currentFXSelect[track] == operator) {
1097 			currentFXSelect[track] = -1;
1098 		} else {
1099 			brightonEvent event;
1100 
1101 			/*
1102 			 * We now have to alter the bitmap for the previous element.
1103 			 * This is a call to libbrighton....
1104 			 * guiSynth has brightonApp *resources:
1105 			 *	brightonResources[] resources = panel.
1106 			 *  resources.callback()
1107 			 *
1108 			 * However, it is wrong that we need to know about all the brighton
1109 			 * internals, so need to add a routine to libbrighton to allow me
1110 			 * to set a value, and have the display reflect that change.
1111 			 */
1112 			event.type = BRIGHTON_FLOAT;
1113 			event.value = 0.0;
1114 
1115 			brightonParamChange(synth->win, panel,
1116 				currentFXSelect[track], &event);
1117 
1118 			currentFXSelect[track] = operator;
1119 		}
1120 		return;
1121 	}
1122 	/*
1123 	 * Bus select radio buttons
1124 	 */
1125 	if ((operator < BUS_END) && (operator >= BUS_START))
1126 	{
1127 		if (currentBusSelect[track] == -1)
1128 		{
1129 			currentBusSelect[track] = operator;
1130 		} else if (currentBusSelect[track] == operator) {
1131 			currentBusSelect[track] = -1;
1132 		} else {
1133 			brightonEvent event;
1134 
1135 			/*
1136 			 * We now have to alter the bitmap for the previous element.
1137 			 * This is a call to libbrighton....
1138 			 * guiSynth has brightonApp *resources:
1139 			 *	brightonResources[] resources = panel.
1140 			 *  resources.callback()
1141 			 *
1142 			 * However, it is wrong that we need to know about all the brighton
1143 			 * internals, so need to add a routine to libbrighton to allow me
1144 			 * to set a value, and have the display reflect that change.
1145 			 */
1146 			event.type = BRIGHTON_FLOAT;
1147 			event.value = 0.0;
1148 
1149 			brightonParamChange(synth->win, panel,
1150 				currentBusSelect[track], &event);
1151 
1152 			currentBusSelect[track] = operator;
1153 		}
1154 		return;
1155 	}
1156 }
1157 
1158 /*
1159  * For the sake of ease of use, links have been placed here to be called
1160  * by any of the devices created. They would be better in some other file,
1161  * perhaps with this as a dispatch.
1162  *
1163  * Param refers to the device index in the locations table given below.
1164 
1165  * The memory structure is going to be large. To cater for future extensions
1166  * each memory component (track, bus, etc) is going to have extra memory
1167  * allocated. New parameters will occupy the extra space allowing for
1168  * compatability of memories over releases.
1169  */
1170 static int
mixCallback(brightonWindow * win,int panel,int index,float value)1171 mixCallback(brightonWindow * win, int panel, int index, float value)
1172 {
1173 	guiSynth *synth = findSynth(global.synths, win);
1174 	int sendvalue;
1175 
1176 	if (synth == 0)
1177 		return(0);
1178 
1179 /* printf("1: mixCallback(%i, %i, %f): %x\n", panel, index, value, synth); */
1180 
1181 	if (mixApp.resources[panel].devlocn[index].to == 1)
1182 		sendvalue = value * C_RANGE_MIN_1;
1183 	else
1184 		sendvalue = value;
1185 
1186 	switch (panel) {
1187 		case FUNCTION_PANEL:
1188 			functionOp(synth, panel, index, index - 1, value);
1189 
1190 			break;
1191 		case BUS_PANEL:
1192 			if (index < 240) {
1193 				int chan, op;
1194 
1195 				chan = index / 30;
1196 				op = index % 30;
1197 
1198 				busOp(synth, panel, chan, index, value);
1199 				mixerMemory(synth, MM_GET, BUS_PANEL, index, &value);
1200 
1201 				mixSendMsg(synth, global.controlfd, synth->sid,
1202 					64 + chan, op, sendvalue);
1203 			} else {
1204 				/* WTF is VBUS_PANEL?  not an op... */
1205 				mixerMemory(synth, MM_GET, VBUS_PANEL, index - 240, &value);
1206 
1207 				mixSendMsg(synth, global.controlfd, synth->sid,
1208 					80, index - 240, sendvalue);
1209 			}
1210 /*			index += panel * PARAM_COUNT; */
1211 			/*
1212 			 * Corrected to:
1213 			 */
1214 			index += FUNCTION_COUNT;
1215 
1216 			break;
1217 		default:
1218 			/*
1219 			 * Here I want to call a track function, it will be given the
1220 			 * track number, parameter and value, and will set that value in
1221 			 * an internal memory space. For radio buttons it may also need
1222 			 * to send requests to the GUI to alter the display.
1223 			 */
1224 			trackOp(synth, panel, panel - 4, index, value);
1225 			setMixerMemory((mixerMem *) synth->mem.param, panel, index, &value, NULL);
1226 
1227 			mixSendMsg(synth,
1228 				global.controlfd, synth->sid, panel - 4, index, sendvalue);
1229 
1230 			break;
1231 	}
1232 
1233 	if ((synth->flags & OPERATIONAL) == 0)
1234 		return(0);
1235 
1236 /* printf("2: mixCallback(%i, %f): %x\n", index, value, synth); */
1237 
1238 	/*
1239 	 * Parameters are now handled through brightonMixerMemory.c
1240 	if (debug) printf("p1 %x %i %i\n", synth->dispatch[index].routine,
1241 		synth->sid,
1242 		synth->dispatch[index].controller,
1243 		synth->dispatch[index].operator);
1244 
1245 	synth->dispatch[index].routine(synth,
1246 		global.controlfd, synth->sid,
1247 		synth->dispatch[index].controller,
1248 		synth->dispatch[index].operator,
1249 		sendvalue);
1250 
1251 #ifdef DEBUG
1252 	printf("dispatch[%x,%i](%i, %i, %i, %i, %i)\n", synth, index,
1253 		global.controlfd, synth->sid,
1254 		synth->dispatch[index].controller,
1255 		synth->dispatch[index].operator,
1256 		sendvalue);
1257 #endif
1258 	 */
1259 
1260 	return(0);
1261 }
1262 
1263 static void
mixSendMsg(guiSynth * synth,int fd,int chan,int c,int o,int v)1264 mixSendMsg(guiSynth *synth, int fd, int chan, int c, int o, int v)
1265 {
1266 /*printf("mixSendMsg(%i, %i, %i, %i, %f\n", fd, chan, c, o, v); */
1267 /*	int value; */
1268 /*	 */
1269 /*	value = v < 1.0? v * 16383: v; */
1270 	bristolMidiSendMsg(fd, chan, c, o, v);
1271 }
1272 
1273 /*
1274  * Any location initialisation required to run the callbacks. For bristol, this
1275  * will connect to the engine, and give it some base parameters.
1276  * May need to generate some application specific menus.
1277  * Will also then make specific requests to some of the devices to alter their
1278  * rendering.
1279  *
1280  * For the mixer it is also reasonable to build the application structures,
1281  * rather than have them defined in advance?
1282  */
1283 static int
mixInit(brightonWindow * win)1284 mixInit(brightonWindow *win)
1285 {
1286 	guiSynth *synth = findSynth(global.synths, win);
1287 /*	dispatcher *dispatch; */
1288 /*
1289 	brightonEvent event;
1290 	char bitmap[128];
1291 
1292 	event.type = BRIGHTON_MEM;
1293 	event.m = OP2XPM;
1294 	brightonParamChange(synth->win,
1295 		ALGOS_PANEL, ALGOS_COUNT - 1, &event);
1296 */
1297 
1298 	if (synth == 0)
1299 	{
1300 		synth = findSynth(global.synths, 0);
1301 		if (synth == 0)
1302 		{
1303 			printf("cannot init\n");
1304 			return(0);
1305 		}
1306 	}
1307 
1308 	synth->win = win;
1309 
1310 	printf("Initialise the mix link to bristol: %p\n", synth->win);
1311 
1312 /* Alloc device_count. This is wrong, should be 'abs max'. */
1313 	synth->mem.param = (float *) initMixerMemory(16);
1314 	synth->mem.count = DEVICE_COUNT;
1315 	synth->mem.active = ACTIVE_DEVS;
1316 /*	synth->dispatch = (dispatcher *) */
1317 /*		brightonmalloc(DEVICE_COUNT * sizeof(dispatcher)); */
1318 /*	dispatch = synth->dispatch; */
1319 
1320 	/*
1321 	 * We really want to have three connection mechanisms. These should be
1322 	 *	1. Unix named sockets.
1323 	 *	2. UDP sockets.
1324 	 *	3. MIDI pipe.
1325 	 */
1326 	if (!global.libtest)
1327 		if ((synth->sid = initConnection(&global, synth)) < 0)
1328 			return(-1);
1329 
1330 /*	for (i = 0; i < DEVICE_COUNT; i++) */
1331 /*		synth->dispatch[i].routine = (synthRoutine) mixSendMsg; */
1332 
1333 	return(0);
1334 }
1335 
1336 /*
1337  * This will be called to make any routine specific parameters available.
1338  */
1339 static int
mixConfigure(brightonWindow * win)1340 mixConfigure(brightonWindow *win)
1341 {
1342 	guiSynth *synth = findSynth(global.synths, win);
1343 	brightonEvent event;
1344 
1345 	if (synth == 0)
1346 	{
1347 		printf("problems going operational\n");
1348 		return(-1);
1349 	}
1350 
1351 	if (synth->flags & OPERATIONAL)
1352 		return(0);
1353 
1354 	printf("going operational %p %p\n", synth, synth->win);
1355 
1356 	synth->flags |= OPERATIONAL;
1357 	synth->keypanel = -1;
1358 	synth->keypanel2 = -1;
1359 
1360 	functionOp(synth, FUNCTION_PANEL, 1, 1, 0.0);
1361 
1362 	displayPanelText(synth, "TRK", 1, 4, PARAM_COUNT - 1);
1363 	displayPanelText(synth, "TRK", 2, 5, PARAM_COUNT - 1);
1364 	displayPanelText(synth, "TRK", 3, 6, PARAM_COUNT - 1);
1365 	displayPanelText(synth, "TRK", 4, 7, PARAM_COUNT - 1);
1366 	displayPanelText(synth, "TRK", 5, 8, PARAM_COUNT - 1);
1367 	displayPanelText(synth, "TRK", 6, 9, PARAM_COUNT - 1);
1368 	displayPanelText(synth, "TRK", 7, 10, PARAM_COUNT - 1);
1369 	displayPanelText(synth, "TRK", 8, 11, PARAM_COUNT - 1);
1370 
1371 	if (CHAN_COUNT > 7)
1372 	{
1373 		displayPanelText(synth, "TRK", 9, 12, PARAM_COUNT - 1);
1374 		displayPanelText(synth, "TRK", 10, 13, PARAM_COUNT - 1);
1375 		displayPanelText(synth, "TRK", 11, 14, PARAM_COUNT - 1);
1376 		displayPanelText(synth, "TRK", 12, 15, PARAM_COUNT - 1);
1377 		displayPanelText(synth, "TRK", 13, 16, PARAM_COUNT - 1);
1378 		displayPanelText(synth, "TRK", 14, 17, PARAM_COUNT - 1);
1379 		displayPanelText(synth, "TRK", 15, 18, PARAM_COUNT - 1);
1380 		displayPanelText(synth, "TRK", 16, 19, PARAM_COUNT - 1);
1381 	}
1382 
1383 	loadMixerMemory(synth, "default", 0);
1384 
1385 	event.type = BRIGHTON_FLOAT;
1386 	event.value = 0.5;
1387 	brightonParamChange(synth->win, 2, 0, &event);
1388 
1389 	return(0);
1390 }
1391 
1392