Cleaning up audio3d

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:

        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:            
        if taskMgr.hasTaskNamed("AIfor"+str(
        if taskMgr.hasTaskNamed('collFor'+str(
        if self.node:

…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

It looks like this only happens when I have loadPrcFileData(’’,‘threading-model Cull/Draw’)

An update:

This only happens in the multithreaded render pipeline

This happens with 3d audio and with normal playback.
It happens when I detach sound (very often if not always), but it also happens when I don’t detach the sound and use the same object later.
It happens with 2d sound as well, but not so often (after 5-10 minutes).

I’ve only been able to determine that this happens after I remove a monster even if removing a monster has nothing to do with sounds (well, more or less, a killed monster tells my sound class that he is dead so the sounds can be reused for another monster when/if a new monster is spawned) - I’d say it’s somewhere in the garbage collecting , so beyond my scope of know-how.

The worst thing is that it’s not happening all the time but at random, I could redesign my monsters not to be destroyed but just hidden for later use, but sooner or later I will have to add and remove objects and the game will crash :frowning:

Should I post this at the bug tracker?

Yes, and perhaps you can also try and reduce your code to the minimal test sample for us to reproduce the problem.

I’m having a hard time making a minimal sample, can’t make it crash :blush:

I don’t want to make all of my code public (at this point), but I can send it to You via email or something like that.