don't throw on failed sound load

This commit is contained in:
Glenn Maynard
2004-06-17 01:22:47 +00:00
parent c809d31d35
commit 85fb6e85d2
+17 -1
View File
@@ -149,6 +149,18 @@ void RageSound::Fail(CString reason)
error = reason;
}
class RageSoundReader_Silence: public SoundReader
{
public:
int GetLength() const { return 0; }
int GetLength_Fast() const { return 0; }
int SetPosition_Accurate(int ms) { return 0; }
int SetPosition_Fast(int ms) { return 0; }
int Read(char *buf, unsigned len) { return 0; }
int GetSampleRate() const { return 44100; }
SoundReader *Copy() const { return new RageSoundReader_Silence; }
};
bool RageSound::Load( CString sSoundFilePath, int precache )
{
@@ -168,9 +180,13 @@ bool RageSound::Load(CString sSoundFilePath, int precache)
CString error;
Sample = SoundReader_FileReader::OpenFile( m_sFilePath, error );
if( Sample == NULL )
RageException::Throw( "RageSoundManager::RageSoundManager: error opening sound '%s': '%s'",
{
LOG->Warn( "RageSoundManager::RageSoundManager: error opening sound \"%s\": %s",
m_sFilePath.c_str(), error.c_str() );
Sample = new RageSoundReader_Silence;
}
const int NeededRate = SOUNDMAN->GetDriverSampleRate( Sample->GetSampleRate() );
if( NeededRate != Sample->GetSampleRate() )
{