0

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);
}
fm927
  • 11
  • 3
  • you probably need to profile your code to know which methods calls take which time to know what you need to optimize – Vladyslav Matviienko Apr 25 '18 at 12:21
  • @VladyslavMatviienko thank's for your comment. As the fmod did not open it's source code, I just call the play api, and wait it finish via while(channel->isPlaying()){sleep(1);}. I did not know why it is so slowly, and which method taked so much time. – fm927 Apr 27 '18 at 06:52
  • just a wild guess: try to increase sleep time. Probably to something like 100 ms – Vladyslav Matviienko Apr 27 '18 at 07:12
  • @VladyslavMatviienko Thanks for your advice, I tried another api param(FMOD_OUTPUTTYPE_WAVWRITER_NRT) and decrease the sleep time as your advice, now the time cost down! – fm927 May 02 '18 at 03:11

0 Answers0