int format, freq;
SGSoundMgr *smgr = (SGSoundMgr *)globals->get_subsystem("soundmgr");
void *data;
- smgr->load(full_path, &data, &format, &rawDataSize, &freq);
+ if (!smgr->load(full_path, &data, &format, &rawDataSize, &freq))
+ return false;
rawSoundData = (char*)data;
#ifdef VOICE_TEST
cout << "ATCVoice: format: " << format
#include <simgear/sound/xmlsound.hxx>
FGFX::FGFX ( SGSoundMgr *smgr, const string &refname ) :
- last_pause( true ),
+ last_pause( false ),
last_volume( 0.0 ),
_pause( fgGetNode("/sim/sound/pause") ),
_volume( fgGetNode("/sim/sound/volume") )
void
FGFX::update (double dt)
{
- // command sound manger
bool new_pause = _pause->getBoolValue();
if ( new_pause != last_pause ) {
if ( new_pause ) {
last_pause = new_pause;
}
- double volume = _volume->getDoubleValue();
- if ( volume != last_volume ) {
- set_volume( volume );
- last_volume = volume;
- }
-
if ( !new_pause ) {
+ double volume = _volume->getDoubleValue();
+ if ( volume != last_volume ) {
+ set_volume( volume );
+ last_volume = volume;
+ }
+
// update sound effects if not paused
for ( unsigned int i = 0; i < _sound.size(); i++ ) {
_sound[i]->update(dt);
}
- }
- SGSampleGroup::update(dt);
+ SGSampleGroup::update(dt);
+ }
}
// end of fg_fx.cxx
#include <simgear/sound/sample_openal.hxx>
FGSampleQueue::FGSampleQueue ( SGSoundMgr *smgr, const string &refname ) :
- last_pause( true ),
+ last_pause( false ),
last_volume( 0.0 ),
_pause( fgGetNode("/sim/sound/pause") ),
_volume( fgGetNode("/sim/sound/volume") )
void
FGSampleQueue::update (double dt)
{
+return;
// command sound manger
bool new_pause = _pause->getBoolValue();
if ( new_pause != last_pause ) {
last_pause = new_pause;
}
- double volume = _volume->getDoubleValue();
- if ( volume != last_volume ) {
- set_volume( volume );
- last_volume = volume;
- }
+ if ( !new_pause ) {
+ double volume = _volume->getDoubleValue();
+ if ( volume != last_volume ) {
+ set_volume( volume );
+ last_volume = volume;
+ }
- // process mesage queue
- const string msgid = "Sequential Audio Message";
- bool now_playing = false;
- if ( exists( msgid ) ) {
- now_playing = is_playing( msgid );
- if ( !now_playing ) {
- // current message finished, stop and remove
- stop( msgid ); // removes source
- remove( msgid ); // removes buffer
+ // process mesage queue
+ const string msgid = "Sequential Audio Message";
+ bool now_playing = false;
+ if ( exists( msgid ) ) {
+ now_playing = is_playing( msgid );
+ if ( !now_playing ) {
+ // current message finished, stop and remove
+ stop( msgid ); // removes source
+ remove( msgid ); // removes buffer
+ }
}
- }
- if ( !now_playing ) {
- // message queue idle, add next sound if we have one
- if ( _messages.size() > 0 ) {
- SGSampleGroup::add( _messages.front(), msgid );
- _messages.pop();
- play_once( msgid );
+ if ( !now_playing ) {
+ // message queue idle, add next sound if we have one
+ if ( _messages.size() > 0 ) {
+ SGSampleGroup::add( _messages.front(), msgid );
+ _messages.pop();
+ play_once( msgid );
+ }
}
- }
- SGSampleGroup::update(dt);
+ SGSampleGroup::update(dt);
+ }
}
// end of _samplequeue.cxx