Mercurial > SDL_sound_CoreAudio
annotate SDL_sound.c @ 99:3f0beddfd9c9
Updated.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Tue, 02 Oct 2001 17:54:16 +0000 |
parents | dfdf7b4e05bd |
children | 72502bed0aef |
rev | line source |
---|---|
4 | 1 /* |
2 * SDL_sound -- An abstract sound format decoding API. | |
3 * Copyright (C) 2001 Ryan C. Gordon. | |
4 * | |
5 * This library is free software; you can redistribute it and/or | |
6 * modify it under the terms of the GNU Lesser General Public | |
7 * License as published by the Free Software Foundation; either | |
8 * version 2.1 of the License, or (at your option) any later version. | |
9 * | |
10 * This library is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 * Lesser General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU Lesser General Public | |
16 * License along with this library; if not, write to the Free Software | |
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 */ | |
19 | |
20 /** | |
21 * This file implements the core API, which is relatively simple. | |
22 * The real meat of SDL_sound is in the decoders directory. | |
23 * | |
24 * Documentation is in SDL_sound.h ... It's verbose, honest. :) | |
25 * | |
26 * Please see the file LICENSE in the source's root directory. | |
27 * | |
28 * This file written by Ryan C. Gordon. (icculus@clutteredmind.org) | |
29 */ | |
30 | |
31 | |
32 #include <stdio.h> | |
33 #include <stdlib.h> | |
34 #include <string.h> | |
35 #include <assert.h> | |
36 #include <ctype.h> | |
37 | |
38 #include "SDL.h" | |
39 #include "SDL_sound.h" | |
40 | |
41 #define __SDL_SOUND_INTERNAL__ | |
42 #include "SDL_sound_internal.h" | |
43 | |
44 | |
45 /* The various decoder drivers... */ | |
46 | |
10
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
47 #if (defined SOUND_SUPPORTS_MP3) |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
48 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MP3; |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
49 #endif |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
50 |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
51 #if (defined SOUND_SUPPORTS_MOD) |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
52 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MOD; |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
53 #endif |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
54 |
20 | 55 #if (defined SOUND_SUPPORTS_WAV) |
56 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_WAV; | |
57 #endif | |
58 | |
37
f27bcbcaeab1
Added AIFF entry, and (for now) some multiple-streams-in-one-rwops support.
Ryan C. Gordon <icculus@icculus.org>
parents:
26
diff
changeset
|
59 #if (defined SOUND_SUPPORTS_AIFF) |
f27bcbcaeab1
Added AIFF entry, and (for now) some multiple-streams-in-one-rwops support.
Ryan C. Gordon <icculus@icculus.org>
parents:
26
diff
changeset
|
60 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_AIFF; |
f27bcbcaeab1
Added AIFF entry, and (for now) some multiple-streams-in-one-rwops support.
Ryan C. Gordon <icculus@icculus.org>
parents:
26
diff
changeset
|
61 #endif |
f27bcbcaeab1
Added AIFF entry, and (for now) some multiple-streams-in-one-rwops support.
Ryan C. Gordon <icculus@icculus.org>
parents:
26
diff
changeset
|
62 |
26
ddc3614c9042
Bugfix (thanks Tsuyoshi Iguchi!), and Ogg Vorbis decoder entry.
Ryan C. Gordon <icculus@icculus.org>
parents:
20
diff
changeset
|
63 #if (defined SOUND_SUPPORTS_OGG) |
ddc3614c9042
Bugfix (thanks Tsuyoshi Iguchi!), and Ogg Vorbis decoder entry.
Ryan C. Gordon <icculus@icculus.org>
parents:
20
diff
changeset
|
64 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_OGG; |
ddc3614c9042
Bugfix (thanks Tsuyoshi Iguchi!), and Ogg Vorbis decoder entry.
Ryan C. Gordon <icculus@icculus.org>
parents:
20
diff
changeset
|
65 #endif |
ddc3614c9042
Bugfix (thanks Tsuyoshi Iguchi!), and Ogg Vorbis decoder entry.
Ryan C. Gordon <icculus@icculus.org>
parents:
20
diff
changeset
|
66 |
4 | 67 #if (defined SOUND_SUPPORTS_VOC) |
68 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_VOC; | |
69 #endif | |
70 | |
71 #if (defined SOUND_SUPPORTS_RAW) | |
72 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_RAW; | |
73 #endif | |
74 | |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
75 |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
76 |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
77 typedef struct |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
78 { |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
79 int available; |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
80 const Sound_DecoderFunctions *funcs; |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
81 } decoder_element; |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
82 |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
83 static decoder_element decoders[] = |
4 | 84 { |
10
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
85 #if (defined SOUND_SUPPORTS_MP3) |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
86 { 0, &__Sound_DecoderFunctions_MP3 }, |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
87 #endif |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
88 |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
89 #if (defined SOUND_SUPPORTS_MOD) |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
90 { 0, &__Sound_DecoderFunctions_MOD }, |
10
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
91 #endif |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
92 |
20 | 93 #if (defined SOUND_SUPPORTS_WAV) |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
94 { 0, &__Sound_DecoderFunctions_WAV }, |
20 | 95 #endif |
96 | |
37
f27bcbcaeab1
Added AIFF entry, and (for now) some multiple-streams-in-one-rwops support.
Ryan C. Gordon <icculus@icculus.org>
parents:
26
diff
changeset
|
97 #if (defined SOUND_SUPPORTS_AIFF) |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
98 { 0, &__Sound_DecoderFunctions_AIFF }, |
37
f27bcbcaeab1
Added AIFF entry, and (for now) some multiple-streams-in-one-rwops support.
Ryan C. Gordon <icculus@icculus.org>
parents:
26
diff
changeset
|
99 #endif |
f27bcbcaeab1
Added AIFF entry, and (for now) some multiple-streams-in-one-rwops support.
Ryan C. Gordon <icculus@icculus.org>
parents:
26
diff
changeset
|
100 |
26
ddc3614c9042
Bugfix (thanks Tsuyoshi Iguchi!), and Ogg Vorbis decoder entry.
Ryan C. Gordon <icculus@icculus.org>
parents:
20
diff
changeset
|
101 #if (defined SOUND_SUPPORTS_OGG) |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
102 { 0, &__Sound_DecoderFunctions_OGG }, |
26
ddc3614c9042
Bugfix (thanks Tsuyoshi Iguchi!), and Ogg Vorbis decoder entry.
Ryan C. Gordon <icculus@icculus.org>
parents:
20
diff
changeset
|
103 #endif |
ddc3614c9042
Bugfix (thanks Tsuyoshi Iguchi!), and Ogg Vorbis decoder entry.
Ryan C. Gordon <icculus@icculus.org>
parents:
20
diff
changeset
|
104 |
4 | 105 #if (defined SOUND_SUPPORTS_VOC) |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
106 { 0, &__Sound_DecoderFunctions_VOC }, |
4 | 107 #endif |
108 | |
109 #if (defined SOUND_SUPPORTS_RAW) | |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
110 { 0, &__Sound_DecoderFunctions_RAW }, |
4 | 111 #endif |
112 }; | |
113 | |
114 | |
115 | |
116 /* General SDL_sound state ... */ | |
117 | |
118 static int initialized = 0; | |
119 static Sound_Sample *samplesList = NULL; /* this is a linked list. */ | |
120 static const Sound_DecoderInfo **available_decoders = NULL; | |
121 | |
122 | |
123 /* functions ... */ | |
124 | |
125 void Sound_GetLinkedVersion(Sound_Version *ver) | |
126 { | |
127 if (ver != NULL) | |
128 { | |
129 ver->major = SOUND_VER_MAJOR; | |
130 ver->minor = SOUND_VER_MINOR; | |
131 ver->patch = SOUND_VER_PATCH; | |
132 } /* if */ | |
133 } /* Sound_GetLinkedVersion */ | |
134 | |
135 | |
136 int Sound_Init(void) | |
137 { | |
138 size_t i; | |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
139 size_t pos = 0; |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
140 size_t total = sizeof (decoders) / sizeof (decoders[0]); |
4 | 141 BAIL_IF_MACRO(initialized, ERR_IS_INITIALIZED, 0); |
142 samplesList = NULL; | |
143 | |
144 SDL_Init(SDL_INIT_AUDIO); | |
145 | |
146 available_decoders = (const Sound_DecoderInfo **) | |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
147 malloc((total + 1) * sizeof (Sound_DecoderInfo *)); |
4 | 148 BAIL_IF_MACRO(available_decoders == NULL, ERR_OUT_OF_MEMORY, 0); |
149 | |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
150 for (i = 0; i < total; i++) |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
151 { |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
152 decoders[i].available = decoders[i].funcs->init(); |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
153 if (decoders[i].available) |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
154 { |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
155 available_decoders[pos] = &(decoders[i].funcs->info); |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
156 pos++; |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
157 } /* if */ |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
158 } /* for */ |
4 | 159 |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
160 available_decoders[pos] = NULL; |
26
ddc3614c9042
Bugfix (thanks Tsuyoshi Iguchi!), and Ogg Vorbis decoder entry.
Ryan C. Gordon <icculus@icculus.org>
parents:
20
diff
changeset
|
161 |
4 | 162 initialized = 1; |
163 return(1); | |
164 } /* Sound_Init */ | |
165 | |
166 | |
167 int Sound_Quit(void) | |
168 { | |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
169 size_t total = sizeof (decoders) / sizeof (decoders[0]); |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
170 size_t i; |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
171 |
4 | 172 BAIL_IF_MACRO(!initialized, ERR_NOT_INITIALIZED, 0); |
173 | |
174 while (((volatile Sound_Sample *) samplesList) != NULL) | |
175 Sound_FreeSample(samplesList); | |
176 | |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
177 for (i = 0; i < total; i++) |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
178 { |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
179 if (decoders[i].available) |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
180 { |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
181 decoders[i].funcs->quit(); |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
182 decoders[i].available = 0; |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
183 } /* if */ |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
184 } /* for */ |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
185 |
4 | 186 if (available_decoders != NULL) |
80
25ee62c6b333
Fixed a const complaint from Visual C++ 6.0.
Ryan C. Gordon <icculus@icculus.org>
parents:
62
diff
changeset
|
187 free((void *) available_decoders); |
4 | 188 available_decoders = NULL; |
189 | |
190 initialized = 0; | |
191 | |
192 return(1); | |
193 } /* Sound_Quit */ | |
194 | |
195 | |
196 const Sound_DecoderInfo **Sound_AvailableDecoders(void) | |
197 { | |
198 return(available_decoders); /* READ. ONLY. */ | |
199 } /* Sound_AvailableDecoders */ | |
200 | |
201 | |
202 const char *Sound_GetError(void) | |
203 { | |
204 return(SDL_GetError()); | |
205 } /* Sound_GetError */ | |
206 | |
207 | |
208 void Sound_ClearError(void) | |
209 { | |
210 SDL_ClearError(); | |
211 } /* Sound_ClearError */ | |
212 | |
213 | |
214 /* | |
215 * This is declared in the internal header. | |
216 */ | |
217 void Sound_SetError(const char *err) | |
218 { | |
219 if (err != NULL) | |
10
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
220 { |
62
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
48
diff
changeset
|
221 SNDDBG(("Sound_SetError(\"%s\");\n", err)); |
4 | 222 SDL_SetError(err); |
10
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
223 } /* if */ |
4 | 224 } /* Sound_SetError */ |
225 | |
226 | |
227 /* | |
228 * -ansi and -pedantic flags prevent use of strcasecmp() on Linux, and | |
229 * I honestly don't want to mess around with figuring out if a given | |
230 * platform has "strcasecmp", "stricmp", or | |
231 * "compare_two_damned_strings_case_insensitive", which I hear is in the | |
232 * next release of Carbon. :) This is exported so decoders may use it if | |
233 * they like. | |
234 */ | |
235 int __Sound_strcasecmp(const char *x, const char *y) | |
236 { | |
237 int ux, uy; | |
238 | |
98
dfdf7b4e05bd
Changed __Sound_strcasecmp() to handle NULL strings gracefully.
Ryan C. Gordon <icculus@icculus.org>
parents:
80
diff
changeset
|
239 if (x == y) /* same pointer? Both NULL? */ |
dfdf7b4e05bd
Changed __Sound_strcasecmp() to handle NULL strings gracefully.
Ryan C. Gordon <icculus@icculus.org>
parents:
80
diff
changeset
|
240 return(0); |
dfdf7b4e05bd
Changed __Sound_strcasecmp() to handle NULL strings gracefully.
Ryan C. Gordon <icculus@icculus.org>
parents:
80
diff
changeset
|
241 |
dfdf7b4e05bd
Changed __Sound_strcasecmp() to handle NULL strings gracefully.
Ryan C. Gordon <icculus@icculus.org>
parents:
80
diff
changeset
|
242 if (x == NULL) |
dfdf7b4e05bd
Changed __Sound_strcasecmp() to handle NULL strings gracefully.
Ryan C. Gordon <icculus@icculus.org>
parents:
80
diff
changeset
|
243 return(-1); |
dfdf7b4e05bd
Changed __Sound_strcasecmp() to handle NULL strings gracefully.
Ryan C. Gordon <icculus@icculus.org>
parents:
80
diff
changeset
|
244 |
dfdf7b4e05bd
Changed __Sound_strcasecmp() to handle NULL strings gracefully.
Ryan C. Gordon <icculus@icculus.org>
parents:
80
diff
changeset
|
245 if (y == NULL) |
dfdf7b4e05bd
Changed __Sound_strcasecmp() to handle NULL strings gracefully.
Ryan C. Gordon <icculus@icculus.org>
parents:
80
diff
changeset
|
246 return(1); |
dfdf7b4e05bd
Changed __Sound_strcasecmp() to handle NULL strings gracefully.
Ryan C. Gordon <icculus@icculus.org>
parents:
80
diff
changeset
|
247 |
4 | 248 do |
249 { | |
250 ux = toupper((int) *x); | |
251 uy = toupper((int) *y); | |
252 if (ux > uy) | |
253 return(1); | |
254 else if (ux < uy) | |
255 return(-1); | |
256 x++; | |
257 y++; | |
258 } while ((ux) && (uy)); | |
259 | |
260 return(0); | |
261 } /* __Sound_strcasecmp */ | |
262 | |
263 | |
264 /* | |
265 * Allocate a Sound_Sample, and fill in most of its fields. Those that need | |
266 * to be filled in later, by a decoder, will be initialized to zero. | |
267 */ | |
268 static Sound_Sample *alloc_sample(SDL_RWops *rw, Sound_AudioInfo *desired, | |
269 Uint32 bufferSize) | |
270 { | |
271 Sound_Sample *retval = malloc(sizeof (Sound_Sample)); | |
272 Sound_SampleInternal *internal = malloc(sizeof (Sound_SampleInternal)); | |
273 if ((retval == NULL) || (internal == NULL)) | |
274 { | |
275 Sound_SetError(ERR_OUT_OF_MEMORY); | |
276 if (retval) | |
277 free(retval); | |
278 if (internal) | |
279 free(internal); | |
280 | |
281 return(NULL); | |
282 } /* if */ | |
283 | |
284 memset(retval, '\0', sizeof (Sound_Sample)); | |
285 memset(internal, '\0', sizeof (Sound_SampleInternal)); | |
286 | |
287 assert(bufferSize > 0); | |
288 retval->buffer = malloc(bufferSize); /* pure ugly. */ | |
289 if (!retval->buffer) | |
290 { | |
291 Sound_SetError(ERR_OUT_OF_MEMORY); | |
292 free(internal); | |
293 free(retval); | |
294 return(NULL); | |
295 } /* if */ | |
296 memset(retval->buffer, '\0', bufferSize); | |
297 retval->buffer_size = bufferSize; | |
298 | |
299 if (desired != NULL) | |
300 memcpy(&retval->desired, desired, sizeof (Sound_AudioInfo)); | |
301 | |
302 internal->rw = rw; | |
303 retval->opaque = internal; | |
304 return(retval); | |
305 } /* alloc_sample */ | |
306 | |
307 | |
10
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
308 #if (defined DEBUG_CHATTER) |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
309 static __inline__ const char *fmt_to_str(Uint16 fmt) |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
310 { |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
311 switch(fmt) |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
312 { |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
313 case AUDIO_U8: |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
314 return("U8"); |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
315 case AUDIO_S8: |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
316 return("S8"); |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
317 case AUDIO_U16LSB: |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
318 return("U16LSB"); |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
319 case AUDIO_S16LSB: |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
320 return("S16LSB"); |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
321 case AUDIO_U16MSB: |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
322 return("U16MSB"); |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
323 case AUDIO_S16MSB: |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
324 return("S16MSB"); |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
325 } /* switch */ |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
326 |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
327 return("Unknown"); |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
328 } /* fmt_to_str */ |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
329 #endif |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
330 |
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
331 |
4 | 332 /* |
333 * The bulk of the Sound_NewSample() work is done here... | |
334 * Ask the specified decoder to handle the data in (rw), and if | |
335 * so, construct the Sound_Sample. Otherwise, try to wind (rw)'s stream | |
336 * back to where it was, and return false. | |
337 * | |
338 * !!! FIXME: This is big, ugly, nasty, and smelly. | |
339 */ | |
340 static int init_sample(const Sound_DecoderFunctions *funcs, | |
341 Sound_Sample *sample, const char *ext, | |
342 Sound_AudioInfo *_desired) | |
343 { | |
344 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; | |
37
f27bcbcaeab1
Added AIFF entry, and (for now) some multiple-streams-in-one-rwops support.
Ryan C. Gordon <icculus@icculus.org>
parents:
26
diff
changeset
|
345 Sound_AudioInfo desired; |
4 | 346 int pos = SDL_RWtell(internal->rw); /* !!! FIXME: Int? Really? */ |
347 | |
348 /* fill in the funcs for this decoder... */ | |
349 sample->decoder = &funcs->info; | |
350 internal->funcs = funcs; | |
351 if (!funcs->open(sample, ext)) | |
352 { | |
353 SDL_RWseek(internal->rw, pos, SEEK_SET); /* set for next try... */ | |
354 return(0); | |
355 } /* if */ | |
356 | |
357 /* success; we've got a decoder! */ | |
358 | |
359 /* Now we need to set up the conversion buffer... */ | |
360 | |
361 memcpy(&desired, (_desired != NULL) ? _desired : &sample->actual, | |
362 sizeof (Sound_AudioInfo)); | |
363 | |
364 if (SDL_BuildAudioCVT(&internal->sdlcvt, | |
365 sample->actual.format, | |
366 sample->actual.channels, | |
367 (int) sample->actual.rate, /* !!! FIXME: Int? Really? */ | |
368 desired.format, | |
369 desired.channels, | |
370 (int) desired.rate) == -1) /* !!! FIXME: Int? Really? */ | |
371 { | |
372 Sound_SetError(SDL_GetError()); | |
373 funcs->close(sample); | |
374 SDL_RWseek(internal->rw, pos, SEEK_SET); /* set for next try... */ | |
375 return(0); | |
376 } /* if */ | |
377 | |
378 if (internal->sdlcvt.len_mult > 1) | |
379 { | |
380 void *rc = realloc(sample->buffer, | |
381 sample->buffer_size * internal->sdlcvt.len_mult); | |
382 if (rc == NULL) | |
383 { | |
384 funcs->close(sample); | |
385 SDL_RWseek(internal->rw, pos, SEEK_SET); /* set for next try... */ | |
386 return(0); | |
387 } /* if */ | |
388 | |
389 sample->buffer = rc; | |
390 } /* if */ | |
391 | |
392 /* these pointers are all one and the same. */ | |
393 memcpy(&sample->desired, &desired, sizeof (Sound_AudioInfo)); | |
394 internal->sdlcvt.buf = internal->buffer = sample->buffer; | |
395 internal->buffer_size = sample->buffer_size / internal->sdlcvt.len_mult; | |
396 internal->sdlcvt.len = internal->buffer_size; | |
397 | |
398 /* Prepend our new Sound_Sample to the samplesList... */ | |
399 if (samplesList != NULL) | |
400 { | |
401 internal->next = samplesList; | |
402 if (samplesList != NULL) | |
403 internal->prev = sample; | |
404 } /* if */ | |
405 samplesList = sample; | |
406 | |
62
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
48
diff
changeset
|
407 SNDDBG(("New sample DESIRED format: %s format, %d rate, %d channels.\n", |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
48
diff
changeset
|
408 fmt_to_str(sample->desired.format), |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
48
diff
changeset
|
409 sample->desired.rate, |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
48
diff
changeset
|
410 sample->desired.channels)); |
10
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
411 |
62
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
48
diff
changeset
|
412 SNDDBG(("New sample ACTUAL format: %s format, %d rate, %d channels.\n", |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
48
diff
changeset
|
413 fmt_to_str(sample->actual.format), |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
48
diff
changeset
|
414 sample->actual.rate, |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
48
diff
changeset
|
415 sample->actual.channels)); |
10
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
416 |
62
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
48
diff
changeset
|
417 SNDDBG(("On-the-fly conversion: %s.\n", |
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
48
diff
changeset
|
418 internal->sdlcvt.needed ? "ENABLED" : "DISABLED")); |
10
cc2c32349380
Some debugging output, and MP3 and VOC entries, added.
Ryan C. Gordon <icculus@icculus.org>
parents:
4
diff
changeset
|
419 |
4 | 420 return(1); |
421 } /* init_sample */ | |
422 | |
423 | |
424 Sound_Sample *Sound_NewSample(SDL_RWops *rw, const char *ext, | |
425 Sound_AudioInfo *desired, Uint32 bSize) | |
426 { | |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
427 size_t total = sizeof (decoders) / sizeof (decoders[0]); |
4 | 428 size_t i; |
429 Sound_Sample *retval; | |
430 | |
431 /* sanity checks. */ | |
432 BAIL_IF_MACRO(!initialized, ERR_NOT_INITIALIZED, NULL); | |
433 BAIL_IF_MACRO(rw == NULL, ERR_INVALID_ARGUMENT, NULL); | |
434 | |
435 retval = alloc_sample(rw, desired, bSize); | |
436 if (!retval) | |
437 return(NULL); /* alloc_sample() sets error message... */ | |
438 | |
439 if (ext != NULL) | |
440 { | |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
441 for (i = 0; i < total; i++) |
4 | 442 { |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
443 if (decoders[i].available) |
4 | 444 { |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
445 const char *decoderExt = decoders[i].funcs->info.extension; |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
446 if (__Sound_strcasecmp(decoderExt, ext) == 0) |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
447 { |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
448 if (init_sample(decoders[i].funcs, retval, ext, desired)) |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
449 return(retval); |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
450 } /* if */ |
4 | 451 } /* if */ |
452 } /* for */ | |
453 } /* if */ | |
454 | |
455 /* no direct extension match? Try everything we've got... */ | |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
456 for (i = 0; i < total; i++) |
4 | 457 { |
48
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
458 if (decoders[i].available) |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
459 { |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
460 if (init_sample(decoders[i].funcs, retval, ext, desired)) |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
461 return(retval); |
c4b8c39a9798
Individual decoders are now initialized during Sound_Init(), and deinitialized
Ryan C. Gordon <icculus@icculus.org>
parents:
37
diff
changeset
|
462 } /* if */ |
4 | 463 } /* for */ |
464 | |
465 /* nothing could handle the sound data... */ | |
466 free(retval->opaque); | |
467 if (retval->buffer != NULL) | |
468 free(retval->buffer); | |
469 free(retval); | |
470 SDL_RWclose(rw); | |
471 Sound_SetError(ERR_UNSUPPORTED_FORMAT); | |
472 return(NULL); | |
473 } /* Sound_NewSample */ | |
474 | |
475 | |
476 Sound_Sample *Sound_NewSampleFromFile(const char *filename, | |
477 Sound_AudioInfo *desired, | |
478 Uint32 bufferSize) | |
479 { | |
480 const char *ext; | |
481 SDL_RWops *rw; | |
482 | |
483 BAIL_IF_MACRO(!initialized, ERR_NOT_INITIALIZED, NULL); | |
484 BAIL_IF_MACRO(filename == NULL, ERR_INVALID_ARGUMENT, NULL); | |
485 | |
486 ext = strrchr(filename, '.'); | |
487 rw = SDL_RWFromFile(filename, "rb"); | |
488 BAIL_IF_MACRO(rw == NULL, SDL_GetError(), NULL); | |
489 | |
490 if (ext != NULL) | |
491 ext++; | |
492 | |
493 return(Sound_NewSample(rw, ext, desired, bufferSize)); | |
494 } /* Sound_NewSampleFromFile */ | |
495 | |
496 | |
497 void Sound_FreeSample(Sound_Sample *sample) | |
498 { | |
499 Sound_SampleInternal *internal; | |
500 | |
501 if (!initialized) | |
502 { | |
503 Sound_SetError(ERR_NOT_INITIALIZED); | |
504 return; | |
505 } /* if */ | |
506 | |
507 if (sample == NULL) | |
508 { | |
509 Sound_SetError(ERR_INVALID_ARGUMENT); | |
510 return; | |
511 } /* if */ | |
512 | |
513 internal = (Sound_SampleInternal *) sample->opaque; | |
514 | |
515 internal->funcs->close(sample); | |
516 | |
517 /* update the samplesList... */ | |
518 if (internal->prev != NULL) | |
519 { | |
520 Sound_SampleInternal *prevInternal; | |
521 prevInternal = (Sound_SampleInternal *) internal->prev->opaque; | |
522 prevInternal->next = internal->next; | |
523 } /* if */ | |
524 else | |
525 { | |
526 assert(samplesList == sample); | |
527 samplesList = internal->next; | |
528 } /* else */ | |
529 | |
530 if (internal->next != NULL) | |
531 { | |
532 Sound_SampleInternal *nextInternal; | |
533 nextInternal = (Sound_SampleInternal *) internal->next->opaque; | |
534 nextInternal->prev = internal->prev; | |
535 } /* if */ | |
536 | |
537 /* nuke it... */ | |
538 if (internal->rw != NULL) /* this condition is a "just in case" thing. */ | |
539 SDL_RWclose(internal->rw); | |
540 assert(internal->buffer != NULL); | |
541 if (internal->buffer != sample->buffer) | |
542 free(internal->buffer); | |
543 free(internal); | |
544 if (sample->buffer != NULL) | |
545 free(sample->buffer); | |
546 free(sample); | |
547 } /* Sound_FreeSample */ | |
548 | |
549 | |
550 int Sound_SetBufferSize(Sound_Sample *sample, Uint32 newSize) | |
551 { | |
552 void *newBuf = NULL; | |
553 Sound_SampleInternal *internal = NULL; | |
554 | |
555 BAIL_IF_MACRO(!initialized, ERR_NOT_INITIALIZED, 0); | |
556 BAIL_IF_MACRO(sample == NULL, ERR_INVALID_ARGUMENT, 0); | |
557 internal = ((Sound_SampleInternal *) sample->opaque); | |
558 newBuf = realloc(sample->buffer, newSize * internal->sdlcvt.len_mult); | |
559 BAIL_IF_MACRO(newBuf == NULL, ERR_OUT_OF_MEMORY, 0); | |
560 | |
561 internal->sdlcvt.buf = internal->buffer = sample->buffer = newBuf; | |
562 sample->buffer_size = newSize; | |
563 internal->buffer_size = newSize / internal->sdlcvt.len_mult; | |
564 internal->sdlcvt.len = internal->buffer_size; | |
565 | |
566 return(1); | |
567 } /* Sound_SetBufferSize */ | |
568 | |
569 | |
570 Uint32 Sound_Decode(Sound_Sample *sample) | |
571 { | |
572 Sound_SampleInternal *internal = NULL; | |
573 Uint32 retval = 0; | |
574 | |
575 /* a boatload of sanity checks... */ | |
576 BAIL_IF_MACRO(!initialized, ERR_NOT_INITIALIZED, 0); | |
577 BAIL_IF_MACRO(sample == NULL, ERR_INVALID_ARGUMENT, 0); | |
578 BAIL_IF_MACRO(sample->flags & SOUND_SAMPLEFLAG_ERROR, ERR_PREV_ERROR, 0); | |
579 BAIL_IF_MACRO(sample->flags & SOUND_SAMPLEFLAG_EOF, ERR_PREV_EOF, 0); | |
580 | |
581 internal = (Sound_SampleInternal *) sample->opaque; | |
582 | |
583 assert(sample->buffer != NULL); | |
584 assert(sample->buffer_size > 0); | |
585 assert(internal->buffer != NULL); | |
586 assert(internal->buffer_size > 0); | |
587 | |
588 /* reset EAGAIN. Decoder can flip it back on if it needs to. */ | |
589 sample->flags &= !SOUND_SAMPLEFLAG_EAGAIN; | |
590 retval = internal->funcs->read(sample); | |
37
f27bcbcaeab1
Added AIFF entry, and (for now) some multiple-streams-in-one-rwops support.
Ryan C. Gordon <icculus@icculus.org>
parents:
26
diff
changeset
|
591 |
4 | 592 if (internal->sdlcvt.needed) |
593 { | |
594 internal->sdlcvt.len = retval; | |
595 SDL_ConvertAudio(&internal->sdlcvt); | |
596 retval *= internal->sdlcvt.len_mult; | |
597 } /* if */ | |
598 | |
599 return(retval); | |
600 } /* Sound_Decode */ | |
601 | |
602 | |
603 Uint32 Sound_DecodeAll(Sound_Sample *sample) | |
604 { | |
605 Sound_SampleInternal *internal = NULL; | |
606 void *buf = NULL; | |
607 Uint32 newBufSize = 0; | |
608 | |
609 BAIL_IF_MACRO(!initialized, ERR_NOT_INITIALIZED, 0); | |
610 | |
611 internal = (Sound_SampleInternal *) sample->opaque; | |
612 | |
613 while ( ((sample->flags & SOUND_SAMPLEFLAG_EOF) == 0) && | |
614 ((sample->flags & SOUND_SAMPLEFLAG_ERROR) == 0) ) | |
615 { | |
616 void *ptr = realloc(buf, newBufSize + sample->buffer_size); | |
617 if (ptr == NULL) | |
618 { | |
619 sample->flags |= SOUND_SAMPLEFLAG_ERROR; | |
620 Sound_SetError(ERR_OUT_OF_MEMORY); | |
621 } /* if */ | |
622 else | |
623 { | |
624 Uint32 br = Sound_Decode(sample); | |
625 memcpy( ((char *) buf) + newBufSize, sample->buffer, br ); | |
626 newBufSize += br; | |
627 } /* else */ | |
628 } /* while */ | |
629 | |
630 free(sample->buffer); | |
631 sample->buffer = internal->buffer = internal->sdlcvt.buf = buf; | |
632 sample->buffer_size = newBufSize; | |
633 internal->buffer_size = newBufSize / internal->sdlcvt.len_mult; | |
634 internal->sdlcvt.len_mult = internal->buffer_size; | |
635 | |
636 return(newBufSize); | |
637 } /* Sound_DecodeAll */ | |
638 | |
639 | |
640 /* end of SDL_sound.c ... */ | |
641 |