0
0

Hello, I am running into some strange crash when releasing .XM sounds that have been loaded with the FMOD_NONBLOCKING flag. I first observed this crash with FMODEx 4.04.30 but upgraded to 4.22.01 and it hasn’t gone away.

I’m loading my sound with the following:

[code:101rqve9]
FMOD_CREATESOUNDEXINFO exinfo;
memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);

FMOD::Sound* sound;
ERRCHECK(system->createSound(filename, FMOD_NONBLOCKING, &exinfo, &sound));
[/code:101rqve9]

Afterwards, once the sound is loaded, a call to

[code:101rqve9]
sound->release();
[/code:101rqve9]

causes my application to segfault. Whether my sound is playing at the time or not seems to make no difference.

I’ve tried various other loading flags and I crash only when using FMOD_NONBLOCKING. I do not see a crash when loading as a stream with FMOD::System::createStream(), FMOD_NONBLOCKING or not.

Most file types seem to work fine, it is only a handful, including .XM, .S3M, and .MOD, that I’ve observed this crash with. I’ve hosted up a zip of a few samples that crash me every time at http://www.chalicegames.com/FMODCrash.zip . I assume these files are not corrupt, FMOD plays, pauses, and stops them just fine, but cannot release them.

I would greatly appreciate any help with this! All glory to the FMOD :)

  • You must to post comments
0
0

it seems you are passing invalid parameters

[code:3b05wbth]
FMOD_CREATESOUNDEXINFO exinfo;
memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
[/code:3b05wbth]

you only specify the extra info when you are creating custom sounds or when you need a lot of extra control over loading. call the stream creation function like this:

[code:3b05wbth]
ERRCHECK(system->createSound(filename, FMOD_NONBLOCKING, NULL, &sound));
[/code:3b05wbth]

that should solve the problem

  • You must to post comments
0
0

Thank you for the reply, NCI. Unfortunately, I do need the exinfo struct, as I’m setting Sound userdata and providing a nonblockcallback. I tried passing NULL instead, but still saw the same crash.

An idea just struck me; I ran my crashing .XM files through the [b:1d9r77zo]playsound[/b:1d9r77zo] sample project that comes with FMOD in FMOD_NONBLOCKING mode and saw the same crash. I’m beginning to think there’s either a bug or all my files are somehow messed up!

  • You must to post comments
0
0

oh ok, iit just looked by the way the code is that you were only setting the size of the structure then just passing it. But, obviously if the examples are faulting as well, then iits likey a faulty mods or possibly a bug as you suggested.

[edit]
just another thought tho, but are you ensuring that the sound is completely loaded before releasing it? Also, do you call sound->stop() before releasing?

i was looking at the docs earlier:
[quote:2qry3xhx]
FMOD_OPENSTATE_STREAMING

Ready and playing, but not possible to release at this time without stalling the main thread.
[/quote:2qry3xhx]

i dunno, maybe fmod chokes on it.
well, i aside from that, i’m not sure. could we see the callbacks you are using and a little more code?

I also tested your mods in my media player and I have not experienced any crashes, i also use NONBLOCKING flag to open. I release the sound only after i call FMOD_Sound_Stop and after I ensure it is loaded. Perhaps it is the callback, I dont use one, i just use a while loop to check for status. Honestly, i have had bad experiences with callbacks, they tend to randomly crash for me.

  • You must to post comments
0
0

Hi nci, yes have put in a check that the sound is loaded before releasing it. I’m even stopping all channels the sound is running on before releasing it, however this too has no effect; the crash still happens even if I never play the sound.

I think the [b:13b3iq6v]playsound[/b:13b3iq6v] example is the most distilled version of this problem, since it crashes too, but without any callbacks. I’ve uploaded the main.cpp file for [b:13b3iq6v]playsound[/b:13b3iq6v] at http://www.chalicegames.com/main.cpp just for reference.

nci, can you tell me what version of FMOD your media player is using? I’d be interested to run some tests with that version to see if maybe this problem was introduced recently. Thanks again –

  • You must to post comments
0
0

i am using the latest version 4.22.1.
the release notes state a bug wsa fixed with using the nonblocking flag, so you may want to use the newest.

  • You must to post comments
0
0

The issue is that you told it to create a sample and not a stream , the non blocking flag allocated the wrong type of struct and that’s why you have a crash.

You should have just used createStream thats what it would have forced you to use if you didnt use the nonblocking flag. We might look at this special case (mod file + nonblocking + createSound instead of createStream) but for now the fix is easy.

  • You must to post comments
0
0

brett, it’s true I am trying to create a sample rather than a stream, and be notified via a callback when the sample is done loading. Are mod, xm, s3m not supposed to be opened with createSound()? This approach works fine with mp3, wav, etc, and for the most part with mod, xm, and s3m, up until it comes time to release the sound.

  • You must to post comments
0
0

If you really want it to be a sample, use FMOD_CREATESAMPLE. Note that this could allocate megabytes of memory or even fail because some xm files dont end (so you’d have to use the FMOD_ACCURATETIME flag as well)

  • You must to post comments
0
0

This seems to be working now, FMOD_CREATESAMPLE did the trick. Thanks, brett! You guys coming to GDC again this year?

  • You must to post comments
Showing 9 results
Your Answer

Please first to submit.