Equalizer not always supported, even when api >= 9?
Asked Answered
V

1

13

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

Volplane answered 10/5, 2012 at 14:27 Comment(1)
getting same error on api level 25, did you find any solution?Weaks
B
8

I had this same issue, and it was caused by not calling release() on my Equalizer when I was finished with it. Apparently, the native libraries won't allow instantiation of a new AudioEffect if there are too many already in existence.

Bullwhip answered 4/6, 2012 at 17:23 Comment(1)
I have added release in the same class where I am initializing my equalizer and my app is working fine on all the devices except api level 25. It's getting crashed with exception java.lang.UnsupportedOperationException: AudioEffect: invalid parameter operation So I asked a que on below link #40968477Weaks

© 2022 - 2024 — McMap. All rights reserved.