comment, cleanup
don't reload sounds unnecessarily
This commit is contained in:
@@ -238,11 +238,15 @@ void Player::Load( const NoteData& noteData )
|
|||||||
// they change depending on PlayerOptions.
|
// they change depending on PlayerOptions.
|
||||||
|
|
||||||
//
|
//
|
||||||
// Load keysounds
|
// Load keysounds. If sounds are already loaded (as in the editor), don't reload them.
|
||||||
|
// XXX: the editor will load several duplicate copies (in each NoteField), and each
|
||||||
|
// player will load duplicate sounds. Does this belong somewhere else (perhaps in
|
||||||
|
// a separate object, used alongside ScreenGameplay::m_pSoundMusic and ScreenEdit::m_pSoundMusic?)
|
||||||
|
// We don't have to load separate copies to set player fade: always make a copy, and set the
|
||||||
|
// fade on the copy.
|
||||||
//
|
//
|
||||||
const Song* pSong = GAMESTATE->m_pCurSong;
|
const Song* pSong = GAMESTATE->m_pCurSong;
|
||||||
CString sSongDir = pSong->GetSongDir();
|
CString sSongDir = pSong->GetSongDir();
|
||||||
m_vKeysounds.clear();
|
|
||||||
m_vKeysounds.resize( pSong->m_vsKeysoundFile.size() );
|
m_vKeysounds.resize( pSong->m_vsKeysoundFile.size() );
|
||||||
|
|
||||||
RageSoundParams p;
|
RageSoundParams p;
|
||||||
@@ -251,6 +255,7 @@ void Player::Load( const NoteData& noteData )
|
|||||||
{
|
{
|
||||||
CString sKeysoundFilePath = sSongDir + pSong->m_vsKeysoundFile[i];
|
CString sKeysoundFilePath = sSongDir + pSong->m_vsKeysoundFile[i];
|
||||||
RageSound& sound = m_vKeysounds[i];
|
RageSound& sound = m_vKeysounds[i];
|
||||||
|
if( sound.GetLoadedFilePath() != sKeysoundFilePath )
|
||||||
sound.Load( sKeysoundFilePath, true );
|
sound.Load( sKeysoundFilePath, true );
|
||||||
sound.SetParams( p );
|
sound.SetParams( p );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user