mediaplayer reverb is not working

空扰寡人 提交于 2019-12-13 16:39:00

问题


I am trying to apply reverb effect to mediaplayer by creating a reverb on the output mix (audio session "0" ) , and I use this code

    public void reverb1(View v){
    PresetReverb mReverb = new PresetReverb(0,0);//<<<<<<<<<<<<<
    mReverb.setPreset(PresetReverb.PRESET_LARGEROOM);
    mReverb.setEnabled(true);
    mp1.attachAuxEffect(mReverb.getId());
    mp1.setAuxEffectSendLevel(1.0f);

}

However when I start the song and apply the effect nothing happens, song continues and reverb effect is not applied. I also added this premission in manifest <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/> Still same results, am i doing something wrong? I also tried PresetReverb mReverb = new PresetReverb(0, mp1.getAudioSessionId()); But still same results.

any help will be appreciated


回答1:


PresetReverb mReverb = new PresetReverb(0, mp1.getAudioSessionId());

This constructor takes two arguments, first is priority and another one is the audio session id. If u want to reverb than keep ur priority 1 and use global audiosessionId.

PresetReverb mReverb = new PresetReverb(1, 0);
mReverb.setPreset(PresetReverb.PRESET_LARGEROOM);
mReverb.setEnabled(true);
mp1.attachAuxEffect(mReverb.getId());
mp1.setAuxEffectSendLevel(1.0f);

one more thing to note is that this reverb effects are not supported in some of the devices ...becaz they are having limited equalizer bands. I don't have perfect resources to confirm my state about some devices , but i tested the same on some devices & it's working fine for some and not working fine for some



来源:https://stackoverflow.com/questions/16130380/mediaplayer-reverb-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!