don't throw if a song uses an unknown audio type

This commit is contained in:
Glenn Maynard
2004-04-28 01:26:32 +00:00
parent e536980db8
commit c27418fbbf
+15 -8
View File
@@ -499,19 +499,26 @@ void Song::TidyUpData()
CString error; CString error;
SoundReader *Sample = SoundReader_FileReader::OpenFile( GetMusicPath(), error ); SoundReader *Sample = SoundReader_FileReader::OpenFile( GetMusicPath(), error );
if( Sample == NULL ) if( Sample == NULL )
RageException::Throw( "Error opening sound '%s': '%s'", {
GetMusicPath().c_str(), error.c_str()); LOG->Warn( "Error opening sound \"%s\": %s", GetMusicPath().c_str(), error.c_str() );
/* Don't use this file. */
m_sMusicFile = "";
}
else
{
m_fMusicLengthSeconds = Sample->GetLength() / 1000.0f; m_fMusicLengthSeconds = Sample->GetLength() / 1000.0f;
delete Sample; delete Sample;
if(m_fMusicLengthSeconds == -1) if( m_fMusicLengthSeconds < 0 )
{ {
/* It failed; bad file or something. It's already logged a warning, /* It failed; bad file or something. It's already logged a warning. */
* so just set the file to 0 seconds. */ m_fMusicLengthSeconds = 100; // guess
m_fMusicLengthSeconds = 0; }
} else if(m_fMusicLengthSeconds == 0) { else if( m_fMusicLengthSeconds == 0 )
LOG->Warn("File %s is empty?", GetMusicPath().c_str()); {
LOG->Warn( "File %s is empty?", GetMusicPath().c_str() );
}
} }
} }
else // ! HasMusic() else // ! HasMusic()