更改混响预设时没有区别

时间:2018-12-28 06:24:22

标签: java android audioeffect

由于某种原因,当我将混响预设应用于正在播放的歌曲时,我什么也听不到。

我的mediaplayer对象在服务类中受控制,我将mediaplayer对象导入均衡器类中。

然后我通过 mediaPlayer.getAudioSessionId()

获得音频ID

低音增强和响度增强器都可以正常工作,因此获取 ID 并不是问题。

更改预设时,我听到声音没有差异的原因是什么?

创建时

if (hasPresetReverb){
        setupReverbSpinner();
        mPresetReverb.setEnabled(true);
        mediaPlayer.setAuxEffectSendLevel(1.0f);
    } 

setupReverbSpinner();

mPresetReverb = new PresetReverb(0, mediaPlayer.getAudioSessionId());


mReverbSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
            switch (position){
                case 0:
                    mPresetReverb.setPreset(PresetReverb.PRESET_NONE);
                    Log.i(TAG, "Current ReverbPreset: " + mPresetReverb.getPreset() + " PRESET_NONE");
                    break;
                case 1:
                    mPresetReverb.setPreset(PresetReverb.PRESET_SMALLROOM);
                    Log.i(TAG, "Current ReverbPreset: " + mPresetReverb.getPreset() + " PRESET_SMALLROOM");
                    break;
                case 2:
                    mPresetReverb.setPreset(PresetReverb.PRESET_MEDIUMROOM);
                    Log.i(TAG, "Current ReverbPreset: " + mPresetReverb.getPreset() + " PRESET_MEDIUMROOM");
                    break;
                case 3:
                    mPresetReverb.setPreset(PresetReverb.PRESET_LARGEROOM);
                    Log.i(TAG, "Current ReverbPreset: " + mPresetReverb.getPreset() + " PRESET_LARGEROOM");
                    break;
                case 4:
                    mPresetReverb.setPreset(PresetReverb.PRESET_MEDIUMHALL);
                    Log.i(TAG, "Current ReverbPreset: " + mPresetReverb.getPreset() + " PRESET_MEDIUMHALL");
                    break;
                case 5:
                    mPresetReverb.setPreset(PresetReverb.PRESET_LARGEHALL);
                    Log.i(TAG, "Current ReverbPreset: " + mPresetReverb.getPreset() + " PRESET_LARGEHALL");
                    break;
                case 6:
                    mPresetReverb.setPreset(PresetReverb.PRESET_PLATE);
                    Log.i(TAG, "Current ReverbPreset: " + mPresetReverb.getPreset() + " PRESET_PLATE");
                    break;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {

        }
    });

0 个答案:

没有答案