From 59df72c4b07bb7873f39f9a7b4ce1948c52e550a Mon Sep 17 00:00:00 2001 From: ehofman Date: Mon, 9 Nov 2009 10:28:21 +0000 Subject: [PATCH] allow sound effects in the configuration file to be added to the 'avionics' sample group by setting 'avionics'. --- simgear/sound/xmlsound.cxx | 14 ++++++++++++-- simgear/sound/xmlsound.hxx | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/simgear/sound/xmlsound.cxx b/simgear/sound/xmlsound.cxx index 9ef15ca4..7fa893d8 100644 --- a/simgear/sound/xmlsound.cxx +++ b/simgear/sound/xmlsound.cxx @@ -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 ); diff --git a/simgear/sound/xmlsound.hxx b/simgear/sound/xmlsound.hxx index b5bc1f9f..141f5eef 100644 --- a/simgear/sound/xmlsound.hxx +++ b/simgear/sound/xmlsound.hxx @@ -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. -- 2.39.2