//
// $Id$
+#ifdef _MSC_VER
+#pragma warning (disable: 4786)
+#endif
+
#include <simgear/misc/props.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/debug/logstream.hxx>
FGFX::~FGFX ()
{
+ for (unsigned int i = 0; i < _sound.size(); i++ )
+ delete _sound[i];
}
void
FGFX::init()
{
- const SGPropertyNode * node = fgGetNode("/sim/sound", true);
+ SGPropertyNode * node = fgGetNode("/sim/sound", true);
int i;
+ string path_str = node->getStringValue("path");
SGPath path( globals->get_fg_root() );
- if (node->getStringValue("path") == "") {
- SG_LOG(SG_GENERAL, SG_ALERT, "Incorect path in configuration file.");
+ if (path_str.empty()) {
+ SG_LOG(SG_GENERAL, SG_ALERT, "Incorrect path in configuration file.");
return;
}
- path.append(node->getStringValue("path"));
+ path.append(path_str.c_str());
SG_LOG(SG_GENERAL, SG_INFO, "Reading Instrument " << node->getName()
- << " from " << path.str());
+ << " from " << path.str());
SGPropertyNode root;
try {
node = root.getNode("fx");
for (i = 0; i < node->nChildren(); i++) {
- FGSound * sound;
- sound = new FGSound(node->getChild(i));
- _sound.push_back(sound);
- }
+ FGSound *sound = new FGSound();
+ sound->init(node->getChild(i));
- for (i = 0; i < _sound.size(); i++ ) {
- _sound[i]->init();
+ _sound.push_back(sound);
}
}
}
void
-FGFX::update (int dt)
+FGFX::update (double dt)
{
- for (int i = 0; i < _sound.size(); i++ )
+ for (unsigned int i = 0; i < _sound.size(); i++ )
_sound[i]->update(dt);
}