This is my equalizer class, and for a long time it worked without any problem,but now i'm getting this error.
P.S yesterday i flashed a custom rom on my phone, could that be the problem? Because on another device it works fine.
Error
Caused by: java.lang.UnsupportedOperationException: AudioEffect: invalid parameter operation
at android.media.audiofx.AudioEffect.checkStatus(AudioEffect.java:1299)
at android.media.audiofx.Equalizer.setBandLevel(Equalizer.java:223)
My code
verticalSeekbar[i].setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean b) {
short newLevel = (short)(progress + lowerEqualizerBandLevel);
short band = (short)seekBar.getTag();
bandLevels[band] = newLevel;
if (mEqualizer != null) {
mEqualizer.setBandLevel(band, newLevel);
}
slider_value[band].setText((progress + lowerEqualizerBandLevel) / 100 + " dB");
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
slider_labels[i].setText(formatBandLabel(freq_range));
}
EDIT Im certain that the problem is the custom rom because on stock roms it works fine.
What could be the reason it throws UnsupportedOperationException on custom roms?