comment, cleanup

don't reload sounds unnecessarily
This commit is contained in:
Glenn Maynard
2005-01-15 03:10:08 +00:00
parent 44d55b431a
commit 0409fe9d96
+7 -2
View File
@@ -238,11 +238,15 @@ void Player::Load( const NoteData& noteData )
// 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;
CString sSongDir = pSong->GetSongDir();
m_vKeysounds.clear();
m_vKeysounds.resize( pSong->m_vsKeysoundFile.size() );
RageSoundParams p;
@@ -251,6 +255,7 @@ void Player::Load( const NoteData& noteData )
{
CString sKeysoundFilePath = sSongDir + pSong->m_vsKeysoundFile[i];
RageSound& sound = m_vKeysounds[i];
if( sound.GetLoadedFilePath() != sKeysoundFilePath )
sound.Load( sKeysoundFilePath, true );
sound.SetParams( p );
}