com.h6ah4i.android.media.audiofx.IVisualizer |
Known Indirect Subclasses |
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class | IVisualizer.MeasurementPeakRms | A class to store peak and RMS values. | |||||||||
interface | IVisualizer.OnDataCaptureListener | The OnDataCaptureListener interface defines methods called by the Visualizer to periodically update the audio visualization capture. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ALREADY_EXISTS | Internal operation status. | |||||||||
int | ERROR | Unspecified error. | |||||||||
int | ERROR_BAD_VALUE | Operation failed due to bad parameter value. | |||||||||
int | ERROR_DEAD_OBJECT | Operation failed due to dead remote object. | |||||||||
int | ERROR_INVALID_OPERATION | Operation failed because it was requested in wrong state. | |||||||||
int | ERROR_NO_INIT | Operation failed due to bad object initialization. | |||||||||
int | ERROR_NO_MEMORY | Operation failed due to lack of memory. | |||||||||
int | MEASUREMENT_MODE_NONE | Defines a measurement mode in which no measurements are performed. | |||||||||
int | MEASUREMENT_MODE_PEAK_RMS | Defines a measurement mode which computes the peak and RMS value in mB, where 0mB is the maximum sample value, and -9600mB is the minimum value. | |||||||||
int | SCALING_MODE_AS_PLAYED | Defines a capture mode where the playback volume will affect (scale) the range of the captured data. | |||||||||
int | SCALING_MODE_NORMALIZED | Defines a capture mode where amplification is applied based on the content of the captured data. | |||||||||
int | STATE_ENABLED | State of a Visualizer object that is active. | |||||||||
int | STATE_INITIALIZED | State of a Visualizer object that is ready to be used. | |||||||||
int | STATE_UNINITIALIZED | State of a Visualizer object that was not successfully initialized upon creation | |||||||||
int | SUCCESS | Successful operation. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract int |
getCaptureSize()
Returns current capture size.
| ||||||||||
abstract int[] |
getCaptureSizeRange()
Returns the capture size range.
| ||||||||||
abstract boolean |
getEnabled()
Get current activation state of the visualizer.
| ||||||||||
abstract int |
getFft(byte[] fft)
Returns a frequency capture of currently playing audio content.
| ||||||||||
abstract int |
getMaxCaptureRate()
Returns the maximum capture rate for the callback capture method.
| ||||||||||
abstract int |
getMeasurementMode()
Returns the current measurement modes performed by this audio effect
| ||||||||||
abstract int |
getMeasurementPeakRms(IVisualizer.MeasurementPeakRms measurement)
Retrieves the latest peak and RMS measurement.
| ||||||||||
abstract int |
getSamplingRate()
Returns the sampling rate of the captured audio.
| ||||||||||
abstract int |
getScalingMode()
Returns the current scaling mode on the captured visualization data.
| ||||||||||
abstract int |
getWaveForm(byte[] waveform)
Returns a waveform capture of currently playing audio content.
| ||||||||||
abstract int |
setCaptureSize(int size)
Sets the capture size, i.e.
| ||||||||||
abstract int |
setDataCaptureListener(IVisualizer.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.
| ||||||||||
abstract int |
setEnabled(boolean enabled)
Enable or disable the visualization engine.
| ||||||||||
abstract int |
setMeasurementMode(int mode)
Sets the combination of measurement modes to be performed by this audio
effect.
| ||||||||||
abstract int |
setScalingMode(int mode)
Set the type of scaling applied on the captured visualization data.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.h6ah4i.android.media.IReleasable
|
Internal operation status. Not returned by any method.
Unspecified error.
Operation failed due to bad parameter value.
Operation failed due to dead remote object.
Operation failed because it was requested in wrong state.
Operation failed due to bad object initialization.
Operation failed due to lack of memory.
Defines a measurement mode in which no measurements are performed.
Defines a measurement mode which computes the peak and RMS value in mB,
where 0mB is the maximum sample value, and -9600mB is the minimum value.
Values for peak and RMS can be retrieved with
getMeasurementPeakRms(MeasurementPeakRms)
.
Defines a capture mode where the playback volume will affect (scale) the range of the captured data. A low playback volume will lead to low sample and fft values, and vice-versa.
Defines a capture mode where amplification is applied based on the content of the captured data. This is the default Visualizer mode, and is suitable for music visualization.
State of a Visualizer object that is active.
State of a Visualizer object that is ready to be used.
State of a Visualizer object that was not successfully initialized upon creation
Successful operation.
Returns current capture size.
IllegalStateException |
---|
Returns the capture size range.
IllegalStateException |
---|
Get current activation state of the visualizer.
Returns a frequency capture of currently playing audio content.
This method must be called when the Visualizer is enabled.
The capture is an 8-bit magnitude FFT, the frequency range covered being
0 (DC) to half of the sampling rate returned by
getSamplingRate()
. The capture returns the real and imaginary
parts of a number of frequency points equal to half of the capture size
plus one.
Note: only the real part is returned for the first point (DC) and the last point (sampling frequency / 2).
The layout in the returned byte array is as follows:
Index | 0 | 1 | 2 | 3 | 4 | 5 | ... | n - 2 | n - 1 |
Data | Rf0 | Rf(n/2) | Rf1 | If1 | Rf2 | If2 | ... | Rf(n-1)/2 | If(n-1)/2 |
fft | array of bytes where the FFT should be returned |
---|
SUCCESS
in case of success, ERROR_NO_MEMORY
,
ERROR_INVALID_OPERATION
or ERROR_DEAD_OBJECT
in
case of failure.IllegalStateException |
---|
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.
IllegalStateException |
---|
Returns the current measurement modes performed by this audio effect
MEASUREMENT_MODE_NONE
(when no measurements are performed) or
MEASUREMENT_MODE_PEAK_RMS
.IllegalStateException |
---|
Retrieves the latest peak and RMS measurement. Sets the peak and RMS
fields of the supplied IVisualizer.MeasurementPeakRms
to the
latest measured values.
measurement | a non-null IVisualizer.MeasurementPeakRms
instance to store the measurement values. |
---|
SUCCESS
in case of success, ERROR_BAD_VALUE
,
ERROR_NO_MEMORY
, ERROR_INVALID_OPERATION
or
ERROR_DEAD_OBJECT
in case of failure.
Returns the sampling rate of the captured audio.
IllegalStateException |
---|
Returns the current scaling mode on the captured visualization data.
SCALING_MODE_NORMALIZED
and
SCALING_MODE_AS_PLAYED
.IllegalStateException |
---|
Returns a waveform capture of currently playing audio content. The
capture consists in a number of consecutive 8-bit (unsigned) mono PCM
samples equal to the capture size returned by getCaptureSize()
.
This method must be called when the Visualizer is enabled.
waveform | array of bytes where the waveform should be returned |
---|
SUCCESS
in case of success, ERROR_NO_MEMORY
,
ERROR_INVALID_OPERATION
or ERROR_DEAD_OBJECT
in
case of failure.IllegalStateException |
---|
Sets the capture size, i.e. the number of bytes returned by
getWaveForm(byte[])
and getFft(byte[])
methods. 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.
size | requested capture size |
---|
SUCCESS
in case of success, ERROR_BAD_VALUE
in
case of failure.IllegalStateException |
---|
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.
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. |
SUCCESS
in case of success, ERROR_NO_INIT
or
ERROR_BAD_VALUE
in case of failure.
Enable or disable the visualization engine.
enabled | requested enable state |
---|
SUCCESS
in case of success,
ERROR_INVALID_OPERATION
or ERROR_DEAD_OBJECT
in
case of failure.IllegalStateException |
---|
Sets the combination of measurement modes to be performed by this audio effect.
mode | a mask of the measurements to perform. The valid values are
MEASUREMENT_MODE_NONE (to cancel any measurement) or
MEASUREMENT_MODE_PEAK_RMS . |
---|
SUCCESS
in case of success, ERROR_BAD_VALUE
in
case of failure.IllegalStateException |
---|
Set the type of scaling applied on the captured visualization data.
mode | see SCALING_MODE_NORMALIZED and
SCALING_MODE_AS_PLAYED |
---|
SUCCESS
in case of success, ERROR_BAD_VALUE
in
case of failure.IllegalStateException |
---|