fix up error reporting; move some stray sdl_sound stuff out of RageSound

This commit is contained in:
Glenn Maynard
2003-01-16 01:04:54 +00:00
parent 17cfbda874
commit 607a1b6320
2 changed files with 11 additions and 11 deletions
+3 -11
View File
@@ -65,14 +65,6 @@ RageSound::RageSound()
ASSERT(SOUNDMAN); ASSERT(SOUNDMAN);
LockMut(SOUNDMAN->lock); 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; original = this;
stream.Sample = NULL; stream.Sample = NULL;
position = 0; position = 0;
@@ -217,7 +209,7 @@ bool RageSound::Load(CString sSoundFilePath, bool cache)
if(cnt < 0) { if(cnt < 0) {
/* XXX untested */ /* XXX untested */
Fail(Sound_GetError()); Fail(stream.Sample->GetError());
delete NewSample; delete NewSample;
return false; return false;
} }
@@ -387,7 +379,7 @@ int RageSound::FillBuf(int bytes)
if(cnt == -1) if(cnt == -1)
{ {
/* XXX untested */ /* XXX untested */
Fail(Sound_GetError()); Fail(stream.Sample->GetError());
/* Pretend we got data; we actually just switched to a non-streaming /* Pretend we got data; we actually just switched to a non-streaming
* buffer. */ * buffer. */
@@ -741,7 +733,7 @@ bool RageSound::SetPositionSamples( int samples )
if(ret == -1) if(ret == -1)
{ {
/* XXX untested */ /* XXX untested */
Fail(Sound_GetError()); Fail(stream.Sample->GetError());
return false; /* failed */ return false; /* failed */
} }
@@ -23,6 +23,14 @@ const int read_block_size = 1024;
bool SoundReader_SDL_Sound::Open(CString filename) 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; inbuf = NULL;
avail = 0; avail = 0;