Fixed: #875 Add possibility to change default audio driver

hg/feature/sound
kervala 15 years ago
parent 307208ccb6
commit a61aa6616b

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

@ -49,7 +49,7 @@ using std::string;
struct CClientConfig
{
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 };
// the config file must be always be available

@ -464,6 +464,12 @@ void CSoundManager::init(IProgressCallback *progressCallBack)
UAudioMixer::TDriver driverType= UAudioMixer::DriverAuto;
if(ClientCfg.DriverSound==CClientConfig::SoundDrvFMod)
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);
/* int nbVoice = _AudioMixer->getPolyphony();
_AudioMixer->setPriorityReserve(HighPri, max(1, nbVoice /2));

Loading…
Cancel
Save