From: James Turner Date: Sun, 30 Sep 2012 18:40:08 +0000 (+0100) Subject: Tolerate refactored SGSound headers. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7b8804bd409931573b62567c921a4b8d0ed3c419;p=flightgear.git Tolerate refactored SGSound headers. An upcoming commit will make the sound headers standalone, and no longer include various other headers / using std:: declarations. Prepare for this by making includes and usage of namespaces explicit. --- diff --git a/src/ATCDCL/ATC.cxx b/src/ATCDCL/ATC.cxx index 982b151bc..cf1e7c823 100644 --- a/src/ATCDCL/ATC.cxx +++ b/src/ATCDCL/ATC.cxx @@ -27,6 +27,7 @@ #include #include +#include #include #include
@@ -137,8 +138,8 @@ void FGATC::SetStation(flightgear::CommStation* sta) { // Outputs the transmission either on screen or as audio depending on user preference // The refname is a string to identify this sample to the sound manager // The repeating flag indicates whether the message should be repeated continuously or played once. -void FGATC::Render(string& msg, const float volume, - const string& refname, const bool repeating) { +void FGATC::Render(std::string& msg, const float volume, + const std::string& refname, const bool repeating) { if ((!_display) ||(volume < 0.05)) { NoRender(refname); @@ -206,7 +207,7 @@ void FGATC::Render(string& msg, const float volume, // Cease rendering a transmission. -void FGATC::NoRender(const string& refname) { +void FGATC::NoRender(const std::string& refname) { if(_playing) { if(_voice) { #ifdef ENABLE_AUDIO_SUPPORT diff --git a/src/ATCDCL/ATCVoice.cxx b/src/ATCDCL/ATCVoice.cxx index 07825f78c..14c4920e1 100644 --- a/src/ATCDCL/ATCVoice.cxx +++ b/src/ATCDCL/ATCVoice.cxx @@ -32,6 +32,8 @@ #include #include +#include + #include #include #include diff --git a/src/Instrumentation/adf.cxx b/src/Instrumentation/adf.cxx index f3a3a486a..8053545e5 100644 --- a/src/Instrumentation/adf.cxx +++ b/src/Instrumentation/adf.cxx @@ -18,7 +18,7 @@ #include "adf.hxx" #include - +#include #include #include diff --git a/src/Instrumentation/dme.cxx b/src/Instrumentation/dme.cxx index 77d711b8c..33ea69279 100644 --- a/src/Instrumentation/dme.cxx +++ b/src/Instrumentation/dme.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include
#include @@ -90,7 +91,7 @@ DME::~DME () void DME::init () { - string branch; + std::string branch; branch = "/instrumentation/" + _name; SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true ); @@ -137,7 +138,7 @@ DME::update (double delta_time_sec) // Figure out the source const char * source = _source_node->getStringValue(); if (source[0] == '\0') { - string branch; + std::string branch; branch = "/instrumentation/" + _name + "/frequencies/selected-mhz"; _source_node->setStringValue(branch.c_str()); source = _source_node->getStringValue(); diff --git a/src/Instrumentation/kr_87.cxx b/src/Instrumentation/kr_87.cxx index 0bad9615f..79f45809e 100644 --- a/src/Instrumentation/kr_87.cxx +++ b/src/Instrumentation/kr_87.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include diff --git a/src/Instrumentation/marker_beacon.cxx b/src/Instrumentation/marker_beacon.cxx index 50c85edaf..52b3c6778 100644 --- a/src/Instrumentation/marker_beacon.cxx +++ b/src/Instrumentation/marker_beacon.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include diff --git a/src/Instrumentation/mk_viii.cxx b/src/Instrumentation/mk_viii.cxx index 97eddc609..9b0ee2b48 100644 --- a/src/Instrumentation/mk_viii.cxx +++ b/src/Instrumentation/mk_viii.cxx @@ -70,6 +70,7 @@ #include #include #include +#include #include using std::string; diff --git a/src/Instrumentation/navradio.cxx b/src/Instrumentation/navradio.cxx index fa528521e..810bfeb95 100644 --- a/src/Instrumentation/navradio.cxx +++ b/src/Instrumentation/navradio.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include diff --git a/src/Instrumentation/newnavradio.cxx b/src/Instrumentation/newnavradio.cxx index 63c222ff9..bc54961d9 100644 --- a/src/Instrumentation/newnavradio.cxx +++ b/src/Instrumentation/newnavradio.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include
#include diff --git a/src/Instrumentation/tcas.cxx b/src/Instrumentation/tcas.cxx index 95a4dda5f..12047c65e 100644 --- a/src/Instrumentation/tcas.cxx +++ b/src/Instrumentation/tcas.cxx @@ -101,6 +101,7 @@ #include #include #include +#include #include using std::string; diff --git a/src/Sound/audioident.cxx b/src/Sound/audioident.cxx index 829ce9ab6..c205287f2 100644 --- a/src/Sound/audioident.cxx +++ b/src/Sound/audioident.cxx @@ -21,6 +21,7 @@ #include "audioident.hxx" #include +#include #include
#include diff --git a/src/Sound/beacon.cxx b/src/Sound/beacon.cxx index 9d7a1a184..689922932 100644 --- a/src/Sound/beacon.cxx +++ b/src/Sound/beacon.cxx @@ -24,7 +24,9 @@ #include "beacon.hxx" +#include #include +#include // constructor FGBeacon::FGBeacon() @@ -103,13 +105,13 @@ bool FGBeacon::init() { return true; } -FGBeacon * FGBeacon::_instance = NULL; - -FGBeacon * FGBeacon::instance() -{ - if( _instance == NULL ) { - _instance = new FGBeacon(); - _instance->init(); - } - return _instance; -} +FGBeacon * FGBeacon::_instance = NULL; + +FGBeacon * FGBeacon::instance() +{ + if( _instance == NULL ) { + _instance = new FGBeacon(); + _instance->init(); + } + return _instance; +} diff --git a/src/Sound/fg_fx.cxx b/src/Sound/fg_fx.cxx index b9cd492e4..be9378c73 100644 --- a/src/Sound/fg_fx.cxx +++ b/src/Sound/fg_fx.cxx @@ -39,7 +39,7 @@ #include #include -FGFX::FGFX ( SGSoundMgr *smgr, const string &refname, SGPropertyNode *props ) : +FGFX::FGFX ( SGSoundMgr *smgr, const std::string &refname, SGPropertyNode *props ) : _props( props ) { if (!props) { @@ -86,7 +86,7 @@ FGFX::init() { SGPropertyNode *node = _props->getNode("sim/sound", true); - string path_str = node->getStringValue("path"); + std::string path_str = node->getStringValue("path"); if (path_str.empty()) { SG_LOG(SG_SOUND, SG_ALERT, "No path in sim/sound/path"); return; diff --git a/src/Sound/fg_fx.hxx b/src/Sound/fg_fx.hxx index 3803f5bc6..81fac4f72 100644 --- a/src/Sound/fg_fx.hxx +++ b/src/Sound/fg_fx.hxx @@ -49,7 +49,7 @@ class FGFX : public SGSampleGroup public: - FGFX ( SGSoundMgr *smgr, const string &refname, SGPropertyNode *props = 0 ); + FGFX ( SGSoundMgr *smgr, const std::string &refname, SGPropertyNode *props = 0 ); virtual ~FGFX (); virtual void init (); diff --git a/src/Sound/morse.cxx b/src/Sound/morse.cxx index 379c15748..f4636db8b 100644 --- a/src/Sound/morse.cxx +++ b/src/Sound/morse.cxx @@ -24,6 +24,7 @@ #include "morse.hxx" +#include #include static const char DI = '1'; @@ -134,7 +135,7 @@ bool FGMorse::cust_init(const int freq ) { // make a SGSoundSample morse code transmission for the specified string -SGSoundSample *FGMorse::make_ident( const string& id, const int freq ) { +SGSoundSample *FGMorse::make_ident( const std::string& id, const int freq ) { char *idptr = (char *)id.c_str(); diff --git a/src/Sound/morse.hxx b/src/Sound/morse.hxx index c79b4782e..c5fe7cc8f 100644 --- a/src/Sound/morse.hxx +++ b/src/Sound/morse.hxx @@ -114,7 +114,7 @@ public: static FGMorse * instance(); // make a SimpleSound morse code transmission for the specified string - SGSoundSample *make_ident( const string& id, + SGSoundSample *make_ident( const std::string& id, const int freq = LO_FREQUENCY ); }; diff --git a/src/Sound/sample_queue.cxx b/src/Sound/sample_queue.cxx index fd2931ef6..ab4c213b9 100644 --- a/src/Sound/sample_queue.cxx +++ b/src/Sound/sample_queue.cxx @@ -36,7 +36,7 @@ #include #include -FGSampleQueue::FGSampleQueue ( SGSoundMgr *smgr, const string &refname ) : +FGSampleQueue::FGSampleQueue ( SGSoundMgr *smgr, const std::string &refname ) : last_enabled( true ), last_volume( 0.0 ), _enabled( fgGetNode("/sim/sound/chatter/enabled", true) ), @@ -79,7 +79,7 @@ FGSampleQueue::update (double dt) } // process message queue - const string msgid = "Sequential Audio Message"; + const std::string msgid = "Sequential Audio Message"; bool now_playing = false; if ( exists( msgid ) ) { now_playing = is_playing( msgid ); diff --git a/src/Sound/sample_queue.hxx b/src/Sound/sample_queue.hxx index 3f51104ee..ab18d7c84 100644 --- a/src/Sound/sample_queue.hxx +++ b/src/Sound/sample_queue.hxx @@ -47,7 +47,7 @@ class FGSampleQueue : public SGSampleGroup public: - FGSampleQueue ( SGSoundMgr *smgr, const string &refname ); + FGSampleQueue ( SGSoundMgr *smgr, const std::string &refname ); virtual ~FGSampleQueue (); virtual void update (double dt); diff --git a/src/Sound/voiceplayer.cxx b/src/Sound/voiceplayer.cxx index d6037106c..365be7a95 100644 --- a/src/Sound/voiceplayer.cxx +++ b/src/Sound/voiceplayer.cxx @@ -28,6 +28,8 @@ # include #endif +#include "voiceplayer.hxx" + #include #include #include @@ -38,11 +40,12 @@ #include #include +#include #include using std::string; - -#include "voiceplayer.hxx" +using std::map; +using std::vector; /////////////////////////////////////////////////////////////////////////////// // constants ////////////////////////////////////////////////////////////////// @@ -148,6 +151,12 @@ FGVoicePlayer::Voice::update () } } +FGVoicePlayer::FGVoicePlayer (PropertiesHandler* properties_handler, string _dev_name) +: volume(1.0), voice(NULL), next_voice(NULL), paused(false), +dev_name(_dev_name), dir_prefix(""), +speaker(this,properties_handler) +{} + FGVoicePlayer::~FGVoicePlayer () { vector::iterator iter1; diff --git a/src/Sound/voiceplayer.hxx b/src/Sound/voiceplayer.hxx index 35772b06b..92ed2502f 100644 --- a/src/Sound/voiceplayer.hxx +++ b/src/Sound/voiceplayer.hxx @@ -31,9 +31,6 @@ #include #include #include -using std::vector; -using std::deque; -using std::map; class SGSampleGroup; @@ -202,8 +199,8 @@ public: float volume; - vector elements; - vector::iterator iter; + std::vector elements; + std::vector::iterator iter; inline float get_volume () const { return player->volume * player->speaker.volume * volume; } }; @@ -222,14 +219,11 @@ public: Voice *voice; Voice *next_voice; bool paused; - string dev_name; - string dir_prefix; - - inline FGVoicePlayer (PropertiesHandler* properties_handler, string _dev_name) - : volume(1.0), voice(NULL), next_voice(NULL), paused(false), - dev_name(_dev_name), dir_prefix(""), - speaker(this,properties_handler) {} + std::string dev_name; + std::string dir_prefix; + FGVoicePlayer (PropertiesHandler* properties_handler, std::string _dev_name); + virtual ~FGVoicePlayer (); void init (); @@ -272,7 +266,7 @@ public: inline void tie (SGPropertyNode *node, const char *name, T *ptr) { properties_handler->tie - (node, (string("speaker/") + name).c_str(), + (node, (std::string("speaker/") + name).c_str(), RawValueMethodsData (*this, ptr, &FGVoicePlayer::Speaker::get_property, @@ -308,8 +302,8 @@ protected: SGSharedPtr _sgr; Speaker speaker; - map< string, SGSharedPtr > samples; - vector _voices; + std::map< std::string, SGSharedPtr > samples; + std::vector _voices; bool looped; bool next_looped;