Key sounded files need not have an associated music file. If it doesn't, don't crash and don't add it to the sound chain.

This commit is contained in:
Steve Checkoway
2007-12-15 23:26:12 +00:00
parent 9514f31666
commit 4be117e4c3
+11 -5
View File
@@ -122,8 +122,11 @@ void AutoKeysounds::LoadTracks( const Song *pSong, RageSoundReader *&pShared, Ra
pShared = NULL;
vector<RString> vsMusicFile;
const RString sMusicPath = pSong->GetMusicPath();
if( !sMusicPath.empty() )
vsMusicFile.push_back( sMusicPath );
vsMusicFile.push_back( pSong->GetMusicPath() );
FOREACH_ENUM( InstrumentTrack, it )
{
if( it == InstrumentTrack_Guitar )
@@ -150,7 +153,7 @@ void AutoKeysounds::LoadTracks( const Song *pSong, RageSoundReader *&pShared, Ra
pSongReader = new RageSoundReader_ThreadedBuffer( pSongReader );
pShared = pSongReader;
}
else
else if( !vpSounds.empty() )
{
RageSoundReader_Merge *pMerge = new RageSoundReader_Merge;
@@ -261,10 +264,12 @@ void AutoKeysounds::FinishLoading()
if( pChain->GetNumSounds() > 0 )
{
int iIndex = pChain->LoadSound( m_pSharedSound );
pChain->AddSound( iIndex, 0.0f, 0 );
if( m_pSharedSound )
{
int iIndex = pChain->LoadSound( m_pSharedSound );
pChain->AddSound( iIndex, 0.0f, 0 );
}
pChain->Finish();
m_pSharedSound = pChain;
}
else
@@ -272,6 +277,7 @@ void AutoKeysounds::FinishLoading()
delete pChain;
}
}
ASSERT( m_pSharedSound );
m_pSharedSound = new RageSoundReader_PitchChange( m_pSharedSound );
m_pSharedSound = new RageSoundReader_PostBuffering( m_pSharedSound );