SoundDrivers into RageSoundManager
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
#include "IniFile.h"
|
#include "IniFile.h"
|
||||||
#include "RageDisplay.h"
|
#include "RageDisplay.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "arch/arch_default.h"
|
|
||||||
#include "RageFile.h"
|
#include "RageFile.h"
|
||||||
#include "ProductInfo.h"
|
#include "ProductInfo.h"
|
||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
@@ -293,7 +292,6 @@ PrefsManager::PrefsManager() :
|
|||||||
#endif
|
#endif
|
||||||
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_sSoundDrivers ( "SoundDrivers", "" ),
|
|
||||||
m_fSoundVolume ( "SoundVolume", 1.0f ),
|
m_fSoundVolume ( "SoundVolume", 1.0f ),
|
||||||
m_iSoundWriteAhead ( "SoundWriteAhead", 0 ),
|
m_iSoundWriteAhead ( "SoundWriteAhead", 0 ),
|
||||||
m_iSoundDevice ( "SoundDevice", "" ),
|
m_iSoundDevice ( "SoundDevice", "" ),
|
||||||
@@ -499,14 +497,6 @@ CString PrefsManager::GetPreferencesSection() const
|
|||||||
|
|
||||||
|
|
||||||
// wrappers
|
// wrappers
|
||||||
CString PrefsManager::GetSoundDrivers()
|
|
||||||
{
|
|
||||||
if ( m_sSoundDrivers.Get().empty() )
|
|
||||||
return (CString)DEFAULT_SOUND_DRIVER_LIST;
|
|
||||||
else
|
|
||||||
return m_sSoundDrivers;
|
|
||||||
}
|
|
||||||
|
|
||||||
float PrefsManager::GetSoundVolume()
|
float PrefsManager::GetSoundVolume()
|
||||||
{
|
{
|
||||||
// return a resonable volume to that users of this method don't have to handle invalid values
|
// return a resonable volume to that users of this method don't have to handle invalid values
|
||||||
|
|||||||
@@ -217,14 +217,10 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
Preference<CString> m_sVideoRenderers; // StepMania.cpp sets these on first run based on the card
|
Preference<CString> m_sVideoRenderers; // StepMania.cpp sets these on first run based on the card
|
||||||
Preference<bool> m_bSmoothLines;
|
Preference<bool> m_bSmoothLines;
|
||||||
private:
|
|
||||||
Preference<CString> m_sSoundDrivers; // "" == default
|
|
||||||
public:
|
|
||||||
Preference<float> m_fSoundVolume;
|
Preference<float> m_fSoundVolume;
|
||||||
Preference<int> m_iSoundWriteAhead;
|
Preference<int> m_iSoundWriteAhead;
|
||||||
Preference<CString> m_iSoundDevice;
|
Preference<CString> m_iSoundDevice;
|
||||||
Preference<int> m_iSoundPreferredSampleRate;
|
Preference<int> m_iSoundPreferredSampleRate;
|
||||||
public:
|
|
||||||
Preference<CString> m_sLightsStepsDifficulty;
|
Preference<CString> m_sLightsStepsDifficulty;
|
||||||
Preference<bool> m_bBlinkGameplayButtonLightsOnNote;
|
Preference<bool> m_bBlinkGameplayButtonLightsOnNote;
|
||||||
Preference<bool> m_bAllowUnacceleratedRenderer;
|
Preference<bool> m_bAllowUnacceleratedRenderer;
|
||||||
@@ -251,7 +247,6 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// wrappers
|
// wrappers
|
||||||
CString GetSoundDrivers();
|
|
||||||
float GetSoundVolume();
|
float GetSoundVolume();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,12 @@
|
|||||||
#include "RageSoundReader_Preload.h"
|
#include "RageSoundReader_Preload.h"
|
||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
|
#include "Preference.h"
|
||||||
|
|
||||||
#include "arch/Sound/RageSoundDriver.h"
|
#include "arch/Sound/RageSoundDriver.h"
|
||||||
|
|
||||||
#include "arch/arch.h"
|
#include "arch/arch.h"
|
||||||
|
#include "arch/arch_default.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The lock ordering requirements are:
|
* The lock ordering requirements are:
|
||||||
@@ -33,6 +35,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static RageMutex g_SoundManMutex("SoundMan");
|
static RageMutex g_SoundManMutex("SoundMan");
|
||||||
|
static Preference<CString> g_sSoundDrivers( "SoundDrivers", "" ); // "" == DEFAULT_SOUND_DRIVER_LIST
|
||||||
|
|
||||||
RageSoundManager *SOUNDMAN = NULL;
|
RageSoundManager *SOUNDMAN = NULL;
|
||||||
|
|
||||||
@@ -44,8 +47,12 @@ RageSoundManager::RageSoundManager()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static LocalizedString COULDNT_FIND_SOUND_DRIVER( "RageSoundManager", "Couldn't find a sound driver that works" );
|
static LocalizedString COULDNT_FIND_SOUND_DRIVER( "RageSoundManager", "Couldn't find a sound driver that works" );
|
||||||
void RageSoundManager::Init( CString sDrivers )
|
void RageSoundManager::Init()
|
||||||
{
|
{
|
||||||
|
CString sDrivers = g_sSoundDrivers;
|
||||||
|
if( sDrivers.empty() )
|
||||||
|
sDrivers = DEFAULT_SOUND_DRIVER_LIST;
|
||||||
|
|
||||||
m_pDriver = MakeRageSoundDriver( sDrivers );
|
m_pDriver = MakeRageSoundDriver( sDrivers );
|
||||||
if( m_pDriver == NULL )
|
if( m_pDriver == NULL )
|
||||||
RageException::Throw( COULDNT_FIND_SOUND_DRIVER.GetValue() );
|
RageException::Throw( COULDNT_FIND_SOUND_DRIVER.GetValue() );
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public:
|
|||||||
* start sounds will do nothing, and threads may be shut down. */
|
* start sounds will do nothing, and threads may be shut down. */
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
void Init( CString sDrivers );
|
void Init();
|
||||||
|
|
||||||
float GetMixVolume() const { return m_fMixVolume; }
|
float GetMixVolume() const { return m_fMixVolume; }
|
||||||
void SetMixVolume( float fMixVol );
|
void SetMixVolume( float fMixVol );
|
||||||
|
|||||||
@@ -1026,7 +1026,7 @@ int main(int argc, char* argv[])
|
|||||||
if( PREFSMAN->m_iSoundWriteAhead )
|
if( PREFSMAN->m_iSoundWriteAhead )
|
||||||
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( PREFSMAN->GetSoundDrivers() );
|
SOUNDMAN->Init();
|
||||||
SOUNDMAN->SetMixVolume( PREFSMAN->GetSoundVolume() );
|
SOUNDMAN->SetMixVolume( PREFSMAN->GetSoundVolume() );
|
||||||
SOUND = new GameSoundManager;
|
SOUND = new GameSoundManager;
|
||||||
BOOKKEEPER = new Bookkeeper;
|
BOOKKEEPER = new Bookkeeper;
|
||||||
|
|||||||
Reference in New Issue
Block a user