From 0e2fd55a8ab76d69c8465da6e5ae16f3ca4f9c46 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 18 Jan 2007 08:20:36 +0000 Subject: [PATCH] remove DeleteSoundWhenFinished --- stepmania/src/RageSoundManager.cpp | 37 +----------------------------- stepmania/src/RageSoundManager.h | 6 ----- 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/stepmania/src/RageSoundManager.cpp b/stepmania/src/RageSoundManager.cpp index f65c47f853..cbed26f988 100644 --- a/stepmania/src/RageSoundManager.cpp +++ b/stepmania/src/RageSoundManager.cpp @@ -57,15 +57,6 @@ void RageSoundManager::Init() RageSoundManager::~RageSoundManager() { - g_SoundManMutex.Lock(); /* lock for access to owned_sounds */ - set sounds = owned_sounds; - g_SoundManMutex.Unlock(); /* finished with owned_sounds */ - - /* Clear any sounds that we own and havn't freed yet. */ - set::iterator j = sounds.begin(); - while(j != sounds.end()) - delete *(j++); - /* Don't lock while deleting the driver (the decoder thread might deadlock). */ delete m_pDriver; } @@ -131,26 +122,7 @@ void RageSoundManager::Update() } } - /* Scan the owned_sounds list for sounds that are no longer playing, and delete them. */ - set ToDelete; - for( set::iterator it = owned_sounds.begin(); it != owned_sounds.end(); ++it ) - { - RageSound *pSound = *it; - if( pSound->IsPlaying() ) - continue; - - LOG->Trace("XXX: deleting '%s'", pSound->GetLoadedFilePath().c_str()); - - ToDelete.insert( pSound ); - } - - for( set::iterator it = ToDelete.begin(); it != ToDelete.end(); ++it ) - owned_sounds.erase( *it ); - g_SoundManMutex.Unlock(); /* finished with owned_sounds */ - - /* Be sure to release g_SoundManMutex before deleting sounds. */ - for( set::iterator it = ToDelete.begin(); it != ToDelete.end(); ++it ) - delete *it; + g_SoundManMutex.Unlock(); /* finished with m_mapPreloadedSounds */ if( m_pDriver != NULL ) m_pDriver->Update(); @@ -199,13 +171,6 @@ RageSound *RageSoundManager::PlayCopyOfSound( RageSound &snd, const RageSoundPar return pSound; } -void RageSoundManager::DeleteSoundWhenFinished( RageSound *pSound ) -{ - g_SoundManMutex.Lock(); /* lock for access to owned_sounds */ - owned_sounds.insert( pSound ); - g_SoundManMutex.Unlock(); /* finished with owned_sounds */ -} - /* If the given path is loaded, return a copy; otherwise return NULL. * It's the caller's responsibility to delete the result. */ RageSoundReader *RageSoundManager::GetLoadedSound( const RString &sPath_ ) diff --git a/stepmania/src/RageSoundManager.h b/stepmania/src/RageSoundManager.h index d763ef2bd7..0f56cab6e6 100644 --- a/stepmania/src/RageSoundManager.h +++ b/stepmania/src/RageSoundManager.h @@ -42,8 +42,6 @@ public: float GetPlayLatency() const; int GetDriverSampleRate() const; - void DeleteSoundWhenFinished( RageSound *pSound ); - RageSoundReader *GetLoadedSound( const RString &sPath ); void AddLoadedSound( const RString &sPath, RageSoundReader_Preload *pSound ); @@ -53,10 +51,6 @@ public: RageSound *PlayCopyOfSound( RageSound &snd, const RageSoundParams *params = NULL ); private: - /* Set of sounds that we've taken over (and are responsible for deleting - * when they're finished playing): */ - set owned_sounds; - map m_mapPreloadedSounds; RageSoundDriver *m_pDriver;