Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public interface AudioOutputPeer

A platform audio output stream that pulls samples from an AudioRenderCallback. Ports implement this and return it from CodenameOneImplementation.openAudioOutput; applications use AudioContext instead.

Methods

public abstract void start()Starts, or resumes, calling the render callback.
public abstract void stop()Pauses the stream; the render callback is not called until start().
public abstract void close()Stops the stream for good and releases the device.
public abstract int getSampleRate()The sample rate the device actually runs at, which may differ from the one requested.
public abstract int getChannels()The number of interleaved channels passed to the render callback.
public abstract double getOutputLatency()The time between a sample being rendered and it being heard, as well as the port can tell.

Method details

start

public abstract void start()
Starts, or resumes, calling the render callback.

stop

public abstract void stop()
Pauses the stream; the render callback is not called until start().

close

public abstract void close()
Stops the stream for good and releases the device.

getSampleRate

public abstract int getSampleRate()
The sample rate the device actually runs at, which may differ from the one requested.

Returns

frames per second

getChannels

public abstract int getChannels()
The number of interleaved channels passed to the render callback.

Returns

the channel count

getOutputLatency

public abstract double getOutputLatency()
The time between a sample being rendered and it being heard, as well as the port can tell.

Returns

the latency in seconds, or 0 when unknown