0
0

Hi,

I was just wondering what happens when you call freeEventData on a set of wave data that is still playing (and what best way to handle this is error condition)?
I was tracking an issue with ‘invalid handle’ error, when attempting to stop a sound. As it happens the sound data was unloaded with freeEventData, just before I called stop on the event. I thought maybe not having called EventSystem::update() meant the stop notification wasn’t coming through on the sound event, but it seems even if I call this, the sound gets no notification (from Event::setCallback) to indicate its handle has been invalidated..

Is this behaviour intended? I foresee many cases where a programmer may accidentally hold onto a sound, where the data is then unloaded – and in most cases will be confused at first as to the problem. Of course the answer is make sure all sounds are stopped before unloading them, but that doesn’t help catch/track down bugs – is there a way to test if sound data is in use before calling freeEventData? Anything that can log an error on freeEventData (complaining some data is still in use) would be great.

Cheers,
Jade.

  • You must to post comments
0
0

Hi,
When calling freeEventData, it will recursively stop all events under that event group.

Logging warnings on freevent data if events are still playing would be a good idea, we can put that into our next release.

  • You must to post comments
0
0

Thanks Brett – so if I create an event, then hook up it’s callback

[code:37lzyhap]
m_event->setCallback(SoundInstanceFMOD::SoundEventCallback, this);
[/code:37lzyhap]

Then call freeEventData, with an extra update() thrown in (just in case required to post callback notifications) –

[code:37lzyhap]
m_eventGroup->freeEventData(NULL); // FMOD::EventGroup
m_eventSystem->update(); // FMOD::EventSystem
[/code:37lzyhap]

I don’t seem to be getting any ‘SoundEventCallback’ notifications on the event playing (that is part of the EventGroup we unloaded) – should these be coming through? In this situation it’s a streaming sample (haven’t tested if there is a difference for instantaneous sounds).

  • You must to post comments
0
0

Thanks Jade, this has been fixed.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.