equal
deleted
inserted
replaced
172 } else { |
172 } else { |
173 silence = audio->spec.silence; |
173 silence = audio->spec.silence; |
174 stream_len = audio->spec.size; |
174 stream_len = audio->spec.size; |
175 } |
175 } |
176 |
176 |
177 stream = audio->GetAudioBuf(audio); |
|
178 if ( stream == NULL ) { |
|
179 stream = audio->fake_stream; |
|
180 } |
|
181 |
|
182 #if SDL_AUDIO_DRIVER_AHI |
177 #if SDL_AUDIO_DRIVER_AHI |
183 SDL_mutexV(audio->mixer_lock); |
178 SDL_mutexV(audio->mixer_lock); |
184 D(bug("Entering audio loop...\n")); |
179 D(bug("Entering audio loop...\n")); |
185 #endif |
180 #endif |
186 |
181 |
206 #endif |
201 #endif |
207 |
202 |
208 /* Loop, filling the audio buffers */ |
203 /* Loop, filling the audio buffers */ |
209 while ( audio->enabled ) { |
204 while ( audio->enabled ) { |
210 |
205 |
211 /* Wait for new current buffer to finish playing */ |
|
212 if ( stream == audio->fake_stream ) { |
|
213 SDL_Delay((audio->spec.samples*1000)/audio->spec.freq); |
|
214 } else { |
|
215 #if SDL_AUDIO_DRIVER_AHI |
|
216 if ( started > 1 ) |
|
217 #endif |
|
218 audio->WaitAudio(audio); |
|
219 } |
|
220 |
|
221 /* Fill the current buffer with sound */ |
206 /* Fill the current buffer with sound */ |
222 if ( audio->convert.needed ) { |
207 if ( audio->convert.needed ) { |
223 if ( audio->convert.buf ) { |
208 if ( audio->convert.buf ) { |
224 stream = audio->convert.buf; |
209 stream = audio->convert.buf; |
225 } else { |
210 } else { |
251 } |
236 } |
252 |
237 |
253 /* Ready current buffer for play and change current buffer */ |
238 /* Ready current buffer for play and change current buffer */ |
254 if ( stream != audio->fake_stream ) { |
239 if ( stream != audio->fake_stream ) { |
255 audio->PlayAudio(audio); |
240 audio->PlayAudio(audio); |
256 #if SDL_AUDIO_DRIVER_AHI |
241 } |
257 /* AmigaOS don't have to wait the first time audio is played! */ |
242 |
258 started++; |
243 /* Wait for an audio buffer to become available */ |
259 #endif |
244 if ( stream == audio->fake_stream ) { |
260 } |
245 SDL_Delay((audio->spec.samples*1000)/audio->spec.freq); |
261 } |
246 } else { |
|
247 audio->WaitAudio(audio); |
|
248 } |
|
249 } |
|
250 |
262 /* Wait for the audio to drain.. */ |
251 /* Wait for the audio to drain.. */ |
263 if ( audio->WaitDone ) { |
252 if ( audio->WaitDone ) { |
264 audio->WaitDone(audio); |
253 audio->WaitDone(audio); |
265 } |
254 } |
266 |
255 |