0
0

Hello,
I have updated my FMOD Ex API from version 4.06.16 to 4.08.04 and my app started to crash inside call to System::update() for System objects initalized with FMOD_INIT_STREAM_FROM_UPDATE flag.
I reverted FMOD Win files to version 4.06.16 and now my app works under Win, but FMOD Mac files were rewritten and I cann’t downnload them now. I will appreciate you very much if you could lay out them for downlown.
I have tested my app on Win using FmodEx API v4.06.33 but it crashes as well. In my opinion this relates to fix done in stable release update v4.06.29 on 21/09/07.

Here is a small demo which demonstarates this bug (crashes with FMOD Ex 4.08.04 and 4.06.33 but works with FMOD Ex 4.06.16):

include <fmod.hpp>

include <fmod_errors.h>

include <windows.h>

include <stdio.h>

include <crtdbg.h>

define ERRCHECK(X) check(X, #X, FILE, LINE)

bool check(FMOD_RESULT result, const char* text, const char* file, unsigned lineNo)
{
if(result == FMOD_OK) return true;
printf("FMOD error! (%d) %s\n\tfile: %s\n\tline: %d\n\ttext: %s\n\n", result, FMOD_ErrorString(result), file, lineNo, text);
//exit(-1);
return false;
}

FMOD_RESULT F_CALLBACK eoch(
FMOD_CHANNEL * channel,
FMOD_CHANNEL_CALLBACKTYPE type,
int command,
unsigned int commanddata1,
unsigned int commanddata2
)
{
unsigned * n;
((FMOD::Channel*)channel)->getUserData((void**)&n);
(*n)–;
return FMOD_OK;
}

char buffer[0x04000000];

int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::DSP *mydsp;
FMOD_RESULT result;
unsigned int version;
float pan = 0;

ERRCHECK(FMOD::System_Create(&system));
ERRCHECK(system->getVersion(&version));
_ASSERT(version >= FMOD_VERSION);

ERRCHECK(system->init(32, FMOD_INIT_NORMAL, 0));

FMOD::Sound* sound;
ERRCHECK(system->createSound("demo.wav", FMOD_OPENONLY, NULL, &sound));
unsigned length, read;
ERRCHECK(sound->getLength(&length, FMOD_TIMEUNIT_PCM));
FMOD_SOUND_TYPE type;
FMOD_SOUND_FORMAT fmt;
int ch, b;
ERRCHECK(sound->getFormat(&type, &fmt, &ch, &b));
float freq;
ERRCHECK(sound->getDefaults(&freq, NULL, NULL, NULL));
length *= ch * (b/8);
ERRCHECK(sound->readData(buffer, length, &read));
ERRCHECK(sound->release());

FMOD::System * sys;
ERRCHECK(FMOD::System_Create(&sys));
ERRCHECK(sys->setOutput(FMOD_OUTPUTTYPE_NOSOUND_NRT));
ERRCHECK(sys->init(1, FMOD_INIT_STREAM_FROM_UPDATE, NULL));

FMOD_CREATESOUNDEXINFO info;
memset(&info, 0, sizeof(info));
info.cbsize = sizeof(info);
info.format = fmt;
info.length = length;
info.numchannels = ch;
info.defaultfrequency = freq;
ERRCHECK(sys->createSound(buffer, FMOD_OPENMEMORY_POINT | FMOD_SOFTWARE | FMOD_CREATESTREAM | FMOD_OPENRAW, &info, &sound));
FMOD::Channel * channel;
ERRCHECK(sys->playSound(FMOD_CHANNEL_FREE, sound, true, &channel));
unsigned numChannels = 1;
ERRCHECK(channel->setUserData(&numChannels));
ERRCHECK(channel->setCallback(FMOD_CHANNEL_CALLBACKTYPE_END, eoch, 0));

ERRCHECK(channel->setPaused(false));

while(numChannels)
{
unsigned pos;
ERRCHECK(channel->getPosition(&pos, FMOD_TIMEUNIT_PCM));
ERRCHECK(sys->update());
}

ERRCHECK(sound->release());
ERRCHECK(sys->release());

ERRCHECK(system->release());
return 0;
}
This demo crashes with message:

[ Unhandled exception at 0x1006e4ba in bug_demo.exe: 0xC0000005: Access violation reading location 0x00000008. ]

at point:

fmodexL.dll!1006e4ba()


1006E499 push esi
1006E49A push edi
1006E49B push dword ptr ds:[10191134h]
1006E4A1 call 100032ED
1006E4A6 mov eax,dword ptr ds:[10168F98h]
1006E4AB pop ecx
1006E4AC mov dword ptr ds:[10191120h],eax
1006E4B1 mov edi,10168F98h
1006E4B6 cmp eax,edi
1006E4B8 je 1006E510
1006E4BA mov esi,dword ptr [eax+8] <<<—here, eax = NULL
1006E4BD mov eax,dword ptr [eax]
1006E4BF push dword ptr ds:[10191134h]
1006E4C5 mov dword ptr ds:[10191124h],eax
1006E4CA call 10003305
1006E4CF push dword ptr ds:[10191130h]
1006E4D5 call 100032ED
1006E4DA pop ecx
1006E4DB pop ecx

EAX = 00000000 EBX = 056312F8
ECX = 056156F0 EDX = 05615730
ESI = 05679518 EDI = 10168F98
EIP = 1006E4BA ESP = 0012FD30
EBP = 0012FD50 EFL = 00200293

Remarks: eoch(..) isn’t called, so crash takes place while sound is playing

  • You must to post comments
0
0

Hi, i’ve fixed this for the next release.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.