//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#pragma warning (disable: 4786)
#endif
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include <simgear/debug/logstream.hxx>
#include <simgear/structure/exception.hxx>
#ifdef __BORLANDC__
FGFX::FGFX () :
- _volume( fgGetNode("/sim/sound/volume") ),
- _pause( fgGetNode("/sim/sound/pause") ),
last_pause( true ),
- last_volume( 0.0 )
+ last_volume( 0.0 ),
+ _pause( fgGetNode("/sim/sound/pause") ),
+ _volume( fgGetNode("/sim/sound/volume") )
{
}
SGPropertyNode root;
try {
readProperties(path.str(), &root);
- } catch (const sg_exception &e) {
+ } catch (const sg_exception &) {
SG_LOG(SG_GENERAL, SG_ALERT,
"Incorrect path specified in configuration file");
return;
for (i = 0; i < node->nChildren(); i++) {
SGXmlSound *sound = new SGXmlSound();
- sound->init(globals->get_props(), node->getChild(i),
- globals->get_soundmgr(), globals->get_fg_root());
+ try {
+ sound->init(globals->get_props(), node->getChild(i),
+ globals->get_soundmgr(), globals->get_fg_root());
- _sound.push_back(sound);
+ _sound.push_back(sound);
+ } catch ( sg_io_exception &e ) {
+ SG_LOG(SG_GENERAL, SG_ALERT, e.getFormattedMessage());
+ delete sound;
+ }
}
}
// still playing, do nothing
is_playing = true;
} else {
- // current message finished, remove
- smgr->remove( msgid );
+ // current message finished, stop and remove
+ smgr->stop( msgid ); // removes source
+ smgr->remove( msgid ); // removes buffer
}
}
if ( !is_playing ) {