I’ve got an end callback that stop the current sound and restart it.
When the callback is called and re-play the stereo.ogg : this crash FMOD Ex. For lot of musics, all is going well. But for few musics (especially some ogg files), this crashing FMOD Ex.
What does I am doing wrong ?
FMOD_RESULT F_CALLBACK endcallback(FMOD_CHANNEL *c, FMOD_CHANNEL_CALLBACKTYPE type, int command, unsigned int commanddata1, unsigned int commanddata2)
//Stop current sound
result = channel->stop();
result = sound->release();
//Play stereo.ogg FMOD_RESULT result = gSystem->createStream("../media/stereo.ogg", FMOD_SOFTWARE, 0, &gSound); ERRCHECK(result); result = gSound->setMode(FMOD_LOOP_OFF); ERRCHECK(result); result = gSystem->playSound(FMOD_CHANNEL_FREE, gSound, false, &gChannel); ERRCHECK(result); result = gChannel->setCallback(FMOD_CHANNEL_CALLBACKTYPE_END, &endcallback, 0); ERRCHECK(result); return FMOD_OK;
The full c++ test file can be found here [url:viaeebzb]http://jerome.jouvie.free.fr/downloads/endcallbacktest.cpp[/url:viaeebzb]
[quote="brett":1zgr08dv]the issue is that you are freeing a sound from a callback and fmod internally is still pointing to data in that sound, so move your sound release out of the callback.[/quote:1zgr08dv]
Thanks, I will try it 😀
Something remains strange, this works with the majority of musics (about 90-95%), this issue only occures with few musics (in particular, some ogg files).
Notice also that the ‘crash’ don’t occures in the callback, but at the next call of system->update (just after the callback was called).
[size=84:1zgr08dv]Note: If I remember, releasing a sound in a callback in a very old version of FMOD Ex was working fine.[/size:1zgr08dv]
Please login first to submit.