I’m having some problems with cleaning up some audio.
I’ve got one audio manager and every ‘monster’ in my game loads sound files via this shared manager also every monster has a node of its own that I attach all the sound object to (for 3d audio).
Nothing fancy, just like this:
self.sounds={'hit':self.audio3d.loadSfx(setup_data["hit_sfx"]),
'die':self.audio3d.loadSfx(setup_data["die_sfx"])
}
for sound in self.sounds:
self.audio3d.attachSoundToObject(self.sounds[sound], self.node)
When a monster is killed I want to detach its node from the scene graph, but first I want to detach the 3d audio so it won’t blow in my face… I was thinking this would work:
def destroy(self):
for sound in self.sounds:
self.audio3d.detachSound(self.sounds[sound])
if self.actor:
self.actor.cleanup()
self.actor.removeNode()
if taskMgr.hasTaskNamed("AIfor"+str(self.id)):
taskMgr.remove("AIfor"+str(self.id))
if taskMgr.hasTaskNamed('collFor'+str(self.id)):
taskMgr.remove('collFor'+str(self.id))
if self.node:
self.node.removeNode()
self.monsterList[self.id]=None
…and it sort of work, but from time to time, the python interpreter hangs, windows claims ‘there was a problem’ and points to libpanda.dll. All I can do is close the window and I get this message in the command prompt:
AL lib: ReleaseALC: 1 device not closed
It looks like it is happening when I try to play a sound while or just after detaching the sounds.
If I use audio-library-name p3fmod_audio then there’s no message in the command prompt, but the same sort of crash appears.
So… what did I do wrong this time?
I’m running on Windows XP, Panda3D-1.8.1
EDIT:
It looks like this only happens when I have loadPrcFileData(’’,‘threading-model Cull/Draw’)