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:
@@ -122,8 +122,11 @@ void AutoKeysounds::LoadTracks( const Song *pSong, RageSoundReader *&pShared, Ra
|
|||||||
pShared = NULL;
|
pShared = NULL;
|
||||||
|
|
||||||
vector<RString> vsMusicFile;
|
vector<RString> vsMusicFile;
|
||||||
|
const RString sMusicPath = pSong->GetMusicPath();
|
||||||
|
|
||||||
|
if( !sMusicPath.empty() )
|
||||||
|
vsMusicFile.push_back( sMusicPath );
|
||||||
|
|
||||||
vsMusicFile.push_back( pSong->GetMusicPath() );
|
|
||||||
FOREACH_ENUM( InstrumentTrack, it )
|
FOREACH_ENUM( InstrumentTrack, it )
|
||||||
{
|
{
|
||||||
if( it == InstrumentTrack_Guitar )
|
if( it == InstrumentTrack_Guitar )
|
||||||
@@ -150,7 +153,7 @@ void AutoKeysounds::LoadTracks( const Song *pSong, RageSoundReader *&pShared, Ra
|
|||||||
pSongReader = new RageSoundReader_ThreadedBuffer( pSongReader );
|
pSongReader = new RageSoundReader_ThreadedBuffer( pSongReader );
|
||||||
pShared = pSongReader;
|
pShared = pSongReader;
|
||||||
}
|
}
|
||||||
else
|
else if( !vpSounds.empty() )
|
||||||
{
|
{
|
||||||
RageSoundReader_Merge *pMerge = new RageSoundReader_Merge;
|
RageSoundReader_Merge *pMerge = new RageSoundReader_Merge;
|
||||||
|
|
||||||
@@ -260,11 +263,13 @@ void AutoKeysounds::FinishLoading()
|
|||||||
LoadAutoplaySoundsInto( pChain );
|
LoadAutoplaySoundsInto( pChain );
|
||||||
|
|
||||||
if( pChain->GetNumSounds() > 0 )
|
if( pChain->GetNumSounds() > 0 )
|
||||||
|
{
|
||||||
|
if( m_pSharedSound )
|
||||||
{
|
{
|
||||||
int iIndex = pChain->LoadSound( m_pSharedSound );
|
int iIndex = pChain->LoadSound( m_pSharedSound );
|
||||||
pChain->AddSound( iIndex, 0.0f, 0 );
|
pChain->AddSound( iIndex, 0.0f, 0 );
|
||||||
|
}
|
||||||
pChain->Finish();
|
pChain->Finish();
|
||||||
|
|
||||||
m_pSharedSound = pChain;
|
m_pSharedSound = pChain;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -272,6 +277,7 @@ void AutoKeysounds::FinishLoading()
|
|||||||
delete pChain;
|
delete pChain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ASSERT( m_pSharedSound );
|
||||||
|
|
||||||
m_pSharedSound = new RageSoundReader_PitchChange( m_pSharedSound );
|
m_pSharedSound = new RageSoundReader_PitchChange( m_pSharedSound );
|
||||||
m_pSharedSound = new RageSoundReader_PostBuffering( m_pSharedSound );
|
m_pSharedSound = new RageSoundReader_PostBuffering( m_pSharedSound );
|
||||||
|
|||||||
Reference in New Issue
Block a user