- // Update the sound manager last so it can use the CPU while the GPU
- // is processing the scenery (doubled the frame-rate for me) -EMH-
-#ifdef ENABLE_AUDIO_SUPPORT
- static bool smgr_init = true;
- static SGPropertyNode *sound_working = fgGetNode("/sim/sound/working");
- if (smgr_init == true) {
- if (sound_working->getBoolValue() == true) {
- fgInitSoundManager();
- smgr_init = false;
- }
- } else {
- static SGPropertyNode *sound_enabled = fgGetNode("/sim/sound/enabled");
- static SGSoundMgr *smgr = globals->get_soundmgr();
- static bool smgr_enabled = true;
-
- if (sound_working->getBoolValue() == false) { // request to reinit
- smgr->reinit();
- smgr->resume();
- sound_working->setBoolValue(true);
- }
-
- if (smgr_enabled != sound_enabled->getBoolValue()) {
- if (smgr_enabled == true) { // request to suspend
- smgr->suspend();
- smgr_enabled = false;
- } else {
- smgr->resume();
- smgr_enabled = true;
- }
- }
-
- if (smgr_enabled == true) {
- static SGPropertyNode *volume = fgGetNode("/sim/sound/volume");
- smgr->set_volume(volume->getFloatValue());
- smgr->update(sim_dt);
- }
- }
-#endif
-