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:
ehofman
2009-11-09 10:28:21 +00:00
committed by Tim Moore
parent 0f39f05fa1
commit 59df72c4b0
2 changed files with 14 additions and 3 deletions

View File

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

View File

@@ -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.