1
0
Fork 0

Pull Sound-manager out of FGGlobals

This commit is contained in:
James Turner 2015-12-30 23:11:54 -06:00
parent ba56c42eb4
commit 52fd6986f8
12 changed files with 14 additions and 21 deletions

View file

@ -113,7 +113,7 @@ ADF::init ()
_power_btn_node->setBoolValue(true); // front end didn't implement a power button _power_btn_node->setBoolValue(true); // front end didn't implement a power button
// sound support (audible ident code) // sound support (audible ident code)
SGSoundMgr *smgr = globals->get_soundmgr(); SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
_sgr = smgr->find("avionics", true); _sgr = smgr->find("avionics", true);
_sgr->tie_to_listener(); _sgr->tie_to_listener();

View file

@ -126,7 +126,7 @@ void AtisSpeaker::valueChanged(SGPropertyNode * node)
} }
FGSoundManager * smgr = dynamic_cast<FGSoundManager*>(globals->get_soundmgr()); FGSoundManager * smgr = globals->get_subsystem<FGSoundManager>();
assert(smgr != NULL); assert(smgr != NULL);
SG_LOG(SG_INSTR,SG_INFO,"AtisSpeaker voice is " << voice ); SG_LOG(SG_INSTR,SG_INFO,"AtisSpeaker voice is " << voice );
@ -571,7 +571,7 @@ void CommRadioImpl::unbind()
#if defined(ENABLE_FLITE) #if defined(ENABLE_FLITE)
_atis.node()->removeChangeListener(&_atisSpeaker); _atis.node()->removeChangeListener(&_atisSpeaker);
if (_sampleGroup.valid()) { if (_sampleGroup.valid()) {
globals->get_soundmgr()->remove(getSampleGroupRefname()); globals->get_subsystem<SGSoundMgr>()->remove(getSampleGroupRefname());
} }
#endif #endif
_metarBridge->unbind(); _metarBridge->unbind();
@ -617,7 +617,9 @@ void CommRadioImpl::update(double dt)
// the speaker has created a new atis sample // the speaker has created a new atis sample
if (!_sampleGroup.valid()) { if (!_sampleGroup.valid()) {
// create a sample group for our instrument on the fly // create a sample group for our instrument on the fly
_sampleGroup = globals->get_soundmgr()->find(getSampleGroupRefname(), true); SGSoundMgr * smgr = globals->get_subsystem<SGSoundMgr>();
_sampleGroup = smgr->find(getSampleGroupRefname(), true);
_sampleGroup->tie_to_listener(); _sampleGroup->tie_to_listener();
if (_addNoise) { if (_addNoise) {
SGSharedPtr<SGSoundSample> noise = new SGSoundSample("Sounds/radionoise.wav", globals->get_fg_root()); SGSharedPtr<SGSoundSample> noise = new SGSoundSample("Sounds/radionoise.wav", globals->get_fg_root());

View file

@ -114,7 +114,7 @@ FGKR_87::~FGKR_87() {
void FGKR_87::init () { void FGKR_87::init () {
SGSoundMgr *smgr = globals->get_soundmgr(); SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
_sgr = smgr->find("avionics", true); _sgr = smgr->find("avionics", true);
_sgr->tie_to_listener(); _sgr->tie_to_listener();
} }

View file

@ -101,7 +101,7 @@ FGMarkerBeacon::init ()
if (serviceable->getType() == simgear::props::NONE) if (serviceable->getType() == simgear::props::NONE)
serviceable->setBoolValue( true ); serviceable->setBoolValue( true );
SGSoundMgr *smgr = globals->get_soundmgr(); SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
_sgr = smgr->find("avionics", true); _sgr = smgr->find("avionics", true);
_sgr->tie_to_listener(); _sgr->tie_to_listener();

View file

@ -1070,7 +1070,7 @@ do_add_model (const SGPropertyNode * arg)
static bool static bool
do_play_audio_sample (const SGPropertyNode * arg) do_play_audio_sample (const SGPropertyNode * arg)
{ {
SGSoundMgr *smgr = globals->get_soundmgr(); SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
if (!smgr) { if (!smgr) {
SG_LOG(SG_GENERAL, SG_WARN, "play-audio-sample: sound-manager not running"); SG_LOG(SG_GENERAL, SG_WARN, "play-audio-sample: sound-manager not running");
return false; return false;

View file

@ -231,7 +231,7 @@ setFreeze (bool f)
frozen = f; frozen = f;
// Stop sound on a pause // Stop sound on a pause
SGSoundMgr *smgr = globals->get_soundmgr(); SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
if ( smgr != NULL ) { if ( smgr != NULL ) {
if ( f ) { if ( f ) {
smgr->suspend(); smgr->suspend();

View file

@ -508,12 +508,6 @@ FGGlobals::add_subsystem (const char * name,
subsystem_mgr->add(name, subsystem, type, min_time_sec); subsystem_mgr->add(name, subsystem, type, min_time_sec);
} }
SGSoundMgr *
FGGlobals::get_soundmgr () const
{
return get_subsystem<SGSoundMgr>();
}
SGEventMgr * SGEventMgr *
FGGlobals::get_event_mgr () const FGGlobals::get_event_mgr () const
{ {

View file

@ -53,7 +53,6 @@ class SGTime;
class SGEventMgr; class SGEventMgr;
class SGSubsystemMgr; class SGSubsystemMgr;
class SGSubsystem; class SGSubsystem;
class SGSoundMgr;
class FGControls; class FGControls;
class FGTACANList; class FGTACANList;
@ -190,8 +189,6 @@ public:
SGEventMgr *get_event_mgr () const; SGEventMgr *get_event_mgr () const;
SGSoundMgr *get_soundmgr () const;
inline double get_sim_time_sec () const { return sim_time_sec; } 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 inc_sim_time_sec (double dt) { sim_time_sec += dt; }
inline void set_sim_time_sec (double t) { sim_time_sec = t; } inline void set_sim_time_sec (double t) { sim_time_sec = t; }

View file

@ -40,7 +40,7 @@ void AudioIdent::init()
_timer = 0.0; _timer = 0.0;
_ident = ""; _ident = "";
_running = false; _running = false;
_sgr = globals->get_soundmgr()->find("avionics", true); _sgr = globals->get_subsystem<SGSoundMgr>()->find("avionics", true);
_sgr->tie_to_listener(); _sgr->tie_to_listener();
} }

View file

@ -61,7 +61,7 @@ FGFX::FGFX ( const std::string &refname, SGPropertyNode *props ) :
_avionics_ext = _props->getNode("sim/sound/avionics/external-view", true); _avionics_ext = _props->getNode("sim/sound/avionics/external-view", true);
_internal = _props->getNode("sim/current-view/internal", true); _internal = _props->getNode("sim/current-view/internal", true);
_smgr = globals->get_soundmgr(); _smgr = globals->get_subsystem<SGSoundMgr>();
if (!_smgr) { if (!_smgr) {
return; return;
} }

View file

@ -43,7 +43,7 @@ FGFLITEVoice::FGFLITEVoice(FGVoiceMgr * mgr, const SGPropertyNode_ptr node, cons
_synthesizer = new FLITEVoiceSynthesizer(voice.c_str()); _synthesizer = new FLITEVoiceSynthesizer(voice.c_str());
SGSoundMgr *smgr = globals->get_soundmgr(); SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
_sgr = smgr->find(sampleGroupRefName, true); _sgr = smgr->find(sampleGroupRefName, true);
_sgr->tie_to_listener(); _sgr->tie_to_listener();

View file

@ -208,7 +208,7 @@ FGVoicePlayer::bind (SGPropertyNode *node, const char* default_dir_prefix)
void void
FGVoicePlayer::init () FGVoicePlayer::init ()
{ {
SGSoundMgr *smgr = globals->get_soundmgr(); SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
_sgr = smgr->find("avionics", true); _sgr = smgr->find("avionics", true);
_sgr->tie_to_listener(); _sgr->tie_to_listener();
speaker.update_configuration(); speaker.update_configuration();