Fixed: #875 Add possibility to change default audio driver

This commit is contained in:
kervala 2010-05-10 21:49:30 +02:00
parent e6aff7ac12
commit cb5ec98976
3 changed files with 11 additions and 9 deletions

View file

@ -382,9 +382,7 @@ CClientConfig::CClientConfig()
/////////// ///////////
// SOUND // // SOUND //
SoundOn = true; // Default is with sound. SoundOn = true; // Default is with sound.
// hulud patch force fmod DriverSound = SoundDrvAuto;
// DriverSound = SoundDrvAuto;
DriverSound = SoundDrvFMod;
SoundForceSoftwareBuffer = true; SoundForceSoftwareBuffer = true;
SoundOutGameMusic = "Main Menu Loop.ogg"; SoundOutGameMusic = "Main Menu Loop.ogg";
SoundSFXVolume = 1.f; SoundSFXVolume = 1.f;
@ -1119,19 +1117,17 @@ void CClientConfig::setValues()
// SoundOn // SoundOn
READ_BOOL_FV(SoundOn) READ_BOOL_FV(SoundOn)
// Sound Driver // Sound Driver
#if !FINAL_VERSION
varPtr = ClientCfg.ConfigFile.getVarPtr ("DriverSound"); varPtr = ClientCfg.ConfigFile.getVarPtr ("DriverSound");
if (varPtr) if (varPtr)
{ {
/* hulud patch force fmod
if (nlstricmp(varPtr->asString(), "Auto") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvAuto; if (nlstricmp(varPtr->asString(), "Auto") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvAuto;
else if (nlstricmp(varPtr->asString(), "FMod") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvFMod; else if (nlstricmp(varPtr->asString(), "FMod") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvFMod;
*/ else if (nlstricmp(varPtr->asString(), "OpenAL") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvOpenAL;
ClientCfg.DriverSound = CClientConfig::SoundDrvFMod; else if (nlstricmp(varPtr->asString(), "DirectSound") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvDirectSound;
else if (nlstricmp(varPtr->asString(), "XAudio2") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvXAudio2;
} }
else else
cfgWarning ("Default value used for 'DriverSound' !!!"); cfgWarning ("Default value used for 'DriverSound' !!!");
#endif // FINAL_VERSION
// SoundForceSoftwareBuffer // SoundForceSoftwareBuffer
READ_BOOL_FV(SoundForceSoftwareBuffer); READ_BOOL_FV(SoundForceSoftwareBuffer);
// SoundOutGameMusic // SoundOutGameMusic

View file

@ -49,7 +49,7 @@ using std::string;
struct CClientConfig struct CClientConfig
{ {
enum TDriver3D { DrvAuto = 0, OpenGL, Direct3D }; enum TDriver3D { DrvAuto = 0, OpenGL, Direct3D };
enum TDriverSound { SoundDrvAuto = 0, SoundDrvFMod }; enum TDriverSound { SoundDrvAuto = 0, SoundDrvFMod, SoundDrvOpenAL, SoundDrvDirectSound, SoundDrvXAudio2 };
enum TStageLCTUsage { StageUseNoLCT = 0, StageUseAllLCT, StageUsePosOnlyLCT }; enum TStageLCTUsage { StageUseNoLCT = 0, StageUseAllLCT, StageUsePosOnlyLCT };
// the config file must be always be available // the config file must be always be available

View file

@ -464,6 +464,12 @@ void CSoundManager::init(IProgressCallback *progressCallBack)
UAudioMixer::TDriver driverType= UAudioMixer::DriverAuto; UAudioMixer::TDriver driverType= UAudioMixer::DriverAuto;
if(ClientCfg.DriverSound==CClientConfig::SoundDrvFMod) if(ClientCfg.DriverSound==CClientConfig::SoundDrvFMod)
driverType= UAudioMixer::DriverFMod; driverType= UAudioMixer::DriverFMod;
else if(ClientCfg.DriverSound==CClientConfig::SoundDrvOpenAL)
driverType= UAudioMixer::DriverOpenAl;
else if(ClientCfg.DriverSound==CClientConfig::SoundDrvDirectSound)
driverType= UAudioMixer::DriverDSound;
else if(ClientCfg.DriverSound==CClientConfig::SoundDrvXAudio2)
driverType= UAudioMixer::DriverXAudio2;
_AudioMixer->init(ClientCfg.MaxTrack, ClientCfg.UseEax, ClientCfg.UseADPCM, progressCallBack, false, driverType, ClientCfg.SoundForceSoftwareBuffer); _AudioMixer->init(ClientCfg.MaxTrack, ClientCfg.UseEax, ClientCfg.UseADPCM, progressCallBack, false, driverType, ClientCfg.SoundForceSoftwareBuffer);
/* int nbVoice = _AudioMixer->getPolyphony(); /* int nbVoice = _AudioMixer->getPolyphony();
_AudioMixer->setPriorityReserve(HighPri, max(1, nbVoice /2)); _AudioMixer->setPriorityReserve(HighPri, max(1, nbVoice /2));