Commit 6d076cbf authored by Sam Lantinga's avatar Sam Lantinga

Fixed bug #18

Reordered the audio thread loop so there's no initial wait.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401566
parent c1d67a0d
......@@ -174,11 +174,6 @@ int SDL_RunAudio(void *audiop)
stream_len = audio->spec.size;
}
stream = audio->GetAudioBuf(audio);
if ( stream == NULL ) {
stream = audio->fake_stream;
}
#if SDL_AUDIO_DRIVER_AHI
SDL_mutexV(audio->mixer_lock);
D(bug("Entering audio loop...\n"));
......@@ -208,16 +203,6 @@ int SDL_RunAudio(void *audiop)
/* Loop, filling the audio buffers */
while ( audio->enabled ) {
/* Wait for new current buffer to finish playing */
if ( stream == audio->fake_stream ) {
SDL_Delay((audio->spec.samples*1000)/audio->spec.freq);
} else {
#if SDL_AUDIO_DRIVER_AHI
if ( started > 1 )
#endif
audio->WaitAudio(audio);
}
/* Fill the current buffer with sound */
if ( audio->convert.needed ) {
if ( audio->convert.buf ) {
......@@ -253,12 +238,16 @@ int SDL_RunAudio(void *audiop)
/* Ready current buffer for play and change current buffer */
if ( stream != audio->fake_stream ) {
audio->PlayAudio(audio);
#if SDL_AUDIO_DRIVER_AHI
/* AmigaOS don't have to wait the first time audio is played! */
started++;
#endif
}
/* Wait for an audio buffer to become available */
if ( stream == audio->fake_stream ) {
SDL_Delay((audio->spec.samples*1000)/audio->spec.freq);
} else {
audio->WaitAudio(audio);
}
}
/* Wait for the audio to drain.. */
if ( audio->WaitDone ) {
audio->WaitDone(audio);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment