Answered
0
1

I am use v1.10 low level api on android. I have a question that is save file too slow.
It cost 20s+ when I save a mp3/wav file which duration is 20s.

Here is my code,please help me find the problem:

     //the file size is always 0 when use FMOD_OUTPUTTYPE_WAVWRITER_NRT  and while{update;}
    result = system->setOutput(FMOD_OUTPUTTYPE_WAVWRITER);
    ERRCHECK(result);
    result = system->init(16, FMOD_INIT_NORMAL, (void *) outpath);
    ERRCHECK(result);
    result = system->getMasterChannelGroup(&mastergroup);
    ERRCHECK(result);
    result = system->createSound(inputpath, FMOD_DEFAULT, NULL, &sound);
    ERRCHECK(result);
    result = system->playSound(sound, 0, false, &channel);
    ERRCHECK(result);
    system->createDSPByType(FMOD_DSP_TYPE_TREMOLO, &dsp);
    channel->addDSP(0, dsp);

    bool playing = true;
    while(playing){
        result = channel->isPlaying(&playing);
        ERRCHECK(result);
        sleep(1);
    }
  • You must to post comments
Best Answer
0
0

FMOD_OUTPUTTYPE_WAVWRITER runs in real time, this means that as the sound plays it is saved out to a file. So if your sound is 20 seconds, it will take the same amount of time to play it and record it. You can use FMOD_OUTPUTTYPE_WAVWRITER_NRT (non-realtime) which allows you to drive the mixer using System::update.

Note! If FMOD_OUTPUTTYPE_WAVWRITER_NRT or FMOD_OUTPUTTYPE_NOSOUND_NRT are used, and if the System::update function is being called very quickly (ie for a non realtime decode) it may be being called too quickly for the FMOD streamer thread to respond to. The result will be a skipping/stuttering output in the captured audio.

https://fmod.com/resources/documentation-api?page=content/generated/FMOD_OUTPUTTYPE.html#/

  • flyswan

    thank you ! I change the param to FMOD_OUTPUTTYPE_WAVWRITER_NRT , and add sleep in while{} and the time now cost down.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.