Calling FMOD::Sound::release from a callback


We have a utility that creates a sound, plays it and then releases it when it’s done playing. We’re using an FMOD_CHANNELCONTROL_CHANNEL callback, looking for type FMOD_CHANNELCONTROL_CALLBACK_END. When we get that callback, we’re calling release on our sound object. This seems to cause FMOD to blow up once the callback returns. If i call release on the object outside of the callback, things seem ok.

I could not find anything in the documentation that claims this is dangerous. Can someone positively confirm or deny that calling release from within the callback is a bad idea or is there something else going on here?

NOTE: update() is being called from the main thread.


Currently we would not recommend doing this, although we should at least mention that in the docs.

It does seem like something we possibly do in the future, I have raised this as a task to look into further and determine if it is possible (and something we want to do).

In the meantime we can get the docs updated.


Thanks! Your docs are better than most at answering the weird threading questions that it seems no one else ever documents…but this area seemed to slip through the cracks. :slight_smile: