attract mute -> attract volume

This commit is contained in:
Glenn Maynard
2007-05-03 04:54:49 +00:00
parent eab788bcc2
commit 3ac21022c6
5 changed files with 19 additions and 13 deletions
+2 -2
View File
@@ -350,8 +350,6 @@ void RageSound::StartPlaying()
m_bPlaying = true;
if( !m_Param.m_bIsCriticalSound && SOUNDMAN->GetPlayOnlyCriticalSounds() )
m_Param.m_Volume = 0;
ApplyParams();
/* Don't lock while calling SOUNDMAN driver calls. */
@@ -586,6 +584,8 @@ void RageSound::ApplyParams()
m_pSource->SetProperty( "FadeSeconds", m_Param.m_fFadeOutSeconds );
float fVolume = m_Param.m_Volume * SOUNDMAN->GetMixVolume();
if( !m_Param.m_bIsCriticalSound )
fVolume *= SOUNDMAN->GetVolumeOfNonCriticalSounds();
m_pSource->SetProperty( "Volume", fVolume );
switch( GetStopMode() )
+5 -5
View File
@@ -40,7 +40,7 @@ RageSoundManager *SOUNDMAN = NULL;
RageSoundManager::RageSoundManager()
{
m_fMixVolume = 1.0f;
m_bPlayOnlyCriticalSounds = false;
m_fVolumeOfNonCriticalSounds = 1.0f;
}
static LocalizedString COULDNT_FIND_SOUND_DRIVER( "RageSoundManager", "Couldn't find a sound driver that works" );
@@ -187,11 +187,11 @@ void RageSoundManager::SetMixVolume( float fMixVol )
g_SoundManMutex.Unlock(); /* finished with m_fMixVolume */
}
void RageSoundManager::SetPlayOnlyCriticalSounds( bool bPlayOnlyCriticalSounds )
void RageSoundManager::SetVolumeOfNonCriticalSounds( float fVolumeOfNonCriticalSounds )
{
g_SoundManMutex.Lock(); /* lock for access to m_bPlayOnlyCriticalSounds */
m_bPlayOnlyCriticalSounds = bPlayOnlyCriticalSounds;
g_SoundManMutex.Unlock(); /* finished with m_bPlayOnlyCriticalSounds */
g_SoundManMutex.Lock(); /* lock for access to m_fVolumeOfNonCriticalSounds */
m_fVolumeOfNonCriticalSounds = fVolumeOfNonCriticalSounds;
g_SoundManMutex.Unlock(); /* finished with m_fVolumeOfNonCriticalSounds */
}
/*
+3 -3
View File
@@ -31,8 +31,8 @@ public:
float GetMixVolume() const { return m_fMixVolume; }
void SetMixVolume( float fMixVol );
bool GetPlayOnlyCriticalSounds() const { return m_bPlayOnlyCriticalSounds; }
void SetPlayOnlyCriticalSounds( bool bPlayOnlyCriticalSounds );
float GetVolumeOfNonCriticalSounds() const { return m_fVolumeOfNonCriticalSounds; }
void SetVolumeOfNonCriticalSounds( float fVolumeOfNonCriticalSounds );
void Update();
void StartMixing( RageSoundBase *snd ); /* used by RageSound */
@@ -52,7 +52,7 @@ private:
/* Prefs: */
float m_fMixVolume;
bool m_bPlayOnlyCriticalSounds;
float m_fVolumeOfNonCriticalSounds;
};
extern RageSoundManager *SOUNDMAN;
+5 -2
View File
@@ -26,7 +26,10 @@ ScreenAttract::ScreenAttract( bool bResetGameState )
void ScreenAttract::Init()
{
SOUNDMAN->SetPlayOnlyCriticalSounds( !GAMESTATE->IsTimeToPlayAttractSounds() ); // mute attract sounds
if( GAMESTATE->IsTimeToPlayAttractSounds() )
SOUNDMAN->SetVolumeOfNonCriticalSounds( 1.0f ); // unmute attract sounds
else
SOUNDMAN->SetVolumeOfNonCriticalSounds( 0.0f ); // mute attract sounds
GAMESTATE->VisitAttractScreen( m_sName );
@@ -71,7 +74,7 @@ void ScreenAttract::AttractInput( const InputEventPlus &input, ScreenWithMenuEle
if( input.MenuI != MENU_BUTTON_COIN )
SCREENMAN->PlayCoinSound();
SOUNDMAN->SetPlayOnlyCriticalSounds( false ); // unmute attract sounds
SOUNDMAN->SetVolumeOfNonCriticalSounds( 1.0f ); // unmute attract sounds
pScreen->Cancel( SM_GoToStartScreen );
break;
default:
+4 -1
View File
@@ -19,7 +19,10 @@ REGISTER_SCREEN_CLASS( ScreenDemonstration );
ScreenDemonstration::ScreenDemonstration()
{
m_bDemonstration = true;
SOUNDMAN->SetPlayOnlyCriticalSounds( !GAMESTATE->IsTimeToPlayAttractSounds() ); // mute attract sounds
if( GAMESTATE->IsTimeToPlayAttractSounds() )
SOUNDMAN->SetVolumeOfNonCriticalSounds( 1.0f ); // unmute attract sounds
else
SOUNDMAN->SetVolumeOfNonCriticalSounds( 0.0f ); // mute attract sounds
}
void ScreenDemonstration::Init()