title: Android Visualizer implementation crash
body: <p>I am trying to implement the Android Visualizer class. I have looked up other trouble threads but I am still getting a fatal error. This all looks to me like it should work correctly, for whatever reason the AVD keeps on crashing.</p>
  
  <p>First off, I am using the permissions:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.RECORD_AUDIO" /&gt;
  &lt;uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/&gt;
  </code></pre>
  
  <p>Here is my logcat:</p>
  
  <pre><code>12-21 15:10:46.983: D/dalvikvm(642): Not late-enabling CheckJNI (already on)
  12-21 15:10:48.823: D/MediaPlayer(642): Couldn't open file on client side, trying server     side  
  12-21 15:10:53.603: E/AudioEffect(642): set(): AudioFlinger could not create effect,    status: -22
  12-21 15:10:53.603: E/visualizers-JNI(642): Visualizer initCheck failed -4
  12-21 15:10:53.613: E/Visualizer-JAVA(642): Error code -4 when initializing Visualizer.
  12-21 15:10:53.613: E/Visual Ex(642): Cannot initialize Visualizer engine, error: -4
  12-21 15:10:53.964: D/gralloc_goldfish(642): Emulator without GPU emulation detected.
  </code></pre>
  
  <p>And my code:</p>
  
  <pre><code>package MediaPlayer.namespace;
  
  import java.io.IOException;
  
  import android.app.Activity;
  import android.media.MediaPlayer;
  import android.media.MediaRecorder;
  import android.media.audiofx.Visualizer;
  import android.net.Uri;
  import android.os.Bundle;
  import android.util.Log;
  
  public class MediaPlayerActivity extends Activity 
  {
  Visualizer      visual;
  int             formattedVizData[];
  byte            rawWaveForm[];
  int             cont = 0xFF;
  
  public void onCreate(Bundle savedInstanceState) 
  {
      //start
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
  
      ///start media player &amp; visualizer.
      MediaPlayer mediaPlayer = new MediaPlayer();
      mediaPlayer = MediaPlayer.create(this, Uri.parse("http://vprbbc.streamguys.net:80/vprbbc24.mp3"));
      mediaPlayer.start();
      // Create the Visualizer object and attach it to our media player.
      try{
          visual = new Visualizer(mediaPlayer.getAudioSessionId()); // this line causing Exception 
          visual.setEnabled(true);
          visual.setCaptureSize(Visualizer.getCaptureSizeRange()[1]);
          }
          catch(Exception ex)
          {
              Log.e("Visual Ex", ex.getMessage());
          }
      }
  }
  </code></pre>