0
0

Hi,

I’m using the last version of Fmod Ex, and I have a memory problem. I’ms using CSharp.

In a loop, I create 10 fmod objects, and I play all sound. (I need to create 10 objects and not just 1)
When I clic on a button, I release all the objects like that :
[code:lfpdl2xf]
private void Dispose()
{
sound.release();
system.close();
system.release();
}
[/code:lfpdl2xf]

But I have a memory problem :
When the programme start I have 15mo use memory.
When the 10 sounds are playing : 25mo.
When I release all : 23mo.

Why I don’t retrieve all my memory ?
What can i do for that ?

Regards,

Thibault

Fmod Creation code :

[code:lfpdl2xf]
class FmodTest
{
public void FmodTest() {
FMOD.Factory.System_Create(ref system);
system.createSound(filePath, (FMOD.MODE._2D ı FMOD.MODE.HARDEWARE ı FMOD.MODE.CREATESTREAM ı FMOD.MODE.LOOP_OFF), ref sound);
system.playSound(FMOD.CHANNELINDEX.FREE, sound, false, ref channel);
}

And next, loop :

for (int i=0; i< 10; i++)
{
FmodTest myFmod = new FmodTest();
myList.Add(myFmod);
}

Dispose :
foreach (FmodTest Tsound in myList)
Tsound.release();

[/code:lfpdl2xf]

  • You must to post comments
0
0

I make a little test, to see the memory leak.

I create 10 songs and play all of them. When a song is finish, I dispose/release it and I recreate an other.
With that I always have 10 songs playing.

The memory grows up !
Fmod memory leak or probs with C# ?

  • You must to post comments
0
0

where’s the system init?

  • You must to post comments
0
0

Oh sorry, I forgot it in the initial post. (I didnt copy all my code)

[code:2r08idd4]class FmodTest
{
public void FmodTest() {
FMOD.Factory.System_Create(ref system);

     system.init(1, FMOD.INITFLAG.NORMAL, (IntPtr)null);

      system.createSound(filePath, (FMOD.MODE._2D ı  FMOD.MODE.HARDEWARE ı  FMOD.MODE.CREATESTREAM ı FMOD.MODE.LOOP_OFF), ref sound);
      system.playSound(FMOD.CHANNELINDEX.FREE, sound, false, ref channel);}

}[/code:2r08idd4]

edit : When the isplaying flag is equal to false, I dispose my object

  • You must to post comments
0
0

How are you getting you memory usage? If you are using Task Manager, it is not accurate. It is probably just something to do with c#’s garbage collection.

You can get how much memory FMOD is using using the FMOD.Memory_GetStats API function.

Also, why do you need to create 10 system objects? It is usually not a good idea to have more than 1

  • You must to post comments
0
0

I just noticed the Memory_GetStats function doesn’t seem to be implemented in the C# wrapper. I will get this fixed up for our next release which will be out by the end of the day.

  • You must to post comments
0
0

Ok thanks.

Why I want 10 fmod objects ?
I use, in fact, 3-4 systems objets because I make some mix with them. For example during 10sec I make a fade on the first sound and I apply a dsp effect on an other, and mute the 3st.
I can have too : one object one my first soundcard, and an other on the second soundcard.

With that I can control all my sound and mixed them. And when a sound is finish I remove the object and recreate, and configure what I want, an other for the next sound.
So I have one system object for one sound.

Maybe I don’t have a good fmod implementation :). Perhaps I need to correct my fmod utilisation. (it’s a personnal project).

I read on the documentation that I can used sound group. I will work with that solution.

Thanks
(Sorry if my english is not good)

  • You must to post comments
0
0

I don’t think the FMOD system is doing what you think it’s supposed to be doing. You only need one FMOD system object for what you want to do.

What you’ll need, though, is multiple sounds / channels. The Sound object represents a source (such as a wave or mp3 file), and Channels represent the playback of those sources.

So, a simple example, if you have a single trumpet wave file, but want to play three notes simultaneously in a chord, you can create a single Sound object to load the audio file, but you’ll use three Channel objects to play the three notes. The frequency would be adjusted on the Channel objects.

Naturally, if you have several different wave files, you’d need to create a Sound object for each of these audio files.

Make sense?

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.