(should allow relative paths in sound XML files)
-SGSoundSample::SGSoundSample( const char *path, const char *file ) :
+SGSoundSample::SGSoundSample(const char *file, const SGPath& currentDir) :
_absolute_pos(SGVec3d::zeros()),
_relative_pos(SGVec3d::zeros()),
_direction(SGVec3d::zeros()),
_absolute_pos(SGVec3d::zeros()),
_relative_pos(SGVec3d::zeros()),
_direction(SGVec3d::zeros()),
_static_changed(true),
_is_file(true)
{
_static_changed(true),
_is_file(true)
{
- SGPath p = simgear::ResourceManager::instance()->findPath(file);
+ SGPath p = simgear::ResourceManager::instance()->findPath(file, currentDir);
- * @param path Path name to sound
* @param file File name of sound
Buffer data is freed by the sample group
*/
* @param file File name of sound
Buffer data is freed by the sample group
*/
- SGSoundSample( const char *path, const char *file );
+ SGSoundSample(const char *file, const SGPath& currentDir);
void
SGXmlSound::init(SGPropertyNode *root, SGPropertyNode *node,
SGSampleGroup *sgrp, SGSampleGroup *avionics,
void
SGXmlSound::init(SGPropertyNode *root, SGPropertyNode *node,
SGSampleGroup *sgrp, SGSampleGroup *avionics,
+ const SGPath& currentDir)
- _sample = new SGSoundSample( path.c_str(), node->getStringValue("path", ""));
+ _sample = new SGSoundSample(node->getStringValue("path", ""), currentDir);
if (!_sample->file_path().exists()) {
throw sg_io_exception("XML sound: couldn't find file: " + _sample->file_path().str());
}
if (!_sample->file_path().exists()) {
throw sg_io_exception("XML sound: couldn't find file: " + _sample->file_path().str());
}
* @param path The path where the audio files remain.
*/
virtual void init (SGPropertyNode *, SGPropertyNode *, SGSampleGroup *,
* @param path The path where the audio files remain.
*/
virtual void init (SGPropertyNode *, SGPropertyNode *, SGSampleGroup *,
- SGSampleGroup *, const string &);
+ SGSampleGroup *, const SGPath& currentDir);
/**
* Check whether an event has happened and if action has to be taken.
/**
* Check whether an event has happened and if action has to be taken.