1
0
Fork 0

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.
This commit is contained in:
James Turner 2012-09-30 19:40:08 +01:00
parent 8608a48073
commit 7b8804bd40
20 changed files with 58 additions and 41 deletions

View file

@ -27,6 +27,7 @@
#include <iostream>
#include <simgear/sound/soundmgr_openal.hxx>
#include <simgear/sound/sample_group.hxx>
#include <simgear/structure/exception.hxx>
#include <Main/globals.hxx>
@ -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

View file

@ -32,6 +32,8 @@
#include <algorithm>
#include <simgear/sound/soundmgr_openal.hxx>
#include <simgear/sound/sample_openal.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sgstream.hxx>

View file

@ -18,7 +18,7 @@
#include "adf.hxx"
#include <Sound/morse.hxx>
#include <simgear/sound/sample_group.hxx>
#include <iostream>
#include <string>

View file

@ -11,6 +11,7 @@
#include <simgear/sg_inlines.h>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/math/sg_random.h>
#include <simgear/sound/sample_group.hxx>
#include <Main/fg_props.hxx>
#include <Navaids/navlist.hxx>
@ -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();

View file

@ -30,6 +30,7 @@
#include <simgear/math/sg_random.h>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/timing/sg_time.hxx>
#include <simgear/sound/sample_group.hxx>
#include <Navaids/navlist.hxx>

View file

@ -30,6 +30,7 @@
#include <simgear/compiler.h>
#include <simgear/math/sg_random.h>
#include <simgear/misc/sg_path.hxx>
#include <simgear/sound/sample_group.hxx>
#include <Navaids/navlist.hxx>

View file

@ -70,6 +70,7 @@
#include <simgear/math/sg_random.h>
#include <simgear/misc/sg_path.hxx>
#include <simgear/sound/soundmgr_openal.hxx>
#include <simgear/sound/sample_group.hxx>
#include <simgear/structure/exception.hxx>
using std::string;

View file

@ -34,6 +34,7 @@
#include <simgear/structure/exception.hxx>
#include <simgear/math/interpolater.hxx>
#include <simgear/misc/strutils.hxx>
#include <simgear/sound/sample_group.hxx>
#include <Navaids/navrecord.hxx>
#include <Sound/audioident.hxx>

View file

@ -33,6 +33,7 @@
#include <simgear/sg_inlines.h>
#include <simgear/props/propertyObject.hxx>
#include <simgear/misc/strutils.hxx>
#include <simgear/sound/sample_group.hxx>
#include <Main/fg_props.hxx>
#include <Navaids/navlist.hxx>

View file

@ -101,6 +101,7 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/sound/soundmgr_openal.hxx>
#include <simgear/sound/sample_group.hxx>
#include <simgear/structure/exception.hxx>
using std::string;

View file

@ -21,6 +21,7 @@
#include "audioident.hxx"
#include <simgear/sg_inlines.h>
#include <simgear/sound/sample_group.hxx>
#include <Main/globals.hxx>
#include <Sound/morse.hxx>

View file

@ -24,7 +24,9 @@
#include "beacon.hxx"
#include <simgear/sound/sample_openal.hxx>
#include <simgear/structure/exception.hxx>
#include <simgear/debug/logstream.hxx>
// 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;
}

View file

@ -39,7 +39,7 @@
#include <simgear/sound/soundmgr_openal.hxx>
#include <simgear/sound/xmlsound.hxx>
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;

View file

@ -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 ();

View file

@ -24,6 +24,7 @@
#include "morse.hxx"
#include <simgear/sound/sample_openal.hxx>
#include <cstring>
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();

View file

@ -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 );
};

View file

@ -36,7 +36,7 @@
#include <simgear/sound/soundmgr_openal.hxx>
#include <simgear/sound/sample_openal.hxx>
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 );

View file

@ -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);

View file

@ -28,6 +28,8 @@
# include <config.h>
#endif
#include "voiceplayer.hxx"
#include <stdio.h>
#include <string.h>
#include <assert.h>
@ -38,11 +40,12 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/sound/soundmgr_openal.hxx>
#include <simgear/sound/sample_group.hxx>
#include <simgear/structure/exception.hxx>
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<Voice *>::iterator iter1;

View file

@ -31,9 +31,6 @@
#include <simgear/props/props.hxx>
#include <simgear/props/tiedpropertylist.hxx>
#include <simgear/sound/sample_openal.hxx>
using std::vector;
using std::deque;
using std::map;
class SGSampleGroup;
@ -202,8 +199,8 @@ public:
float volume;
vector<Element *> elements;
vector<Element *>::iterator iter;
std::vector<Element *> elements;
std::vector<Element *>::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<FGVoicePlayer::Speaker,T,T*>
(*this, ptr,
&FGVoicePlayer::Speaker::get_property,
@ -308,8 +302,8 @@ protected:
SGSharedPtr<SGSampleGroup> _sgr;
Speaker speaker;
map< string, SGSharedPtr<SGSoundSample> > samples;
vector<Voice *> _voices;
std::map< std::string, SGSharedPtr<SGSoundSample> > samples;
std::vector<Voice *> _voices;
bool looped;
bool next_looped;