1 // fg_fx.cxx -- Sound effect management class implementation
3 // Started by David Megginson, October 2001
4 // (Reuses some code from main.cxx, probably by Curtis Olson)
6 // Copyright (C) 2001 Curtis L. Olson - curt@flightgear.org
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include <simgear/misc/props.hxx>
25 #include <simgear/misc/sg_path.hxx>
26 #include <simgear/debug/logstream.hxx>
27 #include <simgear/misc/exception.hxx>
29 # define exception c_exception
32 #include <Main/fg_props.hxx>
35 #include "fg_sound.hxx"
44 for (unsigned int i = 0; i < _sound.size(); i++ )
51 const SGPropertyNode * node = fgGetNode("/sim/sound", true);
54 SGPath path( globals->get_fg_root() );
55 if (node->getStringValue("path") == "") {
56 SG_LOG(SG_GENERAL, SG_ALERT, "Incorect path in configuration file.");
60 path.append(node->getStringValue("path"));
61 SG_LOG(SG_GENERAL, SG_INFO, "Reading Instrument " << node->getName()
62 << " from " << path.str());
66 readProperties(path.str(), &root);
67 } catch (const sg_exception &e) {
68 SG_LOG(SG_GENERAL, SG_ALERT,
69 "Incorrect path specified in configuration file");
73 node = root.getNode("fx");
74 for (i = 0; i < node->nChildren(); i++) {
76 sound = new FGSound(node->getChild(i));
77 _sound.push_back(sound);
80 for (i = 0; i < (int)_sound.size(); i++ ) {
98 for (unsigned int i = 0; i < _sound.size(); i++ )
99 _sound[i]->update(dt);