By Bel


2013-01-30 11:43:04 8 Comments

Help me please, how fix this?

public class VisualizerCapture extends Activity implements Visualizer.OnDataCaptureListener
private Visualizer mVisualizer;


@Override
public void onCreate(Bundle savedInstanceState){
 super.onCreate(savedInstanceState);
    mVisualizer = new Visualizer(0);
    setupVisualizer();

private void setupVisualizer() {
    mVisualizer.setEnabled(false);
    mVisualizer.setCaptureSize(8);      //test
    mVisualizer.setDataCaptureListener(this,250,false,true);        
            Log.v("ABS","setupVisualizer" + mVisualizer.getEnabled());    //log

This code throws error: ERROR/AudioEffect(2393): set(): AudioFlinger could not create effect, status: -22

that was in xml

 <uses-permission android:name="android.permission.RECORD_AUDIO"/>             
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>

logcat:

java.lang.RuntimeException: Unable to start activity ComponentInfo{blabla}: java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -4 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) at android.app.ActivityThread.access$600(ActivityThread.java:123) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4424) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -4 at android.media.audiofx.Visualizer.(Visualizer.java:182) at com.blablabeta.gui.VisualizerCapture.onCreate(EqVisualizerCaptureAudio.java:27) at android.app.Activity.performCreate(Activity.java:4465) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)

That is it? and how to fix this error?

2 comments

@Bel 2013-02-01 08:01:55

The problem was gone then I test my app on real phone. somthing wrong with emulator.

@Michael 2013-01-30 12:13:36

When using the Visualizer on session 0 you need to have MODIFY_AUDIO_SETTINGS and RECORD_AUDIO permissions, but I'm guessing that your app has those because otherwise you'd get a PERMISSION_DENIED error (-1 if I remember correctly).

Status -22 ought to be BAD_VALUE. It's not entirely clear to me from the information available in the question why this would happen. Perhaps there's more information available in the logcat output in addition to that line you pasted. Potential reasons for why you'd end up with a BAD_VALUE status would be e.g. that the effect isn't found, or that the effect already has been inserted in the effect chain.

@Bel 2013-01-30 12:38:29

added logcat, its a bit fixed, but only in file names.

@Shreyash Mahajan 2013-04-12 05:07:42

@Michael: Same error i found on the constructer of the Equalizer. Please help for that.

Related Questions

Sponsored Content

2 Answered Questions

1 Answered Questions

[SOLVED] I am getting the Following error when executing the code

  • 2014-05-17 06:05:45
  • munishguptamg
  • 128 View
  • 0 Score
  • 1 Answer
  • Tags:   android

4 Answered Questions

[SOLVED] Android app does not work on Tablet

1 Answered Questions

[SOLVED] Android MySQL issue in Android 4.0 only?

1 Answered Questions

[SOLVED] Changed to gridview application now crashes?

Sponsored Content