+FGFX::update (double dt)
+{
+ SGSoundMgr *smgr = globals->get_soundmgr();
+
+ // command sound manger
+ bool pause = _pause->getBoolValue();
+ if ( pause != last_pause ) {
+ if ( pause ) {
+ smgr->pause();
+ } else {
+ smgr->resume();
+ }
+ last_pause = pause;
+ }
+
+ // process mesage queue
+ const string msgid = "Sequential Audio Message";
+ bool is_playing = false;
+ if ( smgr->exists( msgid ) ) {
+ if ( smgr->is_playing( msgid ) ) {
+ // still playing, do nothing
+ is_playing = true;
+ } else {
+ // current message finished, stop and remove
+ smgr->stop( msgid ); // removes source
+ smgr->remove( msgid ); // removes buffer
+ }
+ }
+ if ( !is_playing ) {
+ // message queue idle, add next sound if we have one
+ if ( _samplequeue.size() > 0 ) {
+ smgr->add( _samplequeue.front(), msgid );
+ _samplequeue.pop();
+ smgr->play_once( msgid );
+ }
+ }
+
+ double volume = _volume->getDoubleValue();
+ if ( volume != last_volume ) {
+ smgr->set_volume( volume );
+ last_volume = volume;
+ }
+
+ if ( !pause ) {
+ // update sound effects if not paused
+ for ( unsigned int i = 0; i < _sound.size(); i++ ) {
+ _sound[i]->update(dt);
+ }
+ }
+}
+
+/**
+ * add a sound sample to the message queue which is played sequentially
+ * in order.
+ */
+void
+FGFX::play_message( SGSoundSample *_sample )