public class

OpenSLHQVisualizer

extends Object
implements IHQVisualizer
java.lang.Object
   ↳ com.h6ah4i.android.media.opensl.audiofx.OpenSLHQVisualizer

Summary

[Expand]
Inherited Constants
From interface com.h6ah4i.android.media.audiofx.IHQVisualizer
Public Constructors
OpenSLHQVisualizer(OpenSLMediaPlayerContext context)
Public Methods
int getCaptureSize()
Returns current capture size.
int[] getCaptureSizeRange()
Returns the capture size range.
boolean getEnabled()
Get current activation state of the visualizer.
int getMaxCaptureRate()
Returns the maximum capture rate for the callback capture method.
int getNumChannels()
Returns the number of channels of the captured audio.
int getSamplingRate()
Returns the sampling rate of the captured audio.
int getWindowFunction()
Returns current window function type.
void release()
Release associated resources.
static int[] sGetCaptureSizeRange()
static int sGetMaxCaptureRate()
int setCaptureSize(int size)
Sets the capture size, i.e.
int setDataCaptureListener(IHQVisualizer.OnDataCaptureListener listener, int rate, boolean waveform, boolean fft)
Registers an OnDataCaptureListener interface and specifies the rate at which the capture should be updated as well as the type of capture requested.
int setEnabled(boolean enabled)
Enable or disable the visualization engine.
int setWindowFunction(int windowType)
Sets the window function type.
Protected Methods
void finalize()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.h6ah4i.android.media.IReleasable
From interface com.h6ah4i.android.media.audiofx.IHQVisualizer

Public Constructors

public OpenSLHQVisualizer (OpenSLMediaPlayerContext context)

Public Methods

public int getCaptureSize ()

Returns current capture size.

Returns
  • the capture size in frames.
Throws
IllegalStateException

public int[] getCaptureSizeRange ()

Returns the capture size range.

Returns
  • the minimum capture size is returned in first array element and the maximum in second array element.
Throws
IllegalStateException

public boolean getEnabled ()

Get current activation state of the visualizer.

Returns
  • true if the visualizer is active, false otherwise

public int getMaxCaptureRate ()

Returns the maximum capture rate for the callback capture method. This is the maximum value for the rate parameter of the setDataCaptureListener(OnDataCaptureListener, int, boolean, boolean) method.

Returns
  • the maximum capture rate expressed in milliHertz
Throws
IllegalStateException

public int getNumChannels ()

Returns the number of channels of the captured audio.

Returns
  • the number of channels.
Throws
IllegalStateException

public int getSamplingRate ()

Returns the sampling rate of the captured audio.

Returns
  • the sampling rate in milliHertz.
Throws
IllegalStateException

public int getWindowFunction ()

Returns current window function type.

Returns
  • current window function type.
Throws
IllegalStateException

public void release ()

Release associated resources.

public static int[] sGetCaptureSizeRange ()

public static int sGetMaxCaptureRate ()

public int setCaptureSize (int size)

Sets the capture size, i.e. the number of frames captured by OnDataCaptureListener event. The capture size must be a power of 2 in the range returned by getCaptureSizeRange(). This method must not be called when the Visualizer is enabled.

Parameters
size requested capture size
Returns
Throws
IllegalStateException

public int setDataCaptureListener (IHQVisualizer.OnDataCaptureListener listener, int rate, boolean waveform, boolean fft)

Registers an OnDataCaptureListener interface and specifies the rate at which the capture should be updated as well as the type of capture requested.

Call this method with a null listener to stop receiving the capture updates.

Parameters
listener OnDataCaptureListener registered
rate rate in milliHertz at which the capture should be updated
waveform true if a waveform capture is requested: the onWaveFormDataCapture() method will be called on the OnDataCaptureListener interface.
fft true if a frequency capture is requested: the onFftDataCapture() method will be called on the OnDataCaptureListener interface.
Returns

public int setEnabled (boolean enabled)

Enable or disable the visualization engine.

Parameters
enabled requested enable state
Returns
Throws
IllegalStateException

public int setWindowFunction (int windowType)

Sets the window function type.

Parameters
windowType window function type. One of the = 0, WINDOW_HANN, WINDOW_HAMMING, WINDOW_BLACKMAN, WINDOW_FLAT_TOP with optional WINDOW_OPT_APPLY_FOR_WAVEFORM flag.
Returns
Throws
IllegalStateException

Protected Methods

protected void finalize ()

Throws
Throwable