Android.Media.Audiofx.Visualizer Class
The Visualizer class enables application to retrieve part of the currently playing audio for visualization purpose.

See Also: Visualizer Members

Syntax

[Android.Runtime.Register("android/media/audiofx/Visualizer", DoNotGenerateAcw=true)]
public class Visualizer : Java.Lang.Object

Remarks

The Visualizer class enables application to retrieve part of the currently playing audio for visualization purpose. It is not an audio recording interface and only returns partial and low quality audio content. However, to protect privacy of certain audio data (e.g voice mail) the use of the visualizer requires the permission android.permission.RECORD_AUDIO.

The audio session ID passed to the constructor indicates which audio content should be visualized:

Two types of representation of audio content can be captured:

The length of the capture can be retrieved or specified by calling respectively Visualizer.CaptureSize and Visualizer.SetCaptureSize(int) methods. The capture size must be a power of 2 in the range returned by Visualizer.GetCaptureSizeRange.

In addition to the polling capture mode described above with Visualizer.GetWaveForm(Byte[]) and Visualizer.GetFft(Byte[]) methods, a callback mode is also available by installing a listener by use of the Visualizer.SetDataCaptureListener(.IOnDataCaptureListener, System.Int32, System.Int32, System.Int32) method. The rate at which the listener capture method is called as well as the type of data returned is specified.

Before capturing data, the Visualizer must be enabled by calling the Visualizer.SetEnabled(bool) method. When data capture is not needed any more, the Visualizer should be disabled.

It is good practice to call the Visualizer.Release method when the Visualizer is not used anymore to free up native resources associated to the Visualizer instance.

Creating a Visualizer on the output mix (audio session 0) requires permission NoType:android/Manifest$permission;Href=../../../../reference/android/Manifest.permission.html#MODIFY_AUDIO_SETTINGS

The Visualizer class can also be used to perform measurements on the audio being played back. The measurements to perform are defined by setting a mask of the requested measurement modes with Visualizer.SetMeasurementMode(VisualizerMeasurementMode). Supported values are Visualizer.MeasurementModeNone to cancel any measurement, and Visualizer.MeasurementModePeakRms for peak and RMS monitoring. Measurements can be retrieved through Visualizer.GetMeasurementPeakRms(.MeasurementPeakRms).

[Android Documentation]

Requirements

Namespace: Android.Media.Audiofx
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 9