diff --git a/stepmania/src/arch/Sound/RageSoundDriver_ALSA9.cpp b/stepmania/src/arch/Sound/RageSoundDriver_ALSA9.cpp index 9a93480d52..ad40ad117a 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_ALSA9.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_ALSA9.cpp @@ -168,7 +168,7 @@ void RageSound_ALSA9::StartMixing(RageSoundBase *snd) } /* Place the sound in SETUP, where nobody else will touch it, until we put it - * in PLAYING below. */ + * in FLUSHING or PLAYING below. */ stream_pool[i]->state = stream::SETUP; m_InactiveSoundMutex.Unlock(); @@ -186,9 +186,16 @@ void RageSound_ALSA9::StartMixing(RageSoundBase *snd) stream_pool[i]->pcm->Play(); - // Forget what was here before. Go straight to PLAYING; every sound is - // supposed to be heard in full. - stream_pool[i]->state = stream_pool[i]->PLAYING; + /* If bEOF is true, we actually finished the whole file in the prebuffering + * GetData call above, and the sound should go straight to FLUSHING. Otherwise, + * set PLAYING. */ + if( bEOF ) + { + stream_pool[i]->state = stream_pool[i]->FLUSHING; + stream_pool[i]->flush_pos = stream_pool[i]->pcm->GetPosition(); + } + else + stream_pool[i]->state = stream_pool[i]->PLAYING; } void RageSound_ALSA9::Update(float delta) @@ -203,7 +210,7 @@ void RageSound_ALSA9::Update(float delta) stream_pool[i]->snd->SoundIsFinishedPlaying(); stream_pool[i]->snd = NULL; - /* Once we do this, the sound is once again available for use; we must lock + /* Once we do this, the sound is again available for use; we must lock * m_InactiveSoundMutex to take it out of INACTIVE again. */ stream_pool[i]->state = stream_pool[i]->INACTIVE; }