From 84617d0d29138d1d127a65dfb92c25843fe5228e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 26 Mar 2004 03:38:27 +0000 Subject: [PATCH] cleanup --- stepmania/src/RageSound.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/stepmania/src/RageSound.cpp b/stepmania/src/RageSound.cpp index 320ffb19d4..99667d9860 100644 --- a/stepmania/src/RageSound.cpp +++ b/stepmania/src/RageSound.cpp @@ -386,9 +386,15 @@ bool RageSound::GetDataToPlay( int16_t *buffer, int size, int &sound_frame, int int got_frames = GetData( (char *) buffer, size ); if( !got_frames ) { - /* We're at the end of the data. If we're looping, rewind and restart. */ - if( GetStopMode() == RageSoundParams::M_LOOP ) + /* EOF. */ + switch( GetStopMode() ) { + case RageSoundParams::M_STOP: + /* Not looping. Normally, we'll just stop here. */ + return false; + + case RageSoundParams::M_LOOP: + /* Rewind and restart. */ NumRewindsThisCall++; if(NumRewindsThisCall > 3) { @@ -418,18 +424,17 @@ bool RageSound::GetDataToPlay( int16_t *buffer, int size, int &sound_frame, int /* Stop here. */ return false; } - continue; + + case RageSoundParams::M_CONTINUE: + /* Keep playing silence. */ + memset( buffer, 0, size*framesize ); + got_frames = size; + break; + + default: + ASSERT(0); } - - /* Not looping. Normally, we'll just stop here. */ - if( GetStopMode() == RageSoundParams::M_STOP ) - return false; - - /* We're out of data, but we're not going to stop, so fill in the - * rest with silence. */ - memset( buffer, 0, size*framesize ); - got_frames = size; } /* This block goes from position to position+got_frames. */