APIdia Launch Partner
Top Description Methods
com.badlogic.gdx.audio

public Interface AudioDevice

extends Disposable
Imports
com.badlogic.gdx.utils.Disposable

Encapsulates an audio device in mono or stereo mode. Use the writeSamples(float[], int, int) and writeSamples(short[], int, int) methods to write float or 16-bit signed short PCM data directly to the audio device. Stereo samples are interleaved in the order left channel sample, right channel sample. The dispose() method must be called when this AudioDevice is no longer needed.
Author
[email protected]

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Redeclares com.badlogic.gdx.utils.Disposable.dispose.

Frees all resources associated with this AudioDevice.

public int
getLatency()

Returns: the latency in samples.

public boolean
isMono()

Returns: whether this AudioDevice is in mono or stereo mode.

public void
pause()

Pauses the audio device if supported

public void
resume()

Unpauses the audio device if supported

public void
setVolume(float volume)

Sets the volume in the range [0,1].

public void
writeSamples(short[]
The samples.
samples
,
int
The offset into the samples array
offset
,
int
the number of samples to write to the device
numSamples
)

Writes the array of 16-bit signed PCM samples to the audio device and blocks until they have been processed.

public void
writeSamples(float[]
The samples.
samples
,
int
The offset into the samples array
offset
,
int
the number of samples to write to the device
numSamples
)

Writes the array of float PCM samples to the audio device and blocks until they have been processed.

Method Detail

disposeback to summary
public void dispose()

Redeclares com.badlogic.gdx.utils.Disposable.dispose.

Frees all resources associated with this AudioDevice. Needs to be called when the device is no longer needed.

getLatencyback to summary
public int getLatency()
Returns:int

the latency in samples.

isMonoback to summary
public boolean isMono()
Returns:boolean

whether this AudioDevice is in mono or stereo mode.

pauseback to summary
public void pause()

Pauses the audio device if supported

resumeback to summary
public void resume()

Unpauses the audio device if supported

setVolumeback to summary
public void setVolume(float volume)

Sets the volume in the range [0,1].

writeSamplesback to summary
public void writeSamples(short[] samples, int offset, int numSamples)

Writes the array of 16-bit signed PCM samples to the audio device and blocks until they have been processed.

Parameters
samples:short[]

The samples.

offset:int

The offset into the samples array

numSamples:int

the number of samples to write to the device

writeSamplesback to summary
public void writeSamples(float[] samples, int offset, int numSamples)

Writes the array of float PCM samples to the audio device and blocks until they have been processed.

Parameters
samples:float[]

The samples.

offset:int

The offset into the samples array

numSamples:int

the number of samples to write to the device