0
0

I wrote a recording program with FMOD Ex v4.02.08 and found a fatal problem.
What I try to do is to repeat recording a lot of times when it runs.
To make sure it works well, I did a long run test on my simple code.
When it repeated recording over hundreds of times, a memory error happened.
Since it happened, System::recordStart() and System::recordStop() functions
did not work well although they returned FMOD_OK.

Below is a simplified code showing my problem.

============

include “../../api/inc/fmod.hpp”

include “../../api/inc/fmod_errors.h”

include <windows.h>

include <stdio.h>

include <conio.h>

void ERRCHECK(FMOD_RESULT result)
{
if (result != FMOD_OK)
{
printf(“FMOD error! (%d) %s\n”, result, FMOD_ErrorString(result));
exit(-1);
}
}

main()
{
FMOD::System *system = 0;
FMOD::Sound *sound = 0;
FMOD_RESULT result;
FMOD_CREATESOUNDEXINFO exinfo;

result = FMOD::System_Create(&amp;system);
ERRCHECK(result);

result = system-&gt;init(32, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);

memset(&amp;exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
exinfo.cbsize           = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.numchannels      = 1;
exinfo.format           = FMOD_SOUND_FORMAT_PCM16;
exinfo.defaultfrequency = 44100;
exinfo.length           = exinfo.defaultfrequency * sizeof(short) * exinfo.numchannels * 5;

result = system-&gt;createSound(0, FMOD_2D | FMOD_SOFTWARE | FMOD_OPENUSER, &amp;exinfo, &amp;sound);
ERRCHECK(result);

while (1) {
    result = system-&gt;recordStart(sound, false);
    ERRCHECK(result);

    for (int i=0; i&lt;10; i++) {
        Sleep(500);
        system-&gt;update();
    }

    result = system-&gt;recordStop();
    ERRCHECK(result);
}

}

===================

Thanks,
Jangyeon

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.