From 26faea26157fd82d7b042ec437a3c6973499d270 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 4 Nov 2004 00:19:18 +0000 Subject: [PATCH] Revert. FLUSHING was defined by me, so it's not possible for me to have misconceptions about what it means. :) Probable real fix in a moment (that doesn't cause us to waste resources mixing silence). --- .../src/arch/Sound/RageSoundDriver_ALSA9.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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; }