0
0

The crash happens before the ERRCHECK(tst)…
(system is correctly init (no error) and FMOD_Sound_Release(sound) give no error)

[code:1dkqqby0]
if(sys != NULL)
{
tst = FMOD_System_Release(sys);
ERRCHECK(tst);
sys = NULL;
}
[/code:1dkqqby0]

what’s going wrong ?

Thanks ๐Ÿ˜‰

  • You must to post comments
0
0

Please look at the examples, nearly all of them load sounds then release them before exiting the program. I cant tell what else from that limited information, but what are you doing differently? Are you using the latest version v4.04.14 or v4.04.15?

  • You must to post comments
0
0

[code:2jey5t4j]
// TODO : update to C++ version when available with MINGW compiler...

include "others/includes/fmod/fmod.h" // C version...

static FMOD_SYSTEM *sys;
static FMOD_SOUND *sound;
static FMOD_RESULT tst;
static FMOD_TAG tag;
static FMOD_SOUND_TYPE sTYPE;
static FMOD_SOUND_FORMAT sFORMAT;

void CMusicFile::FMOD_INIT()
{
// init & config
if(isValidMusicFile) // normally always true
{
tst = FMOD_System_Create(&sys);
ERRCHECK(tst);

    tst = FMOD_System_Init(sys, 0, FMOD_INIT_NORMAL, 0);
    ERRCHECK(tst);

    tst = FMOD_System_CreateSound(sys, tmp.c_str(), FMOD_OPENONLY, 0, &sound);
    ERRCHECK(tst);
}

}

void CMusicFile::FMOD_STOP()
{
if(sound != NULL)
{
FMOD_Sound_Release(sound);
sound = NULL;
}
if(sys != NULL)
{
tst = FMOD_System_Release(sys);
ERRCHECK(tst);
sys = NULL;
}
}

void CMusicFile::ERRCHECK(FMOD_RESULT result)
{
if(result != FMOD_OK)
{
QMessageBox::critical(NULL, "MuRef", "isValidMusicFile set to false");
isValidMusicFile = false;
QMessageBox::critical(NULL, "MuRef", FMOD_ErrorString(result));
}
}

QString CMusicFile::getArtistName()
{
if(isValidMusicFile)
{
//==========
FMOD_INIT();
//==========
FMOD_Sound_GetTag(sound, "ARTIST", 0, &tag);
tmpStr = (char *)tag.data;
//==========
FMOD_STOP();
//==========
return tmpStr;
}
else
return "null";
}

[/code:2jey5t4j]

I really don’t see what’s wrong in this code… but you probably yes :D.

The only info I can give you is :

when I call it up to 3-5 times : it works (I call the function on the copies of a file (song1, copysong1,…) to be sure that there isn’t prob with the mp3 so, when I call it up to 3-5 times : that is fine… but when I call it like 25 times there is a segfault in fmodex.dll

the call stack :

0 100596F9 qt_plugin_instance() (D:\MuRef\fmodex.dll:??)

1 00000000 ??() (??:??)

It may be a Qt error ? Because Qt is C++ and FMODEx in C ? (I’m using C FMODEx because the C++ one don’t compile with mingw)

I’m using : libfmodex.a …
I think I’m lost ๐Ÿ˜•

  • You must to post comments
0
0

[quote:az83x1k0]14/7/06 4.04.14 – Stable release update

  • Fixed FMOD::System_Create being called 16 times causing a hang.
  • Fixed stack overflow issue in FMOD_NONBLOCKING thread. [/quote:az83x1k0]

With that version, it took more time before the segfault…

But that’s normal now ERRCHECK return a "Not enough memory" which can no longer considered like a bug but a misuse from me…

I’m sure it has something related with the bad System_Release… so return to the first question : what’s wrong in my code ?

Here’s the call stack now :

[code:az83x1k0]

0 100597E5 qt_plugin_instance() (D:\MuRef\fmodex.dll:??) // the DARK

1 1005D55E qt_plugin_instance() (D:\MuRef\fmodex.dll:??) // the DARK

2 1005D1FA qt_plugin_instance() (D:\MuRef\fmodex.dll:??) // the DARK

3 1005D1B3 qt_plugin_instance() (D:\MuRef\fmodex.dll:??) // the DARK

4 0040AB4F CMusicFile::FMOD_STOP() (??:??) // that’s my function

5 0040B0F6 CMusicFile::getArtistName() (??:??)

(useless things...)

[/code:az83x1k0]

  • You must to post comments
0
0

Why don’t you optimize your code? Just create the fmod system ONCE at the beginning of your program, then free it ONCE at the end…

  • You must to post comments
0
0

Of course.

[code:ptlfmjeg]
//==========
FMOD_INIT();
//==========
listOfTags.push_back(getTitle());
listOfTags.push_back(getArtistName());
listOfTags.push_back(getAlbum());
listOfTags.push_back(getTrackNumber());
listOfTags.push_back(getYear());
listOfTags.push_back(getGenre());
listOfTags.push_back(getComment());
listOfTags.push_back(getSongDuration());
//==========
FMOD_STOP();
//==========
[/code:ptlfmjeg]

When calling FMOD_STOP() :

[code:ptlfmjeg]
void CMusicFile::FMOD_STOP()
{
if(sound != NULL)
{
FMOD_Sound_Release(sound);
ERRCHECK(tst);
sound = NULL;
}
if(sys != NULL)
{
tst = FMOD_System_Release(sys);
ERRCHECK(tst);
sys = NULL;
}
}
[/code:ptlfmjeg]

Give me a fatal error and in the call stack I can just see that is the fault of fmodex.dll.

Actually, like you can see, the initialisation is nice. Then, when I call a FMOD funtion, it doesn’t even return me a "bad" tst value so that I can check it.

Anyway… I just resolved my problem :

[code:ptlfmjeg]
int alloc;
FMOD_Memory_Initialize(malloc(alloc), alloc, 0, 0, 0);
[/code:ptlfmjeg]

But why do I need to init the memory ?? I never saw this in a "simple" example… maybe because in a simple example they don’t call it multiple times ?

  • You must to post comments
0
0

If you are creating/releasing systems multiple times, try a sleep(1) instruction.
Had to use this to get fmodex from hang/crash(?) when creating/init/close/releasing multiple times without any delay

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.