sound: fix sound-buffer-in-use issue
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.
This commit is contained in:
parent
9933a7cb4a
commit
07aa70dce9
3 changed files with 9 additions and 2 deletions
|
@ -228,7 +228,7 @@ void FGAIBase::update(double dt) {
|
||||||
pitch*speed );
|
pitch*speed );
|
||||||
_fx->set_velocity( velocity );
|
_fx->set_velocity( velocity );
|
||||||
}
|
}
|
||||||
else if (_aimodel)
|
else if ((_aimodel)&&(fgGetBool("/sim/sound/aimodels/enabled",false)))
|
||||||
{
|
{
|
||||||
string fxpath = _aimodel->get_sound_path();
|
string fxpath = _aimodel->get_sound_path();
|
||||||
if (fxpath != "")
|
if (fxpath != "")
|
||||||
|
@ -492,6 +492,8 @@ void FGAIBase::unbind() {
|
||||||
|
|
||||||
props->setBoolValue("/sim/controls/radar/", true);
|
props->setBoolValue("/sim/controls/radar/", true);
|
||||||
|
|
||||||
|
// drop reference to sound effects now
|
||||||
|
_fx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double FGAIBase::UpdateRadar(FGAIManager* manager) {
|
double FGAIBase::UpdateRadar(FGAIManager* manager) {
|
||||||
|
|
|
@ -171,7 +171,8 @@ FGGlobals::~FGGlobals()
|
||||||
ai->unbind();
|
ai->unbind();
|
||||||
delete ai;
|
delete ai;
|
||||||
}
|
}
|
||||||
|
SGSubsystem* sound = subsystem_mgr->remove("sound");
|
||||||
|
|
||||||
subsystem_mgr->shutdown();
|
subsystem_mgr->shutdown();
|
||||||
subsystem_mgr->unbind();
|
subsystem_mgr->unbind();
|
||||||
delete subsystem_mgr;
|
delete subsystem_mgr;
|
||||||
|
@ -205,6 +206,7 @@ FGGlobals::~FGGlobals()
|
||||||
delete tacanlist;
|
delete tacanlist;
|
||||||
delete carrierlist;
|
delete carrierlist;
|
||||||
delete channellist;
|
delete channellist;
|
||||||
|
delete sound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,9 @@ FGAircraftModel::reinit()
|
||||||
void
|
void
|
||||||
FGAircraftModel::deinit()
|
FGAircraftModel::deinit()
|
||||||
{
|
{
|
||||||
|
// drop reference
|
||||||
|
_fx = 0;
|
||||||
|
|
||||||
if (!_aircraft) {
|
if (!_aircraft) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue