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
This commit is contained in:
parent
c1d67a0d0c
commit
6d076cbf22
1 changed files with 8 additions and 19 deletions
|
@ -174,11 +174,6 @@ int SDL_RunAudio(void *audiop)
|
||||||
stream_len = audio->spec.size;
|
stream_len = audio->spec.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream = audio->GetAudioBuf(audio);
|
|
||||||
if ( stream == NULL ) {
|
|
||||||
stream = audio->fake_stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if SDL_AUDIO_DRIVER_AHI
|
#if SDL_AUDIO_DRIVER_AHI
|
||||||
SDL_mutexV(audio->mixer_lock);
|
SDL_mutexV(audio->mixer_lock);
|
||||||
D(bug("Entering audio loop...\n"));
|
D(bug("Entering audio loop...\n"));
|
||||||
|
@ -208,16 +203,6 @@ int SDL_RunAudio(void *audiop)
|
||||||
/* Loop, filling the audio buffers */
|
/* Loop, filling the audio buffers */
|
||||||
while ( audio->enabled ) {
|
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 */
|
/* Fill the current buffer with sound */
|
||||||
if ( audio->convert.needed ) {
|
if ( audio->convert.needed ) {
|
||||||
if ( audio->convert.buf ) {
|
if ( audio->convert.buf ) {
|
||||||
|
@ -253,12 +238,16 @@ int SDL_RunAudio(void *audiop)
|
||||||
/* Ready current buffer for play and change current buffer */
|
/* Ready current buffer for play and change current buffer */
|
||||||
if ( stream != audio->fake_stream ) {
|
if ( stream != audio->fake_stream ) {
|
||||||
audio->PlayAudio(audio);
|
audio->PlayAudio(audio);
|
||||||
#if SDL_AUDIO_DRIVER_AHI
|
}
|
||||||
/* AmigaOS don't have to wait the first time audio is played! */
|
|
||||||
started++;
|
/* Wait for an audio buffer to become available */
|
||||||
#endif
|
if ( stream == audio->fake_stream ) {
|
||||||
|
SDL_Delay((audio->spec.samples*1000)/audio->spec.freq);
|
||||||
|
} else {
|
||||||
|
audio->WaitAudio(audio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for the audio to drain.. */
|
/* Wait for the audio to drain.. */
|
||||||
if ( audio->WaitDone ) {
|
if ( audio->WaitDone ) {
|
||||||
audio->WaitDone(audio);
|
audio->WaitDone(audio);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue