#include <string.h>
#include <simgear/debug/logstream.hxx>
+#include <simgear/props/props.hxx>
#include <simgear/props/condition.hxx>
#include <simgear/math/SGMath.hxx>
#include <simgear/structure/exception.hxx>
_dt_play(0.0),
_dt_stop(0.0),
_delay(0.0),
- _stopping(0.0)
+ _stopping(0.0),
+ _initialized(false)
{
}
void
SGXmlSound::init(SGPropertyNode *root, SGPropertyNode *node,
SGSampleGroup *sgrp, SGSampleGroup *avionics,
- const string &path)
+ const SGPath& currentDir)
{
//
} else {
_sgrp = sgrp;
}
- _sample = new SGSoundSample( path.c_str(), node->getStringValue("path", ""));
+ string soundFileStr = node->getStringValue("path", "");
+ _sample = new SGSoundSample(soundFileStr.c_str(), currentDir);
if (!_sample->file_path().exists()) {
- throw sg_io_exception("XML sound: couldn't find file: " + _sample->file_path().str());
+ throw sg_io_exception("XML sound: couldn't find file: '" + soundFileStr + "'");
}
_sample->set_relative_position( offset_pos );
if (_property)
curr_value = _property->getDoubleValue();
+ if (!_initialized)
+ {
+ // update initial value before detecting changes
+ _prev_value = curr_value;
+ _initialized = true;
+ }
+
// If a condition is defined, test whether it is FALSE,
// else
// if a property is defined then test if it's value is FALSE