1
0
Fork 0

allow reinitializing the sound system by setting /sim/sound/working to false at runtime.

This commit is contained in:
ehofman 2010-04-10 09:37:22 +00:00 committed by Tim Moore
parent 89023eda69
commit 2b83ed9cbe

View file

@ -485,8 +485,8 @@ static void fgMainLoop( void ) {
// is processing the scenery (doubled the frame-rate for me) -EMH- // is processing the scenery (doubled the frame-rate for me) -EMH-
#ifdef ENABLE_AUDIO_SUPPORT #ifdef ENABLE_AUDIO_SUPPORT
static bool smgr_init = true; static bool smgr_init = true;
if (smgr_init == true) {
static SGPropertyNode *sound_working = fgGetNode("/sim/sound/working"); static SGPropertyNode *sound_working = fgGetNode("/sim/sound/working");
if (smgr_init == true) {
if (sound_working->getBoolValue() == true) { if (sound_working->getBoolValue() == true) {
fgInitSoundManager(); fgInitSoundManager();
smgr_init = false; smgr_init = false;
@ -496,6 +496,11 @@ static void fgMainLoop( void ) {
static SGSoundMgr *smgr = globals->get_soundmgr(); static SGSoundMgr *smgr = globals->get_soundmgr();
static bool smgr_enabled = true; static bool smgr_enabled = true;
if (sound_working->getBoolValue() == false) { // request to reinit
smgr->reinit();
sound_working->setBoolValue(true);
}
if (smgr_enabled != sound_enabled->getBoolValue()) { if (smgr_enabled != sound_enabled->getBoolValue()) {
if (smgr_enabled == true) { // request to suspend if (smgr_enabled == true) { // request to suspend
smgr->suspend(); smgr->suspend();