Mercurial > hg > dmlib
annotate minijss/jssmix.c @ 809:eba3b87f3f84
Add some separate macros for 64/32 precision fixed point types.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 14 May 2014 21:28:14 +0300 |
parents | c430112449a7 |
children | 68453f04964d |
rev | line source |
---|---|
0 | 1 /* |
2 * miniJSS - Mixing device and channel handling | |
3 * Programmed and designed by Matti 'ccr' Hamalainen | |
4 * (C) Copyright 2006-2012 Tecnic Software productions (TNSP) | |
5 */ | |
6 #include "jssmix.h" | |
7 #include <string.h> | |
8 | |
9 | |
10 #ifdef DM_USE_C | |
11 #define JMIXER_HEADER | |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
36
diff
changeset
|
12 #include "jmix_c_in.c" |
0 | 13 #undef JMIXER_HEADER |
14 #endif | |
15 | |
16 #undef DM_USE_SIMD | |
17 | |
18 #ifdef DM_USE_SIMD | |
19 #define JMIXER_HEADER | |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
36
diff
changeset
|
20 #include "jmix_mmx_in.c" |
0 | 21 #undef JMIXER_HEADER |
22 #endif | |
23 | |
24 | |
25 typedef struct | |
26 { | |
27 int mixerID; | |
28 int outFormat; | |
29 int outChannels; | |
51
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
30 |
287
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
31 int (*jvmMixChannel_FW)(JSSMixer *, JSSChannel *, JMIXER_ADDBUF_TYPE *, const int, const DMFixedPoint); |
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
32 int (*jvmMixChannel_BW)(JSSMixer *, JSSChannel *, JMIXER_ADDBUF_TYPE *, const int, const DMFixedPoint); |
51
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
33 void (*jvmPostProcess)(JMIXER_ADDBUF_TYPE *, void *, const int); |
0 | 34 } JSSMixingRoutine; |
35 | |
36 | |
37 /* This table should be sorted from fastest to slowest, e.g. MMX/x86 | |
38 * optimized routines first, pure C versions last. | |
39 */ | |
40 static JSSMixingRoutine jvmMixRoutines[] = | |
41 { | |
42 #ifdef DM_USE_SIMD | |
43 { JMIX_MMX, JSS_AUDIO_U8, JSS_AUDIO_MONO, jvmMix_Mono_MMX_FW, jvmMix_Mono_MMX_BW, jvmPostProcess_U8_MMX }, | |
44 { JMIX_MMX, JSS_AUDIO_S8, JSS_AUDIO_MONO, jvmMix_Mono_MMX_FW, jvmMix_Mono_MMX_BW, jvmPostProcess_S8_MMX }, | |
45 { JMIX_MMX, JSS_AUDIO_U8, JSS_AUDIO_STEREO, jvmMix_Stereo_MMX_FW, jvmMix_Stereo_MMX_BW, jvmPostProcess_U8_MMX }, | |
46 { JMIX_MMX, JSS_AUDIO_S8, JSS_AUDIO_STEREO, jvmMix_Stereo_MMX_FW, jvmMix_Stereo_MMX_BW, jvmPostProcess_S8_MMX }, | |
47 | |
48 { JMIX_MMX, JSS_AUDIO_U16, JSS_AUDIO_MONO, jvmMix_Mono_MMX_FW, jvmMix_Mono_MMX_BW, jvmPostProcess_U16_MMX }, | |
49 { JMIX_MMX, JSS_AUDIO_S16, JSS_AUDIO_MONO, jvmMix_Mono_MMX_FW, jvmMix_Mono_MMX_BW, jvmPostProcess_S16_MMX }, | |
50 { JMIX_MMX, JSS_AUDIO_U16, JSS_AUDIO_STEREO, jvmMix_Stereo_MMX_FW, jvmMix_Stereo_MMX_BW, jvmPostProcess_U16_MMX }, | |
51 { JMIX_MMX, JSS_AUDIO_S16, JSS_AUDIO_STEREO, jvmMix_Stereo_MMX_FW, jvmMix_Stereo_MMX_BW, jvmPostProcess_S16_MMX }, | |
52 #endif | |
53 | |
54 #ifdef DM_USE_C | |
55 { JMIX_C, JSS_AUDIO_U8, JSS_AUDIO_MONO, jvmMix_Mono_C_FW, jvmMix_Mono_C_BW, jvmPostProcess_U8_C }, | |
56 { JMIX_C, JSS_AUDIO_S8, JSS_AUDIO_MONO, jvmMix_Mono_C_FW, jvmMix_Mono_C_BW, jvmPostProcess_S8_C }, | |
57 { JMIX_C, JSS_AUDIO_U8, JSS_AUDIO_STEREO, jvmMix_Stereo_C_FW, jvmMix_Stereo_C_BW, jvmPostProcess_U8_C }, | |
58 { JMIX_C, JSS_AUDIO_S8, JSS_AUDIO_STEREO, jvmMix_Stereo_C_FW, jvmMix_Stereo_C_BW, jvmPostProcess_S8_C }, | |
59 | |
60 { JMIX_C, JSS_AUDIO_U16, JSS_AUDIO_MONO, jvmMix_Mono_C_FW, jvmMix_Mono_C_BW, jvmPostProcess_U16_C }, | |
61 { JMIX_C, JSS_AUDIO_S16, JSS_AUDIO_MONO, jvmMix_Mono_C_FW, jvmMix_Mono_C_BW, jvmPostProcess_S16_C }, | |
62 { JMIX_C, JSS_AUDIO_U16, JSS_AUDIO_STEREO, jvmMix_Stereo_C_FW, jvmMix_Stereo_C_BW, jvmPostProcess_U16_C }, | |
63 { JMIX_C, JSS_AUDIO_S16, JSS_AUDIO_STEREO, jvmMix_Stereo_C_FW, jvmMix_Stereo_C_BW, jvmPostProcess_S16_C }, | |
64 #endif | |
65 }; | |
66 | |
67 static const int jvmNMixRoutines = sizeof(jvmMixRoutines) / sizeof(jvmMixRoutines[0]); | |
68 | |
69 | |
70 static int jvmFindMixRoutine(int outFormat, int outChannels, int mixerID) | |
71 { | |
72 int i; | |
73 | |
74 for (i = 0; i < jvmNMixRoutines; i++) | |
75 { | |
76 if (jvmMixRoutines[i].outFormat == outFormat && | |
77 jvmMixRoutines[i].outChannels == outChannels && | |
78 (mixerID == JMIX_AUTO || jvmMixRoutines[i].mixerID == mixerID)) | |
79 return i; | |
80 } | |
81 | |
82 return -1; | |
83 } | |
84 | |
85 | |
86 JSSMixer *jvmInit(const int outFormat, const int outChannels, const int outFreq, const int mixerID) | |
87 { | |
88 JSSMixer *mixer; | |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
36
diff
changeset
|
89 int mixerIdx; |
0 | 90 |
91 // Check settings | |
92 if (outChannels < 1) | |
93 { | |
94 JSSERROR(DMERR_INVALID_ARGS, NULL, | |
95 "Invalid number of channels %d\n", outChannels); | |
96 } | |
97 | |
98 if (outFreq < 4000) | |
99 { | |
100 JSSERROR(DMERR_INVALID_ARGS, NULL, | |
101 "Invalid mixing frequency %d\n", outFreq); | |
102 } | |
103 | |
104 /* Select mixing routines: | |
105 * Here we try to choose the most fitting mixing routines | |
106 * from the compiled in routines, unless caller is forcing | |
107 * us to select specific ones. | |
108 */ | |
109 if (mixerID == JMIX_AUTO) | |
110 { | |
111 mixerIdx = jvmFindMixRoutine(outFormat, outChannels, JMIX_SSE); | |
112 if (mixerIdx < 0) | |
113 mixerIdx = jvmFindMixRoutine(outFormat, outChannels, JMIX_MMX); | |
114 if (mixerIdx < 0) | |
115 mixerIdx = jvmFindMixRoutine(outFormat, outChannels, JMIX_AUTO); | |
116 } | |
117 else | |
118 { | |
119 mixerIdx = jvmFindMixRoutine(outFormat, outChannels, mixerID); | |
120 } | |
121 | |
122 if (mixerIdx < 0) | |
123 { | |
124 JSSERROR(DMERR_INVALID_ARGS, NULL, | |
125 "Could not find mixing routine for outFormat=%d, outChannels=%d, outFreq=%d.\n", | |
126 outFormat, outChannels, outFreq); | |
127 return NULL; | |
128 } | |
129 | |
130 // Allocate a mixer device structure | |
131 mixer = dmMalloc0(sizeof(JSSMixer)); | |
132 if (mixer == NULL) | |
133 { | |
134 JSSERROR(DMERR_MALLOC, NULL, | |
135 "Could not allocate mixing device structure.\n"); | |
136 } | |
137 | |
138 // Initialize variables | |
139 #ifdef JSS_SUP_THREADS | |
140 mixer->mutex = dmCreateMutex(); | |
141 #endif | |
142 mixer->outFormat = outFormat; | |
143 mixer->outFreq = outFreq; | |
144 mixer->outChannels = outChannels; | |
145 | |
146 mixer->jvmMixChannel_FW = jvmMixRoutines[mixerIdx].jvmMixChannel_FW; | |
147 mixer->jvmMixChannel_BW = jvmMixRoutines[mixerIdx].jvmMixChannel_BW; | |
148 mixer->jvmPostProcess = jvmMixRoutines[mixerIdx].jvmPostProcess; | |
149 | |
150 // Allocate addBuffer | |
291 | 151 mixer->addBufSize = outChannels * outFreq * 2; |
53
a83f7c4d9e08
No need to allocate with dmCalloc, when a plain dmMalloc is fine.
Matti Hamalainen <ccr@tnsp.org>
parents:
52
diff
changeset
|
152 mixer->addBuffer = dmMalloc(mixer->addBufSize * sizeof(JMIXER_ADDBUF_TYPE)); |
0 | 153 if (mixer->addBuffer == NULL) |
154 { | |
155 JSSERROR(DMERR_MALLOC, NULL, | |
156 "Could not allocate mixing addition buffer.\n"); | |
157 } | |
158 | |
159 return mixer; | |
160 } | |
161 | |
162 | |
163 int jvmClose(JSSMixer * mixer) | |
164 { | |
165 if (mixer == NULL) | |
166 return DMERR_NULLPTR; | |
167 | |
168 // Deallocate resources | |
169 #ifdef JSS_SUP_THREADS | |
170 dmDestroyMutex(mixer->mutex); | |
171 #endif | |
172 dmFree(mixer->addBuffer); | |
173 | |
174 memset(mixer, 0, sizeof(JSSMixer)); | |
175 dmFree(mixer); | |
176 | |
177 return DMERR_OK; | |
178 } | |
179 | |
180 | |
181 int jvmGetSampleSize(JSSMixer *mixer) | |
182 { | |
183 int sampSize = 1; | |
184 assert(mixer); | |
185 | |
186 switch (mixer->outChannels) | |
187 { | |
188 case JSS_AUDIO_STEREO: | |
189 case JSS_AUDIO_MONO: | |
190 sampSize = mixer->outChannels; | |
191 break; | |
192 default: | |
193 JSSERROR(DMERR_INVALID_ARGS, -1, | |
194 "outChannels=%d not stereo or mono!\n", mixer->outChannels); | |
195 break; | |
196 } | |
197 | |
198 switch (mixer->outFormat) | |
199 { | |
200 case JSS_AUDIO_U16: sampSize *= sizeof(Uint16); break; | |
201 case JSS_AUDIO_S16: sampSize *= sizeof(Sint16); break; | |
54 | 202 case JSS_AUDIO_U8: sampSize *= sizeof(Uint8); break; |
203 case JSS_AUDIO_S8: sampSize *= sizeof(Sint8); break; | |
0 | 204 default: |
205 JSSERROR(DMERR_INVALID_ARGS, -1, | |
206 "outFormat=%d is not supported!\n", mixer->outFormat); | |
207 } | |
208 | |
209 return sampSize; | |
210 } | |
211 | |
212 | |
213 int jvmGetSampleRes(JSSMixer *mixer) | |
214 { | |
54 | 215 int sampRes = 0; |
0 | 216 |
217 assert(mixer); | |
218 | |
219 switch (mixer->outFormat) | |
220 { | |
221 case JSS_AUDIO_U16: case JSS_AUDIO_S16: sampRes = 16; break; | |
54 | 222 case JSS_AUDIO_U8: case JSS_AUDIO_S8: sampRes = 8; break; |
0 | 223 default: |
224 JSSERROR(DMERR_INVALID_ARGS, -1, | |
225 "outFormat=%d is not supported!\n", mixer->outFormat); | |
226 } | |
227 | |
228 return sampRes; | |
229 } | |
230 | |
231 | |
51
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
232 static void jvmMixChannel(JSSMixer *mixer, JSSChannel *chn, JMIXER_ADDBUF_TYPE *addBuffer, const int mixLength) |
0 | 233 { |
234 int mixDone = mixLength, mixResult; | |
51
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
235 JMIXER_ADDBUF_TYPE *ab = addBuffer; |
0 | 236 |
237 if (!chn->chPlaying || chn->chMute) | |
238 return; | |
239 | |
240 DBG("%s(%p, %d)\n", __FUNCTION__, chn, mixLength); | |
241 | |
242 while (mixDone > 0) | |
243 { | |
244 if (chn->chDirection) | |
245 { | |
246 // Channel is playing FORWARDS | |
247 if (chn->chFlags & jsfLooped) | |
248 { | |
249 // Sample is looped | |
250 if (chn->chFlags & jsfBiDi) | |
251 { | |
252 // Bi-directional loop | |
287
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
253 if (chn->chPos.dw >= chn->chLoopE.dw) |
0 | 254 { |
158
255da2a698fe
Improve loop handling in the mixer.
Matti Hamalainen <ccr@tnsp.org>
parents:
141
diff
changeset
|
255 DMFixedPoint end; |
287
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
256 FP_ADD_R(end, chn->chLoopE, chn->chLoopE); |
158
255da2a698fe
Improve loop handling in the mixer.
Matti Hamalainen <ccr@tnsp.org>
parents:
141
diff
changeset
|
257 FP_SUB_R(chn->chPos, end, chn->chPos); |
0 | 258 chn->chDirection = FALSE; |
259 } | |
260 } | |
261 else | |
262 { | |
263 // Normal forward loop | |
287
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
264 if (chn->chPos.dw >= chn->chLoopE.dw) |
0 | 265 { |
287
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
266 DMFixedPoint diff; |
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
267 FP_SUB_R(diff, chn->chPos, chn->chLoopE); |
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
268 FP_ADD_R(chn->chPos, chn->chLoopS, diff); |
0 | 269 } |
270 } | |
271 } | |
272 else | |
273 { | |
274 // Normal (non-looped) sample | |
287
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
275 if (chn->chPos.dw >= chn->chSize.dw) |
0 | 276 { |
277 chn->chPlaying = FALSE; | |
278 return; | |
279 } | |
280 } | |
281 } | |
282 else | |
283 { | |
284 // Channel is playing BACKWARDS | |
285 if (chn->chFlags & jsfLooped) | |
286 { | |
287 // Sample is looped | |
288 if (chn->chFlags & jsfBiDi) | |
289 { | |
290 // Bi-directional loop | |
287
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
291 if (chn->chPos.dw <= chn->chLoopS.dw) |
0 | 292 { |
158
255da2a698fe
Improve loop handling in the mixer.
Matti Hamalainen <ccr@tnsp.org>
parents:
141
diff
changeset
|
293 DMFixedPoint start; |
287
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
294 FP_ADD_R(start, chn->chLoopS, chn->chLoopS); |
158
255da2a698fe
Improve loop handling in the mixer.
Matti Hamalainen <ccr@tnsp.org>
parents:
141
diff
changeset
|
295 FP_SUB_R(chn->chPos, start, chn->chPos); |
0 | 296 chn->chDirection = TRUE; |
297 } | |
298 } | |
299 else | |
300 { | |
301 // Normal forward loop | |
287
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
302 if (chn->chPos.dw <= chn->chLoopS.dw) |
0 | 303 { |
158
255da2a698fe
Improve loop handling in the mixer.
Matti Hamalainen <ccr@tnsp.org>
parents:
141
diff
changeset
|
304 DMFixedPoint diff; |
287
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
305 FP_SUB_R(diff, chn->chLoopE, chn->chLoopS); |
158
255da2a698fe
Improve loop handling in the mixer.
Matti Hamalainen <ccr@tnsp.org>
parents:
141
diff
changeset
|
306 FP_ADD(chn->chPos, diff); |
0 | 307 } |
308 } | |
309 } | |
310 else | |
311 { | |
312 // Normal (non-looped) sample | |
287
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
313 if (chn->chPos.dw <= 0) |
0 | 314 { |
315 chn->chPlaying = FALSE; | |
316 return; | |
317 } | |
318 } | |
319 } | |
320 | |
321 // Call the mixing innerloop functions | |
322 if (chn->chDirection) | |
323 { | |
324 DBG("MIX_FW[%p : %d : ", ab, mixDone); | |
325 if (chn->chFlags & jsfLooped) | |
326 { | |
809
eba3b87f3f84
Add some separate macros for 64/32 precision fixed point types.
Matti Hamalainen <ccr@tnsp.org>
parents:
658
diff
changeset
|
327 DBG("%d (%x)] {loop}\n", FP_GETH32(chn->chLoopE), FP_GETH32(chn->chLoopE)); |
0 | 328 mixResult = mixer->jvmMixChannel_FW((void *) mixer, chn, |
329 ab, mixDone, chn->chLoopE); | |
330 } | |
331 else | |
332 { | |
809
eba3b87f3f84
Add some separate macros for 64/32 precision fixed point types.
Matti Hamalainen <ccr@tnsp.org>
parents:
658
diff
changeset
|
333 DBG("%d (%x)]\n", FP_GETH32(chn->chSize), FP_GETH32(chn->chSize)); |
0 | 334 mixResult = mixer->jvmMixChannel_FW((void *) mixer, chn, |
335 ab, mixDone, chn->chSize); | |
336 } | |
337 } | |
338 else | |
339 { | |
340 DBG("MIX_BW[%p : %d : ", ab, mixDone); | |
341 if (chn->chFlags & jsfLooped) | |
342 { | |
343 DBG("%d (%x)] {loop}\n", chn->chLoopS, chn->chLoopS); | |
344 mixResult = mixer->jvmMixChannel_BW(mixer, chn, | |
345 ab, mixDone, chn->chLoopS); | |
346 } | |
347 else | |
348 { | |
287
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
349 static const DMFixedPoint zero = { 0 }; |
0 | 350 DBG("%d (%x)]\n", 0, 0); |
351 mixResult = mixer->jvmMixChannel_BW(mixer, chn, | |
287
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
352 ab, mixDone, zero); |
0 | 353 } |
354 } | |
355 | |
356 mixDone -= mixResult; | |
357 ab += mixResult * mixer->outChannels; | |
358 } | |
359 | |
360 #ifdef JSS_DEBUG | |
361 if (mixDone < 0) | |
362 JSSWARNING(DMERR_BOUNDS,, "mixDone < 0 in mixing logic loop.\n"); | |
363 #endif | |
364 } | |
365 | |
366 | |
367 void jvmRenderAudio(JSSMixer *mixer, void *mixBuffer, const int mixLength) | |
368 { | |
369 int i, blockLength, mixLeft; | |
51
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
370 JMIXER_ADDBUF_TYPE *ab; |
0 | 371 |
372 JSS_LOCK(mixer); | |
373 | |
374 assert(mixer != NULL); | |
375 assert(mixBuffer != NULL); | |
376 assert(mixLength > 0); | |
52 | 377 assert(mixLength * mixer->outChannels <= mixer->addBufSize); |
0 | 378 |
379 // Clear mixer->addBuffer | |
51
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
380 memset(mixer->addBuffer, 0, mixLength * mixer->outChannels * sizeof(JMIXER_ADDBUF_TYPE)); |
0 | 381 |
382 ab = mixer->addBuffer; | |
383 mixLeft = mixLength; | |
384 while (mixLeft > 0) | |
385 { | |
386 // Check for callbacks | |
387 blockLength = mixLeft; | |
388 | |
389 if (mixer->cbFunction) | |
390 { | |
391 if (mixer->cbCounter <= 0) | |
392 { | |
393 mixer->cbFunction(mixer, mixer->cbData); | |
394 mixer->cbCounter = mixer->cbFreq; | |
395 } | |
396 | |
397 if (mixer->cbCounter < blockLength) | |
398 blockLength = mixer->cbCounter; | |
399 } | |
400 | |
401 // Do mixing | |
402 for (i = 0; i < jsetNChannels; i++) | |
403 { | |
404 JSSChannel *chn = &(mixer->channels[i]); | |
405 if (chn->chPlaying && !chn->chMute) | |
406 jvmMixChannel(mixer, chn, ab, blockLength); | |
407 } | |
408 | |
409 /* | |
410 if (chn->chPlaying) | |
411 { | |
412 if (!chn->chMute) | |
413 jvmMixChannel(mixer, chn, ab, blockLength); | |
414 else | |
415 jvmAdvanceChannel(mixer, chn, blockLength); | |
416 } | |
417 */ | |
418 | |
419 ab += blockLength * mixer->outChannels; | |
420 mixLeft -= blockLength; | |
421 mixer->cbCounter -= blockLength; | |
422 } | |
423 | |
424 // Post-process | |
425 mixer->jvmPostProcess(mixer->addBuffer, mixBuffer, mixLength * mixer->outChannels); | |
426 | |
427 JSS_UNLOCK(mixer); | |
428 } | |
429 | |
430 | |
431 int jvmSetCallback(JSSMixer * mixer, void (*cbFunction) (void *, void *), void *cbData) | |
432 { | |
433 assert(mixer); | |
434 | |
435 if (cbFunction == NULL) | |
436 JSSERROR(DMERR_NULLPTR, DMERR_NULLPTR, "NULL pointer given as cbFunction"); | |
437 | |
438 JSS_LOCK(mixer); | |
439 | |
440 mixer->cbFunction = cbFunction; | |
441 mixer->cbData = cbData; | |
442 | |
443 JSS_UNLOCK(mixer); | |
444 | |
445 return DMERR_OK; | |
446 } | |
447 | |
448 | |
449 void jvmRemoveCallback(JSSMixer * mixer) | |
450 { | |
451 assert(mixer); | |
452 | |
453 JSS_LOCK(mixer); | |
454 | |
455 mixer->cbFunction = NULL; | |
456 mixer->cbData = NULL; | |
457 mixer->cbFreq = mixer->cbCounter = 0; | |
458 | |
459 JSS_UNLOCK(mixer); | |
460 } | |
461 | |
462 | |
463 int jvmSetCallbackFreq(JSSMixer * mixer, const int cbFreq) | |
464 { | |
465 assert(mixer); | |
466 | |
467 JSS_LOCK(mixer); | |
468 | |
186
dc22e3f77c9a
Fix tempo (callback frequency) calculation.
Matti Hamalainen <ccr@tnsp.org>
parents:
173
diff
changeset
|
469 mixer->cbFreq = cbFreq; |
0 | 470 mixer->cbCounter = 0; |
471 | |
472 //fprintf(stderr, "set(outFreq = %d, cbFreq = %d) = %d\n", mixer->outFreq, cbFreq, mixer->cbFreq); | |
473 | |
474 JSS_UNLOCK(mixer); | |
475 return DMERR_OK; | |
476 } | |
477 | |
478 | |
479 /* Channel manipulation routines | |
480 */ | |
481 void jvmPlay(JSSMixer * mixer, const int channel) | |
482 { | |
483 JSS_LOCK(mixer); | |
484 mixer->channels[channel].chPlaying = TRUE; | |
485 JSS_UNLOCK(mixer); | |
486 } | |
487 | |
488 | |
489 void jvmStop(JSSMixer * mixer, const int channel) | |
490 { | |
491 JSS_LOCK(mixer); | |
492 mixer->channels[channel].chPlaying = FALSE; | |
493 JSS_UNLOCK(mixer); | |
494 } | |
495 | |
496 | |
227
b7e23d91a8c2
Add jvmReset() function for reseting channel's position and pitch.
Matti Hamalainen <ccr@tnsp.org>
parents:
186
diff
changeset
|
497 void jvmReset(JSSMixer * mixer, const int channel) |
b7e23d91a8c2
Add jvmReset() function for reseting channel's position and pitch.
Matti Hamalainen <ccr@tnsp.org>
parents:
186
diff
changeset
|
498 { |
b7e23d91a8c2
Add jvmReset() function for reseting channel's position and pitch.
Matti Hamalainen <ccr@tnsp.org>
parents:
186
diff
changeset
|
499 JSSChannel *c; |
b7e23d91a8c2
Add jvmReset() function for reseting channel's position and pitch.
Matti Hamalainen <ccr@tnsp.org>
parents:
186
diff
changeset
|
500 |
b7e23d91a8c2
Add jvmReset() function for reseting channel's position and pitch.
Matti Hamalainen <ccr@tnsp.org>
parents:
186
diff
changeset
|
501 JSS_LOCK(mixer); |
b7e23d91a8c2
Add jvmReset() function for reseting channel's position and pitch.
Matti Hamalainen <ccr@tnsp.org>
parents:
186
diff
changeset
|
502 c = &mixer->channels[channel]; |
b7e23d91a8c2
Add jvmReset() function for reseting channel's position and pitch.
Matti Hamalainen <ccr@tnsp.org>
parents:
186
diff
changeset
|
503 |
b7e23d91a8c2
Add jvmReset() function for reseting channel's position and pitch.
Matti Hamalainen <ccr@tnsp.org>
parents:
186
diff
changeset
|
504 c->chDirection = TRUE; |
b7e23d91a8c2
Add jvmReset() function for reseting channel's position and pitch.
Matti Hamalainen <ccr@tnsp.org>
parents:
186
diff
changeset
|
505 c->chPos.dw = c->chDeltaO.dw = 0; |
b7e23d91a8c2
Add jvmReset() function for reseting channel's position and pitch.
Matti Hamalainen <ccr@tnsp.org>
parents:
186
diff
changeset
|
506 |
b7e23d91a8c2
Add jvmReset() function for reseting channel's position and pitch.
Matti Hamalainen <ccr@tnsp.org>
parents:
186
diff
changeset
|
507 JSS_UNLOCK(mixer); |
b7e23d91a8c2
Add jvmReset() function for reseting channel's position and pitch.
Matti Hamalainen <ccr@tnsp.org>
parents:
186
diff
changeset
|
508 } |
b7e23d91a8c2
Add jvmReset() function for reseting channel's position and pitch.
Matti Hamalainen <ccr@tnsp.org>
parents:
186
diff
changeset
|
509 |
b7e23d91a8c2
Add jvmReset() function for reseting channel's position and pitch.
Matti Hamalainen <ccr@tnsp.org>
parents:
186
diff
changeset
|
510 |
0 | 511 void jvmSetSample(JSSMixer * mixer, const int channel, |
36
f3407a58e01e
Change DMFixedPoint types and appropriate JSS functions back to using signed
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
512 void *data, const Sint32 size, const Sint32 loopS, |
f3407a58e01e
Change DMFixedPoint types and appropriate JSS functions back to using signed
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
513 const Sint32 loopE, const int flags) |
0 | 514 { |
515 JSSChannel *c; | |
516 | |
517 JSS_LOCK(mixer); | |
518 c = &mixer->channels[channel]; | |
519 | |
287
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
520 FP_SETHL(c->chSize, size, 0); |
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
521 FP_SETHL(c->chLoopS, loopS, 0); |
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
227
diff
changeset
|
522 FP_SETHL(c->chLoopE, loopE, 0); |
54 | 523 c->chData = data; |
524 c->chFlags = flags; | |
0 | 525 c->chDirection = TRUE; |
54 | 526 c->chPos.dw = c->chDeltaO.dw = 0; |
0 | 527 |
528 JSS_UNLOCK(mixer); | |
529 } | |
530 | |
531 | |
532 void jvmSetFreq(JSSMixer * mixer, const int channel, const int freq) | |
533 { | |
534 JSS_LOCK(mixer); | |
535 | |
536 mixer->channels[channel].chFreq = freq; | |
537 | |
538 if (mixer->outFreq > 0) | |
539 { | |
540 DMFixedPoint a, b; | |
541 FP_SETHL(a, freq, 0); | |
542 FP_CONV(b, mixer->outFreq); | |
543 FP_DIV_R(mixer->channels[channel].chDeltaO, a, b); | |
544 } | |
545 else | |
546 { | |
547 FP_SET(mixer->channels[channel].chDeltaO, 0); | |
548 } | |
549 | |
550 JSS_UNLOCK(mixer); | |
551 } | |
552 | |
553 | |
554 int jvmGetFreq(JSSMixer * mixer, const int channel) | |
555 { | |
556 int tmp; | |
557 | |
558 JSS_LOCK(mixer); | |
559 tmp = mixer->channels[channel].chFreq; | |
560 JSS_UNLOCK(mixer); | |
561 | |
562 return tmp; | |
563 } | |
564 | |
565 | |
566 void jvmSetVolume(JSSMixer * mixer, const int channel, const int volume) | |
567 { | |
568 JSS_LOCK(mixer); | |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
569 FP_SETHL(mixer->channels[channel].chVolume, volume, 0); |
139
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
570 mixer->channels[channel].chVolumeD = 0; |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
571 mixer->channels[channel].chDeltaV.dw = 0; |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
572 JSS_UNLOCK(mixer); |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
573 } |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
574 |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
575 |
139
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
576 void jvmSetVolumeRamp(JSSMixer * mixer, const int channel, const int start, const int end, const int len) |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
577 { |
139
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
578 int tmp; |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
579 DMFixedPoint a, b; |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
580 JSS_LOCK(mixer); |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
581 FP_SETHL(mixer->channels[channel].chVolume, start, 0); |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
582 |
139
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
583 tmp = mixer->channels[channel].chVolumeD = |
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
584 len > 0 ? ((mixer->outFreq * len) / 1000) : mixer->cbFreq; |
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
585 |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
586 FP_SETHL(a, (end - start), 0); |
139
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
587 FP_CONV(b, tmp); |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
588 FP_DIV_R(mixer->channels[channel].chDeltaV, a, b); |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
589 |
0 | 590 JSS_UNLOCK(mixer); |
591 } | |
592 | |
593 | |
594 int jvmGetVolume(JSSMixer * mixer, const int channel) | |
595 { | |
596 int tmp; | |
597 | |
598 JSS_LOCK(mixer); | |
809
eba3b87f3f84
Add some separate macros for 64/32 precision fixed point types.
Matti Hamalainen <ccr@tnsp.org>
parents:
658
diff
changeset
|
599 tmp = FP_GETH32(mixer->channels[channel].chVolume); |
0 | 600 JSS_UNLOCK(mixer); |
601 | |
602 return tmp; | |
603 } | |
604 | |
605 | |
36
f3407a58e01e
Change DMFixedPoint types and appropriate JSS functions back to using signed
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
606 void jvmSetPos(JSSMixer * mixer, const int channel, const Sint32 pos) |
0 | 607 { |
608 JSS_LOCK(mixer); | |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
609 FP_SETHL(mixer->channels[channel].chPos, pos, 0); |
0 | 610 JSS_UNLOCK(mixer); |
611 } | |
612 | |
613 | |
36
f3407a58e01e
Change DMFixedPoint types and appropriate JSS functions back to using signed
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
614 Sint32 jvmGetPos(JSSMixer * mixer, const int channel) |
0 | 615 { |
36
f3407a58e01e
Change DMFixedPoint types and appropriate JSS functions back to using signed
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
616 Sint32 tmp; |
0 | 617 |
618 JSS_LOCK(mixer); | |
809
eba3b87f3f84
Add some separate macros for 64/32 precision fixed point types.
Matti Hamalainen <ccr@tnsp.org>
parents:
658
diff
changeset
|
619 tmp = FP_GETH32(mixer->channels[channel].chPos); |
0 | 620 JSS_UNLOCK(mixer); |
621 | |
622 return tmp; | |
623 } | |
624 | |
625 | |
626 void jvmSetPan(JSSMixer * mixer, const int channel, const int panning) | |
627 { | |
628 JSS_LOCK(mixer); | |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
629 FP_SETHL(mixer->channels[channel].chPanning, panning, 0); |
139
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
630 mixer->channels[channel].chPanningD = 0; |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
631 mixer->channels[channel].chDeltaP.dw = 0; |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
632 JSS_UNLOCK(mixer); |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
633 } |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
634 |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
635 |
139
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
636 void jvmSetPanRamp(JSSMixer * mixer, const int channel, const int start, const int end, const int len) |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
637 { |
139
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
638 int tmp; |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
639 DMFixedPoint a, b; |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
640 JSS_LOCK(mixer); |
139
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
641 |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
642 FP_SETHL(mixer->channels[channel].chPanning, start, 0); |
139
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
643 |
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
644 tmp = mixer->channels[channel].chPanningD = |
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
645 len > 0 ? ((mixer->outFreq * len) / 1000) : mixer->cbFreq; |
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
646 |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
647 FP_SETHL(a, (end - start), 0); |
139
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
648 FP_CONV(b, tmp); |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
649 FP_DIV_R(mixer->channels[channel].chDeltaP, a, b); |
139
111f3e4b57ad
Improve volume ramping functionality to allow arbitrary length ramps.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
650 |
0 | 651 JSS_UNLOCK(mixer); |
652 } | |
653 | |
654 | |
655 int jvmGetPan(JSSMixer * mixer, const int channel) | |
656 { | |
657 int tmp; | |
658 | |
659 JSS_LOCK(mixer); | |
809
eba3b87f3f84
Add some separate macros for 64/32 precision fixed point types.
Matti Hamalainen <ccr@tnsp.org>
parents:
658
diff
changeset
|
660 tmp = FP_GETH32(mixer->channels[channel].chPanning); |
0 | 661 JSS_UNLOCK(mixer); |
662 | |
663 return tmp; | |
664 } | |
665 | |
666 | |
667 void jvmMute(JSSMixer * mixer, const int channel, const BOOL mute) | |
668 { | |
669 JSS_LOCK(mixer); | |
670 mixer->channels[channel].chMute = mute; | |
671 JSS_UNLOCK(mixer); | |
672 } | |
673 | |
674 | |
141
0c9438a2c72a
Add function jvmGetMute() to get status of channel mute.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
675 BOOL jvmGetMute(JSSMixer * mixer, const int channel) |
0c9438a2c72a
Add function jvmGetMute() to get status of channel mute.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
676 { |
0c9438a2c72a
Add function jvmGetMute() to get status of channel mute.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
677 BOOL tmp; |
0c9438a2c72a
Add function jvmGetMute() to get status of channel mute.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
678 |
0c9438a2c72a
Add function jvmGetMute() to get status of channel mute.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
679 JSS_LOCK(mixer); |
0c9438a2c72a
Add function jvmGetMute() to get status of channel mute.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
680 tmp = mixer->channels[channel].chMute; |
0c9438a2c72a
Add function jvmGetMute() to get status of channel mute.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
681 JSS_UNLOCK(mixer); |
0c9438a2c72a
Add function jvmGetMute() to get status of channel mute.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
682 |
0c9438a2c72a
Add function jvmGetMute() to get status of channel mute.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
683 return tmp; |
0c9438a2c72a
Add function jvmGetMute() to get status of channel mute.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
684 } |
0c9438a2c72a
Add function jvmGetMute() to get status of channel mute.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
685 |
0c9438a2c72a
Add function jvmGetMute() to get status of channel mute.
Matti Hamalainen <ccr@tnsp.org>
parents:
140
diff
changeset
|
686 |
0 | 687 void jvmClear(JSSMixer * mixer, const int channel) |
688 { | |
689 JSS_LOCK(mixer); | |
690 memset(&mixer->channels[channel], 0, sizeof(JSSChannel)); | |
691 JSS_UNLOCK(mixer); | |
692 } | |
693 | |
694 | |
695 void jvmSetGlobalVol(JSSMixer * mixer, const int volume) | |
696 { | |
697 JSS_LOCK(mixer); | |
698 mixer->globalVol = volume; | |
699 JSS_UNLOCK(mixer); | |
700 } | |
701 | |
702 | |
703 int jvmGetGlobalVol(JSSMixer * mixer) | |
704 { | |
705 int tmp; | |
706 | |
707 JSS_LOCK(mixer); | |
708 tmp = mixer->globalVol; | |
709 JSS_UNLOCK(mixer); | |
710 | |
711 return tmp; | |
712 } |