Top Description Methods
javafx.scene.media

public Interface AudioSpectrumListener


Audio spectrum callback interface. The observer receives periodic updates of the audio spectrum. A single observer may be attached to a given MediaPlayer using MediaPlayer#setAudioSpectrumListener.
Since
JavaFX 2.0
See Also
MediaPlayer

Method Summary

Modifier and TypeMethod and Description
public void
spectrumDataUpdate(double
timestamp of the event in seconds.
timestamp
,
double
duration for which the spectrum was computed in seconds.
duration
,
float[]
array containing the non-positive spectrum magnitude in decibels (dB) for each band. The size of the array equals the number of bands and should be considered to be read-only.
magnitudes
,
float[]
array containing the phase in the range [Math.PI, Math.PI] for each band. The size of the array equals the number of bands and should be considered to be read-only.
phases
)

Notifies the observer about new data available for the audio spectrum.

Method Detail

spectrumDataUpdateback to summary
public void spectrumDataUpdate(double timestamp, double duration, float[] magnitudes, float[] phases)

Notifies the observer about new data available for the audio spectrum.

The notification period for updates may be set using MediaPlayer#setAudioSpectrumInterval, and the number of bands and sensitivity threshold via MediaPlayer#setAudioSpectrumNumBands and MediaPlayer#setAudioSpectrumThreshold, respectively. The default values of the settings are an interval of 0.1 seconds, 128 bands, and sensitivity threshold -60.0 dB.

The arrays passed to the listener should be considered to be read-only as the underlying implementation may re-use them.

Parameters
timestamp:double

timestamp of the event in seconds.

duration:double

duration for which the spectrum was computed in seconds.

magnitudes:float[]

array containing the non-positive spectrum magnitude in decibels (dB) for each band. The size of the array equals the number of bands and should be considered to be read-only.

phases:float[]

array containing the phase in the range [Math.PI, Math.PI] for each band. The size of the array equals the number of bands and should be considered to be read-only.