I am creating an EQ media player, when I set the EQ bands, it works fine. I have a code that lists all the presets, when I change, I want to set the preset in EQ, but I get bad parameter value.
This is what I have in my journal:
09-29 14:29:24.810: W/System.err(27829): java.lang.IllegalArgumentException: AudioEffect: bad parameter value
09-29 14:29:24.835: W/System.err(27829): at android.media.audiofx.AudioEffect.checkStatus(AudioEffect.java:1259)
09-29 14:29:24.835: W/System.err(27829): at android.media.audiofx.Equalizer.usePreset(Equalizer.java:342)
getNumberOfPresets () returns 12 and the preset for this example is 2 (but this happens for all values 0-11)
If I use setBandLevel()up usePreset(), it does not throw an exception, but I'm not sure if this is the right way to do this. Edit: setBandLevel has nothing to do with exception. It just appears by chance, 80% of the attempts.
Update: I noticed that this only happens on Samsung S3 devices (for now). Works great on the Asus TF101.
Any help is appreciated.
Here is the code:
mEqualizer = new Equalizer(0, mMediaPlayer.getAudioSessionId());
mEqualizer.setEnabled(true);
mEqualizer.usePreset((short)mEQPresetPos);
cucko source
share