From 52fd6986f88051ccc00fc2d01529568d79d5a56c Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 30 Dec 2015 23:11:54 -0600 Subject: [PATCH] Pull Sound-manager out of FGGlobals --- src/Instrumentation/adf.cxx | 2 +- src/Instrumentation/commradio.cxx | 8 +++++--- src/Instrumentation/kr_87.cxx | 2 +- src/Instrumentation/marker_beacon.cxx | 2 +- src/Main/fg_commands.cxx | 2 +- src/Main/fg_props.cxx | 2 +- src/Main/globals.cxx | 6 ------ src/Main/globals.hxx | 3 --- src/Sound/audioident.cxx | 2 +- src/Sound/fg_fx.cxx | 2 +- src/Sound/flitevoice.cxx | 2 +- src/Sound/voiceplayer.cxx | 2 +- 12 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/Instrumentation/adf.cxx b/src/Instrumentation/adf.cxx index 62302c92b..bb28216b4 100644 --- a/src/Instrumentation/adf.cxx +++ b/src/Instrumentation/adf.cxx @@ -113,7 +113,7 @@ ADF::init () _power_btn_node->setBoolValue(true); // front end didn't implement a power button // sound support (audible ident code) - SGSoundMgr *smgr = globals->get_soundmgr(); + SGSoundMgr *smgr = globals->get_subsystem(); _sgr = smgr->find("avionics", true); _sgr->tie_to_listener(); diff --git a/src/Instrumentation/commradio.cxx b/src/Instrumentation/commradio.cxx index 3fdd62956..102cca5f1 100644 --- a/src/Instrumentation/commradio.cxx +++ b/src/Instrumentation/commradio.cxx @@ -126,7 +126,7 @@ void AtisSpeaker::valueChanged(SGPropertyNode * node) } - FGSoundManager * smgr = dynamic_cast(globals->get_soundmgr()); + FGSoundManager * smgr = globals->get_subsystem(); assert(smgr != NULL); SG_LOG(SG_INSTR,SG_INFO,"AtisSpeaker voice is " << voice ); @@ -571,7 +571,7 @@ void CommRadioImpl::unbind() #if defined(ENABLE_FLITE) _atis.node()->removeChangeListener(&_atisSpeaker); if (_sampleGroup.valid()) { - globals->get_soundmgr()->remove(getSampleGroupRefname()); + globals->get_subsystem()->remove(getSampleGroupRefname()); } #endif _metarBridge->unbind(); @@ -617,7 +617,9 @@ void CommRadioImpl::update(double dt) // the speaker has created a new atis sample if (!_sampleGroup.valid()) { // create a sample group for our instrument on the fly - _sampleGroup = globals->get_soundmgr()->find(getSampleGroupRefname(), true); + SGSoundMgr * smgr = globals->get_subsystem(); + + _sampleGroup = smgr->find(getSampleGroupRefname(), true); _sampleGroup->tie_to_listener(); if (_addNoise) { SGSharedPtr noise = new SGSoundSample("Sounds/radionoise.wav", globals->get_fg_root()); diff --git a/src/Instrumentation/kr_87.cxx b/src/Instrumentation/kr_87.cxx index 79f45809e..4f84d821e 100644 --- a/src/Instrumentation/kr_87.cxx +++ b/src/Instrumentation/kr_87.cxx @@ -114,7 +114,7 @@ FGKR_87::~FGKR_87() { void FGKR_87::init () { - SGSoundMgr *smgr = globals->get_soundmgr(); + SGSoundMgr *smgr = globals->get_subsystem(); _sgr = smgr->find("avionics", true); _sgr->tie_to_listener(); } diff --git a/src/Instrumentation/marker_beacon.cxx b/src/Instrumentation/marker_beacon.cxx index 52b3c6778..ea9ffb9e3 100644 --- a/src/Instrumentation/marker_beacon.cxx +++ b/src/Instrumentation/marker_beacon.cxx @@ -101,7 +101,7 @@ FGMarkerBeacon::init () if (serviceable->getType() == simgear::props::NONE) serviceable->setBoolValue( true ); - SGSoundMgr *smgr = globals->get_soundmgr(); + SGSoundMgr *smgr = globals->get_subsystem(); _sgr = smgr->find("avionics", true); _sgr->tie_to_listener(); diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index 0e9dc485b..3151b2bf6 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -1070,7 +1070,7 @@ do_add_model (const SGPropertyNode * arg) static bool do_play_audio_sample (const SGPropertyNode * arg) { - SGSoundMgr *smgr = globals->get_soundmgr(); + SGSoundMgr *smgr = globals->get_subsystem(); if (!smgr) { SG_LOG(SG_GENERAL, SG_WARN, "play-audio-sample: sound-manager not running"); return false; diff --git a/src/Main/fg_props.cxx b/src/Main/fg_props.cxx index 141c3ef07..501a59592 100644 --- a/src/Main/fg_props.cxx +++ b/src/Main/fg_props.cxx @@ -231,7 +231,7 @@ setFreeze (bool f) frozen = f; // Stop sound on a pause - SGSoundMgr *smgr = globals->get_soundmgr(); + SGSoundMgr *smgr = globals->get_subsystem(); if ( smgr != NULL ) { if ( f ) { smgr->suspend(); diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index ff86ee15b..8e8a346a7 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -508,12 +508,6 @@ FGGlobals::add_subsystem (const char * name, subsystem_mgr->add(name, subsystem, type, min_time_sec); } -SGSoundMgr * -FGGlobals::get_soundmgr () const -{ - return get_subsystem(); -} - SGEventMgr * FGGlobals::get_event_mgr () const { diff --git a/src/Main/globals.hxx b/src/Main/globals.hxx index e08da9891..5c82b364a 100644 --- a/src/Main/globals.hxx +++ b/src/Main/globals.hxx @@ -53,7 +53,6 @@ class SGTime; class SGEventMgr; class SGSubsystemMgr; class SGSubsystem; -class SGSoundMgr; class FGControls; class FGTACANList; @@ -190,8 +189,6 @@ public: SGEventMgr *get_event_mgr () const; - SGSoundMgr *get_soundmgr () const; - inline double get_sim_time_sec () const { return sim_time_sec; } inline void inc_sim_time_sec (double dt) { sim_time_sec += dt; } inline void set_sim_time_sec (double t) { sim_time_sec = t; } diff --git a/src/Sound/audioident.cxx b/src/Sound/audioident.cxx index c205287f2..aa8a97ac7 100644 --- a/src/Sound/audioident.cxx +++ b/src/Sound/audioident.cxx @@ -40,7 +40,7 @@ void AudioIdent::init() _timer = 0.0; _ident = ""; _running = false; - _sgr = globals->get_soundmgr()->find("avionics", true); + _sgr = globals->get_subsystem()->find("avionics", true); _sgr->tie_to_listener(); } diff --git a/src/Sound/fg_fx.cxx b/src/Sound/fg_fx.cxx index d3a050426..3aa7a1d20 100644 --- a/src/Sound/fg_fx.cxx +++ b/src/Sound/fg_fx.cxx @@ -61,7 +61,7 @@ FGFX::FGFX ( const std::string &refname, SGPropertyNode *props ) : _avionics_ext = _props->getNode("sim/sound/avionics/external-view", true); _internal = _props->getNode("sim/current-view/internal", true); - _smgr = globals->get_soundmgr(); + _smgr = globals->get_subsystem(); if (!_smgr) { return; } diff --git a/src/Sound/flitevoice.cxx b/src/Sound/flitevoice.cxx index ee8b19795..2c98edd5a 100644 --- a/src/Sound/flitevoice.cxx +++ b/src/Sound/flitevoice.cxx @@ -43,7 +43,7 @@ FGFLITEVoice::FGFLITEVoice(FGVoiceMgr * mgr, const SGPropertyNode_ptr node, cons _synthesizer = new FLITEVoiceSynthesizer(voice.c_str()); - SGSoundMgr *smgr = globals->get_soundmgr(); + SGSoundMgr *smgr = globals->get_subsystem(); _sgr = smgr->find(sampleGroupRefName, true); _sgr->tie_to_listener(); diff --git a/src/Sound/voiceplayer.cxx b/src/Sound/voiceplayer.cxx index ab839cca6..c4ca5d2bd 100644 --- a/src/Sound/voiceplayer.cxx +++ b/src/Sound/voiceplayer.cxx @@ -208,7 +208,7 @@ FGVoicePlayer::bind (SGPropertyNode *node, const char* default_dir_prefix) void FGVoicePlayer::init () { - SGSoundMgr *smgr = globals->get_soundmgr(); + SGSoundMgr *smgr = globals->get_subsystem(); _sgr = smgr->find("avionics", true); _sgr->tie_to_listener(); speaker.update_configuration(); -- 2.39.5