This is my first post, sorry for my English, I am French, and thanks in advance for your answers.
In my project, I have started to work with FMOD – 4.02.03.
I was used to load my sound files from a global sound file (not packed, just concatenated sound files).
This is the piece of code I am using :
FMOD_MODE fmode = FMOD_HARDWARE | FMOD_LOOP_NORMAL | FMOD_2D;
sndExInfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
sndExInfo.length = ptr->track->fSize;
sndExInfo.fileoffset = ptr->track->fOffset;
sndExInfo.numchannels = 0;
sndExInfo.defaultfrequency = 0;
sndExInfo.format = FMOD_SOUND_FORMAT_NONE;
sndExInfo.decodebuffersize = 0;
sndExInfo.initialsubsound = 0;
sndExInfo.numsubsounds = 0;
sndExInfo.inclusionlist = 0;
sndExInfo.inclusionlistnum = 0;
sndExInfo.pcmreadcallback = 0;
sndExInfo.pcmsetposcallback = 0;
sndExInfo.nonblockcallback = 0;
sndExInfo.dlsname = 0;
sndExInfo.encryptionkey = 0;
sndExInfo.maxpolyphony = 0;
sndExInfo.userdata = 0;
FMOD_RESULT fr = fmDevice.system->createStream((const TCHAR*)fmDevice.dFile, fmode , &sndExInfo, &fmsound);
// ptr->track->fSize gives the sive in byte of the "embedded" file to read
// ptr->track->fOffset gives the offset in byte of the "embedded file" within the larger file
// fmDevice.dFile is the larger file name
This piece of code was working well with FMOD 4.02.03.
Now, I have downloaded the new version of FMOD (4.38.00) and the same code (no changes) is failing, createStream returning FMOD_ERR_FORMAT.
If I switch back to FMOD 4.02.03 (just changing C++ compiler libraries links), it works again.
What has been changed in FMOD 4.38.00 which could explain the new behaviour of createStream ?
Thanks in advance for your answers.
- amarhys asked 5 years ago
You need to memset the FMOD_CREATESOUNDEXINFO structure to 0 to protect yourself from new members being added over time. There have been a lot of new members added to that struct since 4.02.xx that if uninitialized will probably cause an error.
Please login first to submit.