Android均衡器自定义预设不适用

时间:2016-03-03 12:31:46

标签: android audio-player equalizer android-music-player

我试图改变当前的预设但不知何故我失败了。我能够使用所有预设名称制作spinner。但是当我尝试仅应用它们时,第一次seekbar(60HZ)变化(声音听起来并不像应用了正确的预设)

equalizerPresetSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            m_equalizer.usePreset((short)position);
            short numberFrequencyBands = m_equalizer.getNumberOfBands();
            final short lowerEqualizerBandLevel = m_equalizer.getBandLevelRange()[0];

            for(short i=0;i<numberFrequencyBands;i++)
            {
                SeekBar seekbar = (SeekBar)findViewById(i);
                seekbar.setProgress(m_equalizer.getBandLevel(i)-lowerEqualizerBandLevel);
            }
        }

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

        }
    });

是的...... Seekbar的ID是0,1,2等等,因为我建立了动态​​

0 个答案:

没有答案