List of usage examples for android.media.audiofx Visualizer Visualizer
public Visualizer(int audioSession) throws UnsupportedOperationException, RuntimeException
From source file:com.rks.musicx.ui.fragments.PlayingViews.Playing4Fragment.java
private void initVisualizer() { if (permissionManager.isAudioRecordGranted(getContext())) { mVisualizer = new Visualizer(audioSessionID()); mVisualizer.setEnabled(false);// w ww . j ava 2 s. co m mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1]); mVisualizer.setDataCaptureListener(new Visualizer.OnDataCaptureListener() { @Override public void onWaveFormDataCapture(Visualizer visualizer, byte[] waveform, int samplingRate) { } @Override public void onFftDataCapture(Visualizer visualizer, byte[] fft, int samplingRate) { vizualview.updateVisualizer(fft); } }, Visualizer.getMaxCaptureRate() / 2, true, true); } else { Toast.makeText(getContext(), "AudioRecord permission not granted for visualizer", Toast.LENGTH_SHORT) .show(); Log.d("Playing4Fragment", "permission not granted"); } }