From 206ce1aa0bf278ffc5c2118c5a4e6da748969c92 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 26 Oct 2004 19:10:57 +0000 Subject: [PATCH] stop going to lengths to avoid copying sounds in the BGM; copying needs to be fast, anyway --- stepmania/src/RageSoundReader_Chain.cpp | 39 ++----------------------- stepmania/src/RageSoundReader_Chain.h | 1 - 2 files changed, 2 insertions(+), 38 deletions(-) diff --git a/stepmania/src/RageSoundReader_Chain.cpp b/stepmania/src/RageSoundReader_Chain.cpp index b0b6ef2f9a..5cd3ca220e 100644 --- a/stepmania/src/RageSoundReader_Chain.cpp +++ b/stepmania/src/RageSoundReader_Chain.cpp @@ -146,15 +146,8 @@ void RageSoundReader_Chain::Finish() RageSoundReader_Preload::PreloadSound( pSound ); } - for( it = m_apLoadedSounds.begin(); it != m_apLoadedSounds.end(); ++it ) - { - SoundReader *pSound = it->second; - m_LoadedSoundIsUsed[pSound] = false; - } - /* Sort the sounds by start time. */ sort( m_Sounds.begin(), m_Sounds.end() ); - } int RageSoundReader_Chain::SetPosition_Accurate( int ms ) @@ -200,28 +193,9 @@ unsigned RageSoundReader_Chain::ActivateSound( const sound &s ) { SoundReader *pSound = m_apLoadedSounds[s.sPath]; - map::iterator it; - it = m_LoadedSoundIsUsed.find( pSound ); - ASSERT( it != m_LoadedSoundIsUsed.end() ); - ActiveSound add; add.fPan = s.fPan; - - if( !it->second ) - { - it->second = true; - add.pSound = pSound; - - /* The sound may have been used in the past; rewind it. - * We do this when starting a sound, not when finishing it, - * so we don't' waste time rewinding a sound that we won't - * be reusing. */ - pSound->SetPosition_Accurate( 0 ); - } - else - { - add.pSound = pSound->Copy(); - } + add.pSound = pSound->Copy(); m_apActiveSounds.push_back( add ); return m_apActiveSounds.size() - 1; @@ -232,16 +206,7 @@ void RageSoundReader_Chain::ReleaseSound( unsigned n ) ASSERT_M( n < m_apActiveSounds.size(), ssprintf("%u, %u", n, unsigned(m_apActiveSounds.size())) ); SoundReader *pSound = m_apActiveSounds[n].pSound; - /* If pSoundToFree is in m_apLoadedSounds, just set it unused. */ - map::iterator it; - it = m_LoadedSoundIsUsed.find( pSound ); - if( it != m_LoadedSoundIsUsed.end() ) - { - ASSERT( it->second ); - it->second = false; - } - else - delete pSound; + delete pSound; m_apActiveSounds.erase( m_apActiveSounds.begin()+n ); } diff --git a/stepmania/src/RageSoundReader_Chain.h b/stepmania/src/RageSoundReader_Chain.h index 12e801a538..20c310d597 100644 --- a/stepmania/src/RageSoundReader_Chain.h +++ b/stepmania/src/RageSoundReader_Chain.h @@ -45,7 +45,6 @@ private: unsigned m_iChannels; map m_apLoadedSounds; - map m_LoadedSoundIsUsed; struct sound {