XT-Audio
Functions
XtStream.h File Reference

Stream queries and operation. More...

Go to the source code of this file.

Functions

void XtStreamStop (XtStream *s)
 Stops an audio stream. More...
 
XtError XtStreamStart (XtStream *s)
 Starts an audio stream. More...
 
void XtStreamDestroy (XtStream *s)
 Destroys an audio stream. More...
 
void * XtStreamGetHandle (XtStream const *s)
 Implementation-defined handle to the backend stream. More...
 
XtBool XtStreamIsRunning (XtStream const *s)
 Query stream state. More...
 
const XtFormatXtStreamGetFormat (XtStream const *s)
 Get stream format. More...
 
XtBool XtStreamIsInterleaved (XtStream const *s)
 Get stream interleaved mode. More...
 
XtError XtStreamGetFrames (XtStream const *s, int32_t *frames)
 Get maximum stream buffer size. More...
 
XtError XtStreamGetLatency (XtStream const *s, XtLatency *latency)
 Get the end-to-end latency, if supported by the system. More...
 

Detailed Description

Stream queries and operation.

Contains functions to control (start/stop) audio streams and querying running audio streams for buffer size and latencies.

Function Documentation

void XtStreamDestroy ( XtStream s)

Destroys an audio stream.

Parameters
sthe audio stream.

It is ok to pass NULL. Stream should be stopped before it is destroyed.

This function may only be called from the main thread.

XtFormat const * XtStreamGetFormat ( XtStream const *  s)

Get stream format.

Returns
the audio format used to open the stream.
Parameters
sthe audio stream

Note: for aggregate streams this format will contain the total number of input and output channels passed to XtServiceAggregateStream. Channel masks for aggregate streams will always be 0.

This function may be called from any thread.

See also
XtDeviceOpenStream
XtServiceAggregateStream
XtError XtStreamGetFrames ( XtStream const *  s,
int32_t *  frames 
)

Get maximum stream buffer size.

Returns
The maximum buffer size for the given stream.
Parameters
sthe audio stream.
frameson success, reveices the stream buffer size in frames.

This value is constant for the lifetime of the stream. It may be used to pre-allocate any intermediate buffers the application may need.

This function may be called from any thread (to allow invocation from the stream callback).

void * XtStreamGetHandle ( XtStream const *  s)

Implementation-defined handle to the backend stream.

ASIO: IASIO*
ALSA: snd_pcm_t*
JACK: jack_client_t*
WASAPI: IAudioClient*
PulseAudio: pa_simple*
DirectSound: IDirectSoundBuffer* / IDirectSoundCaptureBuffer*

This function may be called from any thread.

See also
XtDeviceGetHandle
XtError XtStreamGetLatency ( XtStream const *  s,
XtLatency latency 
)

Get the end-to-end latency, if supported by the system.

Returns
The current latencies for the given stream.
Parameters
sthe audio stream.
latencyon success, receives the current input/output latency in milliseconds. When the service does not support latency information, latency->input and latency->output will be 0.

This value may change during the lifetime of the stream. For aggregate streams, the maximum input and output latencies of any underlying stream, plus the latency of the aggregation buffer is reported. When any of the underlying streams does not support latency info, the latency of the entire aggregated stream is reported as unknown.

This function may be called from any thread (to allow invocation from the stream callback).

See also
XtServiceGetCapabilities
XtBool XtStreamIsInterleaved ( XtStream const *  s)

Get stream interleaved mode.

This function may be called from any thread.

See also
XtDeviceOpenStream
XtServiceAggregateStream
XtBool XtStreamIsRunning ( XtStream const *  s)

Query stream state.

This function may be called from any thread.

See also
XtOnRunning
XtStreamStart
XtStreamStop
XtError XtStreamStart ( XtStream s)

Starts an audio stream.

Returns
0 on success, a nonzero error code otherwise.
Parameters
sthe audio stream.

When the stream is running the application-defined stream callback will be invoked whenever audio data is needed or available.

This function may only be called from the main thread.

See also
XtStreamStop
XtOnRunning
XtStreamIsRunning
XtError XtStreamStop ( XtStream s)

Stops an audio stream.

Returns
0 on success, a nonzero error code otherwise.
Parameters
sthe audio stream.

This function may only be called from the main thread.

See also
XtStreamStart
XtOnRunning
XtStreamIsRunning