1
0
Fork 0

make the sound of the base model work again. this also gives an indication where things start to go wrong.

This commit is contained in:
Erik Hofman 2011-12-03 15:29:04 +01:00
parent 831f81d97c
commit 61e60484c8
2 changed files with 9 additions and 7 deletions

View file

@ -43,10 +43,12 @@ FGFX::FGFX ( SGSoundMgr *smgr, const string &refname, SGPropertyNode *props ) :
_props( props ) _props( props )
{ {
if (!props) { if (!props) {
_is_aimodel = false;
_props = globals->get_props(); _props = globals->get_props();
_enabled = fgGetNode("/sim/sound/effects/enabled", true); _enabled = fgGetNode("/sim/sound/effects/enabled", true);
_volume = fgGetNode("/sim/sound/effects/volume", true); _volume = fgGetNode("/sim/sound/effects/volume", true);
} else { } else {
_is_aimodel = true;
_enabled = _props->getNode("/sim/sound/aimodels/enabled", true); _enabled = _props->getNode("/sim/sound/aimodels/enabled", true);
_enabled->setBoolValue(fgGetBool("/sim/sound/effects/enabled")); _enabled->setBoolValue(fgGetBool("/sim/sound/effects/enabled"));
_volume = _props->getNode("/sim/sound/aimodels/volume", true); _volume = _props->getNode("/sim/sound/aimodels/volume", true);
@ -105,18 +107,17 @@ FGFX::init()
} }
node = root.getNode("fx"); node = root.getNode("fx");
if(node) { if(node && !_is_aimodel) {
for (int i = 0; i < node->nChildren(); ++i) { for (int i = 0; i < node->nChildren(); ++i) {
SGXmlSound *sound = new SGXmlSound(); SGXmlSound *soundfx = new SGXmlSound();
try { try {
// sound->init(globals->get_props(), node->getChild(i), this, soundfx->init( _props, node->getChild(i), this, _avionics,
sound->init(_props, node->getChild(i), this, path.dir() );
_avionics, path.dir()); _sound.push_back( soundfx );
_sound.push_back(sound);
} catch ( sg_exception &e ) { } catch ( sg_exception &e ) {
SG_LOG(SG_SOUND, SG_ALERT, e.getFormattedMessage()); SG_LOG(SG_SOUND, SG_ALERT, e.getFormattedMessage());
delete sound; delete soundfx;
} }
} }
} }

View file

@ -58,6 +58,7 @@ public:
private: private:
bool _is_aimodel;
SGSharedPtr<SGSampleGroup> _avionics; SGSharedPtr<SGSampleGroup> _avionics;
std::vector<SGXmlSound *> _sound; std::vector<SGXmlSound *> _sound;