hi,dear:
We have a feature, to save changed voice effect. But now I can play sound effect,can not save it.
Could you give me a help ?
now I try it below,it can not success. I also can not add dsp effect to it. because I do not know how to add it . thanks for help .
//start save file----------------------------------
const char *path_cstr = env->GetStringUTFChars(path_jstr, NULL);
system->createSound(path_cstr, FMOD_DEFAULT | FMOD_OPENONLY, NULL, &sound);
/*
Retrieve the sound information for the Impulse Response input file
*/
FMOD_RESULT result;
FMOD_SOUND_FORMAT irSoundFormat;
FMOD_SOUND_TYPE irSoundType;
int irSoundBits, irSoundChannels;
result = sound->getFormat(&irSoundType, &irSoundFormat, &irSoundChannels, &irSoundBits);
unsigned int irSoundLength;
result = sound->getLength(&irSoundLength, FMOD_TIMEUNIT_PCM);
if (irSoundFormat != FMOD_SOUND_FORMAT_PCM16)
{
/*
For simplicity of the example, if the impulse response is the wrong format just display an error
*/
LOGI("%s", "not pcm");
}
/*
The reverb unit expects a block of data containing a single 16 bit int containing
the number of channels in the impulse response, followed by PCM 16 data
*/
unsigned int irDataLength = sizeof(short) * (irSoundLength * irSoundChannels + 1);
short* irData = (short*)malloc(irDataLength);
irData[0] = (short)irSoundChannels;
unsigned int irDataRead;
result = sound->readData(&irData[1], irDataLength - sizeof(short), &irDataRead);
FILE *fpw = fopen("sdcard/voice_changed.pcm","wb+");
fwrite(&irData[1], irDataLength, sizeof(short), fpw);
fclose(fpw);
free(irData);
//end save file----------------------------------