From 75da18955dbe148999fad86a1f733adf52a9ec93 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 18 Jan 2007 09:05:13 +0000 Subject: [PATCH] remove SOUNDMAN->PlayOnce --- stepmania/src/GameSoundManager.cpp | 14 ++++++++++++-- stepmania/src/RageSoundManager.cpp | 13 ------------- stepmania/src/RageSoundManager.h | 2 -- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/stepmania/src/GameSoundManager.cpp b/stepmania/src/GameSoundManager.cpp index 3dbd52f455..12241cf0ce 100644 --- a/stepmania/src/GameSoundManager.cpp +++ b/stepmania/src/GameSoundManager.cpp @@ -249,6 +249,16 @@ static void StartMusic( MusicToPlay &ToPlay ) g_Playing = NewMusic; } +static void DoPlayOnce( RString sPath ) +{ + /* We want this to start quickly, so don't try to prebuffer it. */ + RageSound *pSound = new RageSound; + pSound->Load( sPath, false ); + + pSound->Play(); + pSound->DeleteSelfWhenFinishedPlaying(); +} + static void DoPlayOnceFromDir( RString sPath ) { if( sPath == "" ) @@ -267,7 +277,7 @@ static void DoPlayOnceFromDir( RString sPath ) return; int index = RandomInt( arraySoundFiles.size( )); - SOUNDMAN->PlayOnce( sPath + arraySoundFiles[index] ); + DoPlayOnce( sPath + arraySoundFiles[index] ); } static bool SoundWaiting() @@ -294,7 +304,7 @@ static void StartQueuedSounds() for( unsigned i = 0; i < aSoundsToPlayOnce.size(); ++i ) if( aSoundsToPlayOnce[i] != "" ) - SOUNDMAN->PlayOnce( aSoundsToPlayOnce[i] ); + DoPlayOnce( aSoundsToPlayOnce[i] ); for( unsigned i = 0; i < aSoundsToPlayOnceFromDir.size(); ++i ) DoPlayOnceFromDir( aSoundsToPlayOnceFromDir[i] ); diff --git a/stepmania/src/RageSoundManager.cpp b/stepmania/src/RageSoundManager.cpp index 347e5f6a5a..832b4233fc 100644 --- a/stepmania/src/RageSoundManager.cpp +++ b/stepmania/src/RageSoundManager.cpp @@ -178,19 +178,6 @@ void RageSoundManager::AddLoadedSound( const RString &sPath_, RageSoundReader_Pr m_mapPreloadedSounds[sPath] = pSound->Copy(); } - -/* Don't hold the lock when we don't have to. We call this function from other - * threads, to avoid stalling the gameplay thread. */ -void RageSoundManager::PlayOnce( RString sPath ) -{ - /* We want this to start quickly, so don't try to prebuffer it. */ - RageSound *pSound = new RageSound; - pSound->Load( sPath, false ); - - pSound->Play(); - pSound->DeleteSelfWhenFinishedPlaying(); -} - void RageSoundManager::SetMixVolume( float fMixVol ) { ASSERT_M( fMixVol >= 0 && fMixVol <= 1, ssprintf("%f",fMixVol) ); diff --git a/stepmania/src/RageSoundManager.h b/stepmania/src/RageSoundManager.h index 4071d3ff90..e4a12c6436 100644 --- a/stepmania/src/RageSoundManager.h +++ b/stepmania/src/RageSoundManager.h @@ -45,8 +45,6 @@ public: RageSoundReader *GetLoadedSound( const RString &sPath ); void AddLoadedSound( const RString &sPath, RageSoundReader_Preload *pSound ); - void PlayOnce( RString sPath ); - private: map m_mapPreloadedSounds;