Hello there.

I have a little project that uses Fmod for sound and in a part of it, the user can select a song and it starts playing. The problem is, everytime I start another song, the old one stays in the memory it seems because my memory usage skyrockets when I go through all those songs.
I use 1 FSOUND_STREAM pointer and I’d like to keep it that way (if possible at least). So how would I remove m_FmodSoundCheck from the memory before opening the next song?
Thanks in advance.

[code:a32m7r5r] FSOUND_STREAM* m_FmodSoundCheck;[/code:a32m7r5r]
[code:a32m7r5r]//Check which song is selected and play it
void Menu::PlaySong()
// Stop the song currently playing
m_FmodSoundCheck = NULL;


    case 0:
        m_FmodSoundCheck = FSOUND_Stream_Open("BGM/1intro.mp3",FSOUND_LOOP_NORMAL, 0, 0);
    case 1:
        m_FmodSoundCheck = FSOUND_Stream_Open("BGM/2titlescreen.mp3",FSOUND_LOOP_NORMAL, 0, 0);
    case 2:
        m_FmodSoundCheck = FSOUND_Stream_Open("BGM/3options.mp3",FSOUND_LOOP_NORMAL, 0, 0);
// and so on and on ...

FSOUND_Stream_Play (0,m_FmodSoundCheck);   


Also, I have another, unrelated problem.
When my program exits, when I use FSOUND_Stream_Close to remove my background music, this works. But when I want to remove the effect sounds, which are samples, with FSOUND_Sample_Free, my program crashes when exiting.

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.