1
0
Fork 0

Fix broken sound mute function

Fixes #2146
This commit is contained in:
Lars Toenning 2020-03-13 11:13:30 +01:00
parent 3cb05a9207
commit 2c9d64dcc6
No known key found for this signature in database
GPG key ID: 2A71682E370414AF
3 changed files with 5 additions and 12 deletions

View file

@ -230,16 +230,6 @@ setFreeze (bool f)
{ {
frozen = f; frozen = f;
// Stop sound on a pause
SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
if ( smgr != NULL ) {
if ( f ) {
smgr->suspend();
} else if (fgGetBool("/sim/sound/working")) {
smgr->resume();
}
}
// Pause the particle system // Pause the particle system
simgear::Particles::setFrozen(f); simgear::Particles::setFrozen(f);
} }

View file

@ -76,6 +76,8 @@ void FGSoundManager::init()
_velocityEastFPS = fgGetNode("velocities/speed-east-fps", true); _velocityEastFPS = fgGetNode("velocities/speed-east-fps", true);
_velocityDownFPS = fgGetNode("velocities/speed-down-fps", true); _velocityDownFPS = fgGetNode("velocities/speed-down-fps", true);
_frozen = fgGetNode("sim/freeze/master");
SGPropertyNode_ptr scenery_loaded = fgGetNode("sim/sceneryloaded", true); SGPropertyNode_ptr scenery_loaded = fgGetNode("sim/sceneryloaded", true);
scenery_loaded->addChangeListener(_listener.get()); scenery_loaded->addChangeListener(_listener.get());
@ -159,9 +161,9 @@ bool FGSoundManager::stationaryView() const
// Actual sound update is triggered by the subsystem manager. // Actual sound update is triggered by the subsystem manager.
void FGSoundManager::update(double dt) void FGSoundManager::update(double dt)
{ {
if (is_active() && _is_initialized && _sound_working->getBoolValue()) if (is_working() && _is_initialized && _sound_working->getBoolValue())
{ {
bool enabled = _sound_enabled->getBoolValue(); bool enabled = _sound_enabled->getBoolValue() && !_frozen->getBoolValue();
if (enabled != _enabled) if (enabled != _enabled)
{ {
if (enabled) if (enabled)

View file

@ -63,6 +63,7 @@ private:
bool _is_initialized, _enabled; bool _is_initialized, _enabled;
SGPropertyNode_ptr _sound_working, _sound_enabled, _volume, _device_name; SGPropertyNode_ptr _sound_working, _sound_enabled, _volume, _device_name;
SGPropertyNode_ptr _velocityNorthFPS, _velocityEastFPS, _velocityDownFPS; SGPropertyNode_ptr _velocityNorthFPS, _velocityEastFPS, _velocityDownFPS;
SGPropertyNode_ptr _frozen;
std::unique_ptr<Listener> _listener; std::unique_ptr<Listener> _listener;
std::map<std::string,VoiceSynthesizer*> _synthesizers; std::map<std::string,VoiceSynthesizer*> _synthesizers;