From 607a1b632044cf44f4b770035cab55986ba8d842 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 16 Jan 2003 01:04:54 +0000 Subject: [PATCH] fix up error reporting; move some stray sdl_sound stuff out of RageSound --- stepmania/src/RageSound.cpp | 14 +++----------- stepmania/src/RageSoundReader_SDL_Sound.cpp | 8 ++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/stepmania/src/RageSound.cpp b/stepmania/src/RageSound.cpp index 5c28600212..4b8c489d65 100644 --- a/stepmania/src/RageSound.cpp +++ b/stepmania/src/RageSound.cpp @@ -65,14 +65,6 @@ RageSound::RageSound() ASSERT(SOUNDMAN); LockMut(SOUNDMAN->lock); - static bool initialized = false; - if(!initialized) - { - if(!Sound_Init()) - RageException::Throw( "RageSoundManager::RageSoundManager: error initializing sound loader: %s", Sound_GetError()); - initialized = true; - } - original = this; stream.Sample = NULL; position = 0; @@ -217,7 +209,7 @@ bool RageSound::Load(CString sSoundFilePath, bool cache) if(cnt < 0) { /* XXX untested */ - Fail(Sound_GetError()); + Fail(stream.Sample->GetError()); delete NewSample; return false; } @@ -387,7 +379,7 @@ int RageSound::FillBuf(int bytes) if(cnt == -1) { /* XXX untested */ - Fail(Sound_GetError()); + Fail(stream.Sample->GetError()); /* Pretend we got data; we actually just switched to a non-streaming * buffer. */ @@ -741,7 +733,7 @@ bool RageSound::SetPositionSamples( int samples ) if(ret == -1) { /* XXX untested */ - Fail(Sound_GetError()); + Fail(stream.Sample->GetError()); return false; /* failed */ } diff --git a/stepmania/src/RageSoundReader_SDL_Sound.cpp b/stepmania/src/RageSoundReader_SDL_Sound.cpp index 874892cd42..04ce993034 100644 --- a/stepmania/src/RageSoundReader_SDL_Sound.cpp +++ b/stepmania/src/RageSoundReader_SDL_Sound.cpp @@ -23,6 +23,14 @@ const int read_block_size = 1024; bool SoundReader_SDL_Sound::Open(CString filename) { + static bool initialized = false; + if(!initialized) + { + if(!Sound_Init()) + RageException::Throw( "RageSoundManager::RageSoundManager: error initializing sound loader: %s", Sound_GetError()); + initialized = true; + } + inbuf = NULL; avail = 0;