Mercurial > hg > dmlib
comparison jssmix.c @ 49:033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
8bit, but samples are internally upconverted to 16bit after module loading.)
Also prepare for floating point mixing support.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 01 Oct 2012 02:51:41 +0300 |
parents | f3407a58e01e |
children | 36e2f910219c |
comparison
equal
deleted
inserted
replaced
48:ee87513fff15 | 49:033c660c25f5 |
---|---|
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 | 9 |
10 #ifdef DM_USE_C | 10 #ifdef DM_USE_C |
11 #define JMIXER_HEADER | 11 #define JMIXER_HEADER |
12 #include "jmix_c.in.c" | 12 #include "jmix_c_in.c" |
13 #undef JMIXER_HEADER | 13 #undef JMIXER_HEADER |
14 #endif | 14 #endif |
15 | 15 |
16 #undef DM_USE_SIMD | 16 #undef DM_USE_SIMD |
17 | 17 |
18 #ifdef DM_USE_SIMD | 18 #ifdef DM_USE_SIMD |
19 #define JMIXER_HEADER | 19 #define JMIXER_HEADER |
20 #include "jmix_mmx.in.c" | 20 #include "jmix_mmx_in.c" |
21 #undef JMIXER_HEADER | 21 #undef JMIXER_HEADER |
22 #endif | 22 #endif |
23 | 23 |
24 | 24 |
25 typedef struct | 25 typedef struct |
83 | 83 |
84 | 84 |
85 JSSMixer *jvmInit(const int outFormat, const int outChannels, const int outFreq, const int mixerID) | 85 JSSMixer *jvmInit(const int outFormat, const int outChannels, const int outFreq, const int mixerID) |
86 { | 86 { |
87 JSSMixer *mixer; | 87 JSSMixer *mixer; |
88 int mixerIdx, v, i; | 88 int mixerIdx; |
89 | 89 |
90 // Check settings | 90 // Check settings |
91 if (outChannels < 1) | 91 if (outChannels < 1) |
92 { | 92 { |
93 JSSERROR(DMERR_INVALID_ARGS, NULL, | 93 JSSERROR(DMERR_INVALID_ARGS, NULL, |
153 { | 153 { |
154 JSSERROR(DMERR_MALLOC, NULL, | 154 JSSERROR(DMERR_MALLOC, NULL, |
155 "Could not allocate mixing addition buffer.\n"); | 155 "Could not allocate mixing addition buffer.\n"); |
156 } | 156 } |
157 | 157 |
158 // Initialize 8-bit volume table | |
159 for (v = jsetMinVol; v < jsetMaxVol; v++) | |
160 { | |
161 for (i = 0; i < 256; i++) | |
162 { | |
163 mixer->volTab8[v][i] = (v * (i - 128)); | |
164 } | |
165 } | |
166 | |
167 return mixer; | 158 return mixer; |
168 } | 159 } |
169 | 160 |
170 | 161 |
171 int jvmClose(JSSMixer * mixer) | 162 int jvmClose(JSSMixer * mixer) |