0
0

I’m using the latest FMOD library for iPhone to try and play AAC encoded sounds (m4a files). I can create a stream and initiate playback, but when I call FMOD_Sound_GetLength(), my application crashes with a BAD_ACCESS_EXC in the FMOD library. It actually doesn’t crash on the first call to FMOD_Sound_GetLength(). The game makes 5 calls to GetLength() (calling it once per trip through the game’s main loop), but it never returns the correct value. The first two times it is called, it returns values that are way too large, and then it returns 0 for a few frames, then it crashes.

Here’s the specific code I’m calling to create sounds.
[code:2putbjvo]
FMOD_CREATESOUNDEXINFO exInfo;
memset(&exInfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
FMOD_AUDIOQUEUE_EXTRACODECDATA codecData;
codecData.codecPolicy = FMOD_AUDIOQUEUE_CODECPOLICY_HARDWAREONLY;
exInfo.extracodecdata = static_cast<void*>(&codecData);
unsigned int loadFlags = FMOD_HARDWARE | FMOD_ACCURATETIME | FMOD_NONBLOCKING;

if(FMOD_System_CreateStream(sFMODSystem, fileName, loadFlags, &amp;exInfo, sound) != FMOD_OK)
{
    return false;
}

return true;

[/code:2putbjvo]

Here’s the call to FMOD_Sound_GetLength().
[code:2putbjvo]
FMOD_Sound_GetLength(currentSound, &stageLength, FMOD_TIMEUNIT_MS);
[/code:2putbjvo]

Is there anything I’m doing here that’s wrong? I’ve run all of this code using streams created from Ogg Vorbis files, and that works fine. I know that AAC support in FMOD is very recent, so I thought maybe I’m doing something unsupported.

  • You must to post comments
0
0

Are you able to reproduce this crash with the examples we ship? I just did a quick test here and getLength works perfectly every time in my test bed.

  • You must to post comments
0
0

It turned out that I was not properly releasing a movie player before starting the music, which apparently was causing some kind of audio hardware conflict. Releasing the movie player fixed the crash issue.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.