Equalizer - Effect library not loaded
Asked Answered
S

3

10

I have almost the same issue as where described here, answer in this post doesn't help me, I release my equalizer immediately after setting band levels to it. It works perfect on my 4.0.4 device, it works great on friend's 2.3.5 device, it crashes on a little percent of devices and it doesn't matter which version of android is running on these devices.

So there is error on

Equalizer mEqualizer = new Equalizer(0, mediaPlayer.getAudioSessionId());

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)

I have no idea how to solve this, any suggestions?

Sibley answered 7/11, 2012 at 18:48 Comment(0)
O
4

Make sure that you reboot the device and test it again with the release() after using the equalizer, it worked for me after 2 days of searching for clues.

Osmium answered 14/11, 2013 at 12:2 Comment(0)
H
1

From the documentation, you have to call release() on an Equalizer, MediaPlayer, Visualizer, etc for a graceful exit, or you will see this error when restarting the app. The only remedy then is to reboot, as previously mentioned in this thread.

This is where the Android application lifecycle makes things a little difficult, since apps are never supposed to exit (just pause and resume), unless absolutely required by the OS for memory reasons, or a reboot occurs. Your app onDestroy() method is called in both cases.

You can put the release() in onDestroy(), and that would satisfy the Android lifecycle for deployed apps. Your users would not see this error.

In development however there is a problem: IDEs like Eclipse (which is actually a framework for building IDEs, and not meant to be an IDE itself...) will kill the app process instead of sending it a destroy message. This violates the lifecycle and release() is not called.

This is also why you should never call System.exit(). It violates the lifecycle at the risk of ungraceful exits exactly like this.

So your process was exiting ungracefully. Only happens in development, not deployment. One remedy is to not use the device window in eclipse to stop processes. It is not a stop, but a kill.

Eclipse also kills (lifecycle violation) the process ungracefully when you Run an app project while there is already an instance running.

As the doctor said, if it hurts, don't do it: instead use the debugger which sends actual lifecycle messages to the app.

Hitherward answered 22/1, 2015 at 6:54 Comment(0)
E
0

This depends on the build of Android that is loaded on the device.

This log means that there is no library to implements the AudioEffect feature.

I m afraid there is no solution for this, rather then importing into your project some third party audio effect library

Englis answered 11/7, 2013 at 12:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.