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
+14 -7
View File
@@ -499,21 +499,28 @@ 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. */
m_fMusicLengthSeconds = 100; // guess
}
else if( m_fMusicLengthSeconds == 0 )
{ {
/* It failed; bad file or something. It's already logged a warning,
* so just set the file to 0 seconds. */
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()
{ {
m_fMusicLengthSeconds = 100; // guess m_fMusicLengthSeconds = 100; // guess