allow sound effects in the configuration file to be added to the 'avionics' sample group by setting '<type>avionics</type>'.
This commit is contained in:
@@ -82,7 +82,8 @@ SGXmlSound::~SGXmlSound()
|
||||
|
||||
void
|
||||
SGXmlSound::init(SGPropertyNode *root, SGPropertyNode *node,
|
||||
SGSampleGroup *sgrp, const string &path)
|
||||
SGSampleGroup *sgrp, SGSampleGroup *avionics,
|
||||
const string &path)
|
||||
{
|
||||
|
||||
//
|
||||
@@ -103,6 +104,11 @@ SGXmlSound::init(SGPropertyNode *root, SGPropertyNode *node,
|
||||
_mode = SGXmlSound::ONCE;
|
||||
}
|
||||
|
||||
bool is_avionics = false;
|
||||
const char *type_str = node->getStringValue("type", "fx");
|
||||
if ( !strcmp(type_str, "avionics") )
|
||||
is_avionics = true;
|
||||
|
||||
_property = root->getNode(node->getStringValue("property", ""), true);
|
||||
SGPropertyNode *condition = node->getChild("condition");
|
||||
if (condition != NULL)
|
||||
@@ -254,7 +260,11 @@ SGXmlSound::init(SGPropertyNode *root, SGPropertyNode *node,
|
||||
//
|
||||
// Initialize the sample
|
||||
//
|
||||
_sgrp = sgrp;
|
||||
if (is_avionics) {
|
||||
_sgrp = avionics;
|
||||
} else {
|
||||
_sgrp = sgrp;
|
||||
}
|
||||
_sample = new SGSoundSample( path.c_str(), node->getStringValue("path", ""));
|
||||
_sample->set_relative_position( offset_pos );
|
||||
_sample->set_direction( dir );
|
||||
|
||||
@@ -100,10 +100,11 @@ public:
|
||||
* @param child A pointer to the location of the current event as defined
|
||||
* in the configuration file.
|
||||
* @param sgrp A pointer to a pre-initialized sample group class.
|
||||
* @param avionics A pointer to the pre-initialized avionics sample group.
|
||||
* @param path The path where the audio files remain.
|
||||
*/
|
||||
virtual void init (SGPropertyNode *, SGPropertyNode *, SGSampleGroup *,
|
||||
const string &);
|
||||
SGSampleGroup *, const string &);
|
||||
|
||||
/**
|
||||
* Check whether an event has happened and if action has to be taken.
|
||||
|
||||
Reference in New Issue
Block a user