before enabling equalizer capabilities, I check for api level to make sure it's equal or greater than 9.
From the reports I'm getting from my users, it seems that some exceptions are thrown anyway :
the code eq = new Equalizer(0, mp.getAudioSessionId())
can raise :
Caused by: java.lang.UnsupportedOperationException: Effect library not loaded
at android.media.audiofx.AudioEffect.<init>(AudioEffect.java:355)
at android.media.audiofx.Equalizer.<init>(Equalizer.java:149)
and the code eq.getBandLevelRange()
can raise :
Caused by: java.lang.UnsupportedOperationException: AudioEffect: invalid parameter operation
at android.media.audiofx.AudioEffect.checkStatus(AudioEffect.java:1182)
at android.media.audiofx.Equalizer.getBandLevelRange(Equalizer.java:206)
I don't know if there is a solution, and if not I could just catch those exceptions and disable equalizer, but I need to know what's exactly causing this, so I can inform my users without frustrating them.
thanks for any help
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…