move SoundVolume
This commit is contained in:
@@ -240,7 +240,6 @@ PrefsManager::PrefsManager() :
|
|||||||
m_sLastSeenVideoDriver ( "LastSeenVideoDriver", "" ),
|
m_sLastSeenVideoDriver ( "LastSeenVideoDriver", "" ),
|
||||||
m_sVideoRenderers ( "VideoRenderers", "" ), // StepMania.cpp sets these on first run:
|
m_sVideoRenderers ( "VideoRenderers", "" ), // StepMania.cpp sets these on first run:
|
||||||
m_bSmoothLines ( "SmoothLines", false ),
|
m_bSmoothLines ( "SmoothLines", false ),
|
||||||
m_fSoundVolume ( "SoundVolume", 1.0f ),
|
|
||||||
m_iSoundWriteAhead ( "SoundWriteAhead", 0 ),
|
m_iSoundWriteAhead ( "SoundWriteAhead", 0 ),
|
||||||
m_iSoundDevice ( "SoundDevice", "" ),
|
m_iSoundDevice ( "SoundDevice", "" ),
|
||||||
m_iSoundPreferredSampleRate ( "SoundPreferredSampleRate", 0 ),
|
m_iSoundPreferredSampleRate ( "SoundPreferredSampleRate", 0 ),
|
||||||
@@ -482,13 +481,6 @@ RString PrefsManager::GetPreferencesSection() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// wrappers
|
|
||||||
float PrefsManager::GetSoundVolume()
|
|
||||||
{
|
|
||||||
// return a resonable volume to that users of this method don't have to handle invalid values
|
|
||||||
return clamp(m_fSoundVolume.Get(),0.0f,1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
// lua start
|
// lua start
|
||||||
#include "LuaBinding.h"
|
#include "LuaBinding.h"
|
||||||
|
|
||||||
|
|||||||
@@ -216,7 +216,6 @@ public:
|
|||||||
Preference<RString> m_sLastSeenVideoDriver;
|
Preference<RString> m_sLastSeenVideoDriver;
|
||||||
Preference<RString> m_sVideoRenderers; // StepMania.cpp sets these on first run based on the card
|
Preference<RString> m_sVideoRenderers; // StepMania.cpp sets these on first run based on the card
|
||||||
Preference<bool> m_bSmoothLines;
|
Preference<bool> m_bSmoothLines;
|
||||||
Preference<float> m_fSoundVolume;
|
|
||||||
Preference<int> m_iSoundWriteAhead;
|
Preference<int> m_iSoundWriteAhead;
|
||||||
Preference<RString> m_iSoundDevice;
|
Preference<RString> m_iSoundDevice;
|
||||||
Preference<int> m_iSoundPreferredSampleRate;
|
Preference<int> m_iSoundPreferredSampleRate;
|
||||||
@@ -244,10 +243,6 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// wrappers
|
|
||||||
float GetSoundVolume();
|
|
||||||
|
|
||||||
|
|
||||||
void ReadPrefsFromIni( const IniFile &ini, const RString &sSection, bool bIsStatic );
|
void ReadPrefsFromIni( const IniFile &ini, const RString &sSection, bool bIsStatic );
|
||||||
void ReadGamePrefsFromIni( const RString &sIni );
|
void ReadGamePrefsFromIni( const RString &sIni );
|
||||||
void ReadDefaultsFromIni( const IniFile &ini, const RString &sSection );
|
void ReadDefaultsFromIni( const IniFile &ini, const RString &sSection );
|
||||||
|
|||||||
@@ -178,12 +178,12 @@ void RageSoundManager::AddLoadedSound( const RString &sPath_, RageSoundReader_Pr
|
|||||||
m_mapPreloadedSounds[sPath] = pSound->Copy();
|
m_mapPreloadedSounds[sPath] = pSound->Copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSoundManager::SetMixVolume( float fMixVol )
|
static Preference<float> g_fSoundVolume( "SoundVolume", 1.0f );
|
||||||
{
|
|
||||||
ASSERT_M( fMixVol >= 0 && fMixVol <= 1, ssprintf("%f",fMixVol) );
|
|
||||||
|
|
||||||
|
void RageSoundManager::SetMixVolume()
|
||||||
|
{
|
||||||
g_SoundManMutex.Lock(); /* lock for access to m_fMixVolume */
|
g_SoundManMutex.Lock(); /* lock for access to m_fMixVolume */
|
||||||
m_fMixVolume = fMixVol;
|
m_fMixVolume = clamp( g_fSoundVolume.Get(), 0.0f, 1.0f );
|
||||||
g_SoundManMutex.Unlock(); /* finished with m_fMixVolume */
|
g_SoundManMutex.Unlock(); /* finished with m_fMixVolume */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public:
|
|||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
float GetMixVolume() const { return m_fMixVolume; }
|
float GetMixVolume() const { return m_fMixVolume; }
|
||||||
void SetMixVolume( float fMixVol );
|
void SetMixVolume();
|
||||||
float GetVolumeOfNonCriticalSounds() const { return m_fVolumeOfNonCriticalSounds; }
|
float GetVolumeOfNonCriticalSounds() const { return m_fVolumeOfNonCriticalSounds; }
|
||||||
void SetVolumeOfNonCriticalSounds( float fVolumeOfNonCriticalSounds );
|
void SetVolumeOfNonCriticalSounds( float fVolumeOfNonCriticalSounds );
|
||||||
|
|
||||||
|
|||||||
@@ -457,11 +457,13 @@ static void SetSpeed()
|
|||||||
|
|
||||||
void ChangeVolume( float fDelta )
|
void ChangeVolume( float fDelta )
|
||||||
{
|
{
|
||||||
float fVol = PREFSMAN->m_fSoundVolume;
|
Preference<float> *pRet = Preference<float>::GetPreferenceByName("SoundVolume");
|
||||||
|
|
||||||
|
float fVol = pRet->Get();
|
||||||
fVol += fDelta;
|
fVol += fDelta;
|
||||||
CLAMP( fVol, 0.0f, 1.0f );
|
CLAMP( fVol, 0.0f, 1.0f );
|
||||||
PREFSMAN->m_fSoundVolume.Set( fVol );
|
pRet->Set( fVol );
|
||||||
SOUNDMAN->SetMixVolume( PREFSMAN->GetSoundVolume() );
|
SOUNDMAN->SetMixVolume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -725,11 +727,7 @@ class DebugLineShowMasks : public IDebugLine
|
|||||||
|
|
||||||
Preference<bool> *GetPref()
|
Preference<bool> *GetPref()
|
||||||
{
|
{
|
||||||
IPreference *pPref = IPreference::GetPreferenceByName("ShowMasks");
|
return Preference<bool>::GetPreferenceByName("ShowMasks");
|
||||||
ASSERT( pPref );
|
|
||||||
Preference<bool> *pRet = dynamic_cast<Preference<bool> *>(pPref);
|
|
||||||
ASSERT( pRet );
|
|
||||||
return pRet;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1039,13 +1037,17 @@ class DebugLinePullBackCamera : public IDebugLine
|
|||||||
class DebugLineVolumeUp : public IDebugLine
|
class DebugLineVolumeUp : public IDebugLine
|
||||||
{
|
{
|
||||||
virtual RString GetDisplayTitle() { return VOLUME_UP.GetValue(); }
|
virtual RString GetDisplayTitle() { return VOLUME_UP.GetValue(); }
|
||||||
virtual RString GetDisplayValue() { return ssprintf("%.0f%%",PREFSMAN->m_fSoundVolume.Get()*100); }
|
virtual RString GetDisplayValue() { return ssprintf("%.0f%%", GetPref()->Get()*100); }
|
||||||
virtual bool IsEnabled() { return true; }
|
virtual bool IsEnabled() { return true; }
|
||||||
virtual void DoAndMakeSystemMessage( RString &sMessageOut )
|
virtual void DoAndMakeSystemMessage( RString &sMessageOut )
|
||||||
{
|
{
|
||||||
ChangeVolume( +0.1f );
|
ChangeVolume( +0.1f );
|
||||||
IDebugLine::DoAndMakeSystemMessage( sMessageOut );
|
IDebugLine::DoAndMakeSystemMessage( sMessageOut );
|
||||||
}
|
}
|
||||||
|
Preference<float> *GetPref()
|
||||||
|
{
|
||||||
|
return Preference<float>::GetPreferenceByName("SoundVolume");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class DebugLineVolumeDown : public IDebugLine
|
class DebugLineVolumeDown : public IDebugLine
|
||||||
@@ -1057,7 +1059,11 @@ class DebugLineVolumeDown : public IDebugLine
|
|||||||
{
|
{
|
||||||
ChangeVolume( -0.1f );
|
ChangeVolume( -0.1f );
|
||||||
IDebugLine::DoAndMakeSystemMessage( sMessageOut );
|
IDebugLine::DoAndMakeSystemMessage( sMessageOut );
|
||||||
sMessageOut += " - " + ssprintf("%.0f%%",PREFSMAN->m_fSoundVolume.Get()*100);
|
sMessageOut += " - " + ssprintf("%.0f%%",GetPref()->Get()*100);
|
||||||
|
}
|
||||||
|
Preference<float> *GetPref()
|
||||||
|
{
|
||||||
|
return Preference<float>::GetPreferenceByName("SoundVolume");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
|
|
||||||
if( m_iChangeMask & OPT_APPLY_SOUND )
|
if( m_iChangeMask & OPT_APPLY_SOUND )
|
||||||
{
|
{
|
||||||
SOUNDMAN->SetMixVolume( PREFSMAN->GetSoundVolume() );
|
SOUNDMAN->SetMixVolume();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_iChangeMask & OPT_APPLY_SONG )
|
if( m_iChangeMask & OPT_APPLY_SONG )
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ static bool CheckVideoDefaultSettings();
|
|||||||
void StepMania::ResetPreferences()
|
void StepMania::ResetPreferences()
|
||||||
{
|
{
|
||||||
PREFSMAN->ResetToFactoryDefaults();
|
PREFSMAN->ResetToFactoryDefaults();
|
||||||
SOUNDMAN->SetMixVolume( PREFSMAN->GetSoundVolume() );
|
SOUNDMAN->SetMixVolume();
|
||||||
CheckVideoDefaultSettings();
|
CheckVideoDefaultSettings();
|
||||||
ApplyGraphicOptions();
|
ApplyGraphicOptions();
|
||||||
}
|
}
|
||||||
@@ -1015,7 +1015,7 @@ int main(int argc, char* argv[])
|
|||||||
LOG->Info( "Sound writeahead has been overridden to %i", PREFSMAN->m_iSoundWriteAhead.Get() );
|
LOG->Info( "Sound writeahead has been overridden to %i", PREFSMAN->m_iSoundWriteAhead.Get() );
|
||||||
SOUNDMAN = new RageSoundManager;
|
SOUNDMAN = new RageSoundManager;
|
||||||
SOUNDMAN->Init();
|
SOUNDMAN->Init();
|
||||||
SOUNDMAN->SetMixVolume( PREFSMAN->GetSoundVolume() );
|
SOUNDMAN->SetMixVolume();
|
||||||
SOUND = new GameSoundManager;
|
SOUND = new GameSoundManager;
|
||||||
BOOKKEEPER = new Bookkeeper;
|
BOOKKEEPER = new Bookkeeper;
|
||||||
LIGHTSMAN = new LightsManager;
|
LIGHTSMAN = new LightsManager;
|
||||||
|
|||||||
Reference in New Issue
Block a user