问题
i use FMOD library in android and i don't know how get output progressbar or fast play/pause/stop sound with effect's like: https://play.google.com/store/apps/details?id=com.baviux.voicechanger&hl=en
i try to use fomd document's and i know how can i get output but for that's problem's i don't find anything.
i'm a beginner in android & ndk.
this is my code and i can't control play pause or stop and get output progressbar in java activity:
System *system;
Sound *sound;
DSP *dsp;
Channel *channel;
float frequency;
bool isPlaying = true;
FMOD_RESULT result;
System_Create(&system);
if (save == 1) {
unsigned int outputhandle;
system->setOutput(FMOD_OUTPUTTYPE_WAVWRITER);
system->init(32, FMOD_INIT_NORMAL,(void *) "/sdcard/sound.mp3");
} else{
system->init(32, FMOD_INIT_NORMAL, NULL);
}
const char *path_cstr = env->GetStringUTFChars(path_jstr, NULL);
try {
system->createSound(path_cstr, FMOD_DEFAULT, NULL, &sound);
switch (type) {
case TYPE_NORMAL:
LOGI("%s", path_cstr)
system->playSound(sound, 0, false, &channel);
LOGI("%s", "fix normal");
break;
case TYPE_LOLITA:
system->createDSPByType(FMOD_DSP_TYPE_PITCHSHIFT, &dsp);
dsp->setParameterFloat(FMOD_DSP_PITCHSHIFT_PITCH, 8.0);
system->playSound(sound, 0, false, &channel);
channel->addDSP(0, dsp);
break;
case TYPE_UNCLE:
system->createDSPByType(FMOD_DSP_TYPE_PITCHSHIFT, &dsp);
dsp->setParameterFloat(FMOD_DSP_PITCHSHIFT_PITCH, 0.8);
system->playSound(sound, 0, false, &channel);
channel->addDSP(0, dsp);
break;
case TYPE_THRILLER:
system->createDSPByType(FMOD_DSP_TYPE_TREMOLO, &dsp);
dsp->setParameterFloat(FMOD_DSP_TREMOLO_SKEW, 5);
system->playSound(sound, 0, false, &channel);
channel->addDSP(0, dsp);
break;
case TYPE_FUNNY:
system->createDSPByType(FMOD_DSP_TYPE_NORMALIZE, &dsp);
system->playSound(sound, 0, false, &channel);
channel->addDSP(0, dsp);
channel->getFrequency(&frequency);
frequency = frequency * 2;
channel->setFrequency(frequency);
break;
case TYPE_ETHEREAL:
system->createDSPByType(FMOD_DSP_TYPE_ECHO, &dsp);
dsp->setParameterFloat(FMOD_DSP_ECHO_DELAY, 300);
dsp->setParameterFloat(FMOD_DSP_ECHO_FEEDBACK, 20);
system->playSound(sound, 0, false, &channel);
channel->addDSP(0, dsp);
break;
case TYPE_Sajjad:
system->createDSPByType(FMOD_DSP_TYPE_CHORUS, &dsp);
dsp->setParameterFloat(FMOD_DSP_CHORUS_DEPTH, 90.0f);
system->playSound(sound, 0, false, &channel);
channel->addDSP(0, dsp);
channel->getFrequency(&frequency);
// frequency = frequency * 2;
channel->setFrequency(frequency);
break;
}
} catch (...) {
LOGE("%s", "catch exception...")
goto end;
}
system->update();
while (isPlaying) {
channel->isPlaying(&isPlaying);
usleep(1000 * 1000);
}
goto end;
end:
env->ReleaseStringUTFChars(path_jstr, path_cstr);
sound->release();
system->close();
system->release();
i'm a beginner please give me some code.
来源:https://stackoverflow.com/questions/58788796/how-get-fmod-output-progressbar-play-pause-in-android-java-activity