Mercurial > sdl-ios-xcode
comparison src/audio/SDL_audio.c @ 4024:000a99b4be87 SDL-1.2
Reverted patch in revision #3139, since it changes behaviour, which isn't good
at this stage of 1.2.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Mon, 09 Jul 2007 00:25:31 +0000 |
parents | 6831b8723a85 |
children | 009d85e98922 |
comparison
equal
deleted
inserted
replaced
4023:5ec68276e4de | 4024:000a99b4be87 |
---|---|
114 &EPOCAudio_bootstrap, | 114 &EPOCAudio_bootstrap, |
115 #endif | 115 #endif |
116 NULL | 116 NULL |
117 }; | 117 }; |
118 SDL_AudioDevice *current_audio = NULL; | 118 SDL_AudioDevice *current_audio = NULL; |
119 | |
120 /* | |
121 * If non-zero, use legacy behaviour (memset the callback buffer before call). | |
122 * Changed to NOT initializing the buffer before the callback in 1.2.12. | |
123 * Set environment SDL_AUDIO_MUST_INIT_BUFFERS=1 to get old behaviour. | |
124 */ | |
125 static int must_init_callback_buffer = 0; | |
126 | 119 |
127 /* Various local functions */ | 120 /* Various local functions */ |
128 int SDL_AudioInit(const char *driver_name); | 121 int SDL_AudioInit(const char *driver_name); |
129 void SDL_AudioQuit(void); | 122 void SDL_AudioQuit(void); |
130 | 123 |
196 if ( stream == NULL ) { | 189 if ( stream == NULL ) { |
197 stream = audio->fake_stream; | 190 stream = audio->fake_stream; |
198 } | 191 } |
199 } | 192 } |
200 | 193 |
201 if ( must_init_callback_buffer ) { | 194 SDL_memset(stream, silence, stream_len); |
202 SDL_memset(stream, silence, stream_len); | |
203 } | |
204 | 195 |
205 if ( ! audio->paused ) { | 196 if ( ! audio->paused ) { |
206 SDL_mutexP(audio->mixer_lock); | 197 SDL_mutexP(audio->mixer_lock); |
207 (*fill)(udata, stream, stream_len); | 198 (*fill)(udata, stream, stream_len); |
208 SDL_mutexV(audio->mixer_lock); | 199 SDL_mutexV(audio->mixer_lock); |
308 | 299 |
309 int SDL_AudioInit(const char *driver_name) | 300 int SDL_AudioInit(const char *driver_name) |
310 { | 301 { |
311 SDL_AudioDevice *audio; | 302 SDL_AudioDevice *audio; |
312 int i = 0, idx; | 303 int i = 0, idx; |
313 const char *envr = SDL_getenv("SDL_AUDIO_MUST_INIT_BUFFERS"); | |
314 | |
315 must_init_callback_buffer = ((envr != NULL) && (SDL_atoi(envr))); | |
316 | 304 |
317 /* Check to make sure we don't overwrite 'current_audio' */ | 305 /* Check to make sure we don't overwrite 'current_audio' */ |
318 if ( current_audio != NULL ) { | 306 if ( current_audio != NULL ) { |
319 SDL_AudioQuit(); | 307 SDL_AudioQuit(); |
320 } | 308 } |