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 /*#define DEBUG */
22
23 #include "bristol.h"
24 #include "bristolmm.h"
25 #include "bristolmixer.h"
26
27 /*
28 * This will control the global values for the mixing operation on request from
29 * the mixer GUI.
30 */
31 int
mixerController(Baudio * baudio,u_char operator,u_char controller,float value)32 mixerController(Baudio *baudio, u_char operator,
33 u_char controller, float value)
34 {
35 #ifdef DEBUG
36 printf("bristolMixerControl(%i, %i, %f)\n", operator, controller, value);
37 #endif
38
39 /*
40 * Should have loads of operators here, for the tracks, busses and groups.
41 */
42
43 if (operator != 126)
44 return(0);
45
46 switch (controller) {
47 case 0:
48 break;
49 case 1:
50 break;
51 case 2:
52 break;
53 case 3:
54 break;
55 case 4:
56 break;
57 case 5:
58 break;
59 case 6:
60 break;
61 case 7:
62 break;
63 case 8:
64 break;
65 case 9:
66 break;
67 case 10:
68 break;
69 case 11:
70 break;
71 case 12:
72 break;
73 case 13:
74 break;
75 case 14:
76 break;
77 case 15:
78 break;
79 case 16:
80 break;
81 case 17:
82 break;
83 case 18:
84 break;
85 case 19:
86 break;
87 case 20:
88 break;
89 case 21:
90 break;
91 case 22:
92 break;
93 case 23:
94 break;
95 }
96
97 return(0);
98 }
99
100 int
operateMixerPreops(audioMain * audiomain,Baudio * baudio,bristolVoice * voice,register float * startbuf)101 operateMixerPreops(audioMain *audiomain, Baudio *baudio,
102 bristolVoice *voice, register float *startbuf)
103 {
104 #ifdef DEBUG
105 if ((audiomain->debuglevel & BRISTOL_DEBUG_MASK) > BRISTOL_DEBUG5)
106 printf("operateMixerPreops(%x, %x, %x) %i\n",
107 baudio, voice, startbuf, baudio->cvoices);
108 #endif
109 return(0);
110 }
111
112 int
operateOneMixer(audioMain * audiomain,Baudio * baudio,bristolVoice * voice,register float * startbuf)113 operateOneMixer(audioMain *audiomain, Baudio *baudio,
114 bristolVoice *voice, register float *startbuf)
115 {
116 /*
117 printf("operateOneMixer(%x, %x, %x) %i\n",
118 baudio, voice, startbuf, baudio->cvoices);
119 */
120 return(0);
121 }
122
123 static int
bristolMixerDestroy(audioMain * audiomain,Baudio * baudio)124 bristolMixerDestroy(audioMain *audiomain, Baudio *baudio)
125 {
126 printf("removing one mixer\n");
127 return(0);
128 }
129
130 /*
131 * Mixer initialisation is going to be a special case. This is not a synth
132 * as the others, but an integral function of the engine. This link is required
133 * to control that mixing function but the actual mixing should be skipped until
134 * the mixer GUI has linked up, otherwise it does not make a lot of sense.
135 *
136 * Should consider the implications of multithreading here such that we can
137 * allow for contention for certain tracks? That might be quite hard and as
138 * such we may end up with a mixing thread and multiple synth threads.
139 */
140 int
bristolMixerInit(audioMain * audiomain,Baudio * baudio)141 bristolMixerInit(audioMain *audiomain, Baudio *baudio)
142 {
143 printf("initialising one mixer\n");
144 /*
145 * Number of operators in this voice. The mixer does not actually need
146 * these operators, but we may want to have pre and post ops for any given
147 * audio frame, and that fits well here and as such we need a dummy operator.
148 */
149 baudio->soundCount = 1;
150
151 /*
152 * Assign an array of sound pointers.
153 */
154 baudio->sound = (bristolSound **)
155 bristolmalloc0(sizeof(bristolOP *) * baudio->soundCount);
156 baudio->effect = (bristolSound **)
157 bristolmalloc0(sizeof(bristolOP *) * baudio->soundCount);
158
159 /*
160 * This should be the dummy.
161 */
162 initSoundAlgo(8, 0, baudio, audiomain, baudio->sound);
163
164 /*
165 if ((audiomain->debuglevel & BRISTOL_DEBUG_MASK) > BRISTOL_DEBUG3)
166 printf("malloced sound: %x\n", baudio->sound);
167 */
168
169 baudio->param = mixerController;
170 baudio->destroy = bristolMixerDestroy;
171 baudio->operate = operateOneMixer;
172 baudio->preops = operateMixerPreops;
173 return(0);
174 }
175
176