Changed: #1459 Use effects group controller for ryzom client effects volume control
This commit is contained in:
parent
f5df001376
commit
f4cccb233d
4 changed files with 17 additions and 3 deletions
|
@ -75,6 +75,8 @@ public:
|
||||||
|
|
||||||
virtual void setUserGain(float gain) { NLMISC::clamp(gain, 0.0f, 1.0f); m_UserGain = gain; updateSourceGain(); }
|
virtual void setUserGain(float gain) { NLMISC::clamp(gain, 0.0f, 1.0f); m_UserGain = gain; updateSourceGain(); }
|
||||||
virtual float getUserGain() { return m_UserGain; }
|
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; }
|
inline float getFinalGain() const { return m_FinalGain; }
|
||||||
|
|
|
@ -56,6 +56,8 @@ public:
|
||||||
virtual void setUserGain(float gain) = 0;
|
virtual void setUserGain(float gain) = 0;
|
||||||
virtual float getUserGain() = 0;
|
virtual float getUserGain() = 0;
|
||||||
|
|
||||||
|
virtual void setGain(float devGain, float userGain) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~UGroupController() { }
|
virtual ~UGroupController() { }
|
||||||
|
|
||||||
|
|
|
@ -138,9 +138,11 @@ CSoundManager::~CSoundManager()
|
||||||
// detach the sound from the particule system
|
// detach the sound from the particule system
|
||||||
NL3D::UParticleSystemSound::setPSSound(NULL);
|
NL3D::UParticleSystemSound::setPSSound(NULL);
|
||||||
|
|
||||||
|
_GroupControllerEffects = NULL;
|
||||||
|
|
||||||
// free the audio mixer (and delete all sources)
|
// free the audio mixer (and delete all sources)
|
||||||
if (_AudioMixer)
|
|
||||||
delete _AudioMixer;
|
delete _AudioMixer;
|
||||||
|
_AudioMixer = NULL;
|
||||||
|
|
||||||
// release sound anim properly
|
// release sound anim properly
|
||||||
releaseSoundAnim();
|
releaseSoundAnim();
|
||||||
|
@ -404,6 +406,8 @@ void CSoundManager::reset ()
|
||||||
|
|
||||||
NL3D::UParticleSystemSound::setPSSound(NULL);
|
NL3D::UParticleSystemSound::setPSSound(NULL);
|
||||||
|
|
||||||
|
_GroupControllerEffects = NULL;
|
||||||
|
|
||||||
delete _AudioMixer;
|
delete _AudioMixer;
|
||||||
_AudioMixer = NULL;
|
_AudioMixer = NULL;
|
||||||
|
|
||||||
|
@ -477,6 +481,9 @@ void CSoundManager::init(IProgressCallback *progressCallBack)
|
||||||
*/
|
*/
|
||||||
new CSoundAnimManager(_AudioMixer);
|
new CSoundAnimManager(_AudioMixer);
|
||||||
|
|
||||||
|
// get the controller group for effects
|
||||||
|
_GroupControllerEffects = _AudioMixer->getGroupController("effects");
|
||||||
|
|
||||||
// restore the volume
|
// restore the volume
|
||||||
SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume);
|
SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume);
|
||||||
SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume);
|
SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume);
|
||||||
|
@ -1536,7 +1543,7 @@ void CSoundManager::updateVolume()
|
||||||
_AudioMixer->setEventMusicVolume(_GameMusicVolume);
|
_AudioMixer->setEventMusicVolume(_GameMusicVolume);
|
||||||
|
|
||||||
// update sfx volume
|
// update sfx volume
|
||||||
_AudioMixer->getListener()->setGain(_SFXVolume*_FadeSFXVolume);
|
_GroupControllerEffects->setGain(_FadeSFXVolume, _SFXVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -332,6 +332,9 @@ private:
|
||||||
/// Pointer on the audio mixer object
|
/// Pointer on the audio mixer object
|
||||||
NLSOUND::UAudioMixer *_AudioMixer;
|
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)
|
/// Pointer on the root of the environmental sounds tree (if any)
|
||||||
NLSOUND::UEnvSound *_EnvSoundRoot;
|
NLSOUND::UEnvSound *_EnvSoundRoot;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue