FGFX objects must be dereferenced early enough, and sound manager must be
removed late enough - otherwise openal complains about resources being
still in use when tryin to remove buffers.
Also: do not create FGFX objects for AI/MP aircraft, when AI sound is
disabled.
pitch*speed );
_fx->set_velocity( velocity );
}
- else if (_aimodel)
+ else if ((_aimodel)&&(fgGetBool("/sim/sound/aimodels/enabled",false)))
{
string fxpath = _aimodel->get_sound_path();
if (fxpath != "")
props->setBoolValue("/sim/controls/radar/", true);
+ // drop reference to sound effects now
+ _fx = 0;
}
double FGAIBase::UpdateRadar(FGAIManager* manager) {
ai->unbind();
delete ai;
}
-
+ SGSubsystem* sound = subsystem_mgr->remove("sound");
+
subsystem_mgr->shutdown();
subsystem_mgr->unbind();
delete subsystem_mgr;
delete tacanlist;
delete carrierlist;
delete channellist;
+ delete sound;
}
void
FGAircraftModel::deinit()
{
+ // drop reference
+ _fx = 0;
+
if (!_aircraft) {
return;
}