Hello, when I use the demo code “record.cpp” to record sound, it can record, the main code is these:
result = system->createSound(0, FMOD_LOOP_NORMAL | FMOD_OPENUSER, &exinfo, &sound);

result = system->recordStart(DEVICE_INDEX, sound, true);

But, I need to save sound to pcm file, I have used these code to save to file:
void *ptr1, *ptr2;
unsigned int lenbytes, len1, len2;
sound->lock(0, lenbytes, &ptr1, &ptr2, &len1, &len2);
fwrite(ptr1, lenbytes, 1, fp);
sound->unlock(ptr1, ptr2, len1, len2);

It didn’t works, is someone has met this problem? hope you can tell me how to save sound to file, it is appreciate!

  • You must to post comments
Best Answer

Check this thread, it has code that writes the sound to a wav file.

  • yourks

    Thank you very much, you save my life!

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.