Changed: #1459 Use effects group controller for ryzom client effects volume control

--HG--
branch : sound_dev
This commit is contained in:
kaetemi 2012-04-11 11:24:48 +02:00
parent 7a95fae1f9
commit 18f75a4bd0
4 changed files with 17 additions and 3 deletions

View file

@ -75,6 +75,8 @@ public:
virtual void setUserGain(float gain) { NLMISC::clamp(gain, 0.0f, 1.0f); m_UserGain = gain; updateSourceGain(); }
virtual float getUserGain() { return m_UserGain; }
virtual void setGain(float devGain, float userGain) { NLMISC::clamp(devGain, 0.0f, 1.0f); NLMISC::clamp(userGain, 0.0f, 1.0f); m_DevGain = devGain; m_UserGain = userGain; updateSourceGain(); }
//@}
inline float getFinalGain() const { return m_FinalGain; }

View file

@ -56,6 +56,8 @@ public:
virtual void setUserGain(float gain) = 0;
virtual float getUserGain() = 0;
virtual void setGain(float devGain, float userGain) = 0;
protected:
virtual ~UGroupController() { }

View file

@ -138,9 +138,11 @@ CSoundManager::~CSoundManager()
// detach the sound from the particule system
NL3D::UParticleSystemSound::setPSSound(NULL);
_GroupControllerEffects = NULL;
// free the audio mixer (and delete all sources)
if (_AudioMixer)
delete _AudioMixer;
delete _AudioMixer;
_AudioMixer = NULL;
// release sound anim properly
releaseSoundAnim();
@ -404,6 +406,8 @@ void CSoundManager::reset ()
NL3D::UParticleSystemSound::setPSSound(NULL);
_GroupControllerEffects = NULL;
delete _AudioMixer;
_AudioMixer = NULL;
@ -477,6 +481,9 @@ void CSoundManager::init(IProgressCallback *progressCallBack)
*/
new CSoundAnimManager(_AudioMixer);
// get the controller group for effects
_GroupControllerEffects = _AudioMixer->getGroupController("effects");
// restore the volume
SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume);
SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume);
@ -1536,7 +1543,7 @@ void CSoundManager::updateVolume()
_AudioMixer->setEventMusicVolume(_GameMusicVolume);
// update sfx volume
_AudioMixer->getListener()->setGain(_SFXVolume*_FadeSFXVolume);
_GroupControllerEffects->setGain(_FadeSFXVolume, _SFXVolume);
}
}

View file

@ -332,6 +332,9 @@ private:
/// Pointer on the audio mixer object
NLSOUND::UAudioMixer *_AudioMixer;
/// The root effects group controller for volume settings
NLSOUND::UGroupController *_GroupControllerEffects;
/// Pointer on the root of the environmental sounds tree (if any)
NLSOUND::UEnvSound *_EnvSoundRoot;