Note that there are some explanatory texts on larger screens.

plurals
  1. POFMOD Ex Memory Allocation Issue
    primarykey
    data
    text
    <p>I have a certain problem when using FmodEx. I've searched thoroughly over the net to see if someone had my same problem but I didn't find anything related to it. I made a class that loads and plays my sounds, in this case, streams. Here is my code:</p> <pre><code>Audio::Audio() { //Create system object// m_Result = FMOD::System_Create(&amp;m_pSystem); ErrorCheck(m_Result); //Check FMOD version// m_Result = m_pSystem-&gt;getVersion(&amp;m_FmodVersion); if(m_FmodVersion &lt; FMOD_VERSION) MessageBox(NULL, FMOD_ErrorString(m_Result), "FMOD Version Error", MB_OK); //Check if hardware acceleration is disabled// m_pSystem-&gt;getDriverCaps(0, &amp;m_Caps, 0, &amp;m_SpeakerMode); if (m_Caps &amp; FMOD_CAPS_HARDWARE_EMULATED) MessageBox(NULL, FMOD_ErrorString(m_Result), "FMOD Acceleration Error", MB_OK); //Initialize system object// m_Result = m_pSystem-&gt;init(2, FMOD_INIT_NORMAL, 0); ErrorCheck(m_Result); m_pChannel = 0; m_IsLoaded = false; } void Audio::LoadMusic(char *filename) { m_Result = m_pSystem-&gt;createStream(filename, FMOD_CREATESTREAM, 0, &amp;m_pSound); ErrorCheck(m_Result); } void Audio::Play() { SetPause(false); m_Result = m_pSystem-&gt;playSound(FMOD_CHANNEL_FREE, m_pSound, false, &amp;m_pChannel); ErrorCheck(m_Result); SetPause(true); } </code></pre> <p>After this I just do:</p> <pre><code>pAudio-&gt;LoadMusic("test.mp3"); pAudio-&gt;Play(); </code></pre> <p>The sound plays no problem. The problem happens when loading the stream. The memory used keeps increasing all the time and it won't stop. I'm guessing that this happens because the small buffer it's using to read the mp3 stream is not beeing freed, thus, it looks for the next available piece of free memory in the RAM, thus the memory usage of the program doesn't stop increasing. I thought that maybe using the "release" method after each play would work, but then I noticed that release frees ALL the memory in the sound instance.</p> <p>Could anyone give me some pointers on to what I'm doing wrong here? How do I prevent this? I'm not sure if I have made it clear enough or not. Thanks in advance for the help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload