XT-Audio
Functions
XtDevice.h File Reference

Device queries and stream creation. More...

Go to the source code of this file.

Functions

void XtDeviceDestroy (XtDevice *d)
 Destroys an audio device. More...
 
void * XtDeviceGetHandle (XtDevice const *d)
 Implementation-defined handle to the backend device. More...
 
XtError XtDeviceShowControlPanel (XtDevice *d)
 Show the device specific control panel. More...
 
XtError XtDeviceGetMix (XtDevice const *d, XtBool *valid, XtMix *mix)
 Gets the device's current mix format. More...
 
XtError XtDeviceGetChannelCount (XtDevice const *d, XtBool output, int32_t *count)
 Gets the maximum number of channels supported by the device. More...
 
XtError XtDeviceSupportsAccess (XtDevice const *d, XtBool interleaved, XtBool *supports)
 Indicates whether the device supports the specified access mode. More...
 
XtError XtDeviceSupportsFormat (XtDevice const *d, const XtFormat *format, XtBool *supports)
 Indicates whether an audio format is supported by the device. More...
 
XtError XtDeviceGetBufferSize (XtDevice const *d, const XtFormat *format, XtBufferSize *size)
 Gets the buffer size limits supported by the device. More...
 
XtError XtDeviceOpenStream (XtDevice *d, XtDeviceStreamParams const *params, void *user, XtStream **stream)
 Opens an audio stream on the given device. More...
 
XtError XtDeviceGetChannelName (XtDevice const *d, XtBool output, int32_t index, char *buffer, int32_t *size)
 Gets the name of a specific input/output channel. More...
 

Detailed Description

Device queries and stream creation.

Contains functions to query audio devices for supported formats and buffer sizes, and opening audio streams.

Function Documentation

void XtDeviceDestroy ( XtDevice d)

Destroys an audio device.

Parameters
dthe audio device.

It is an error to destroy a device which still has open streams. It is ok to pass NULL.

This function may only be called from the main thread.

XtError XtDeviceGetBufferSize ( XtDevice const *  d,
const XtFormat format,
XtBufferSize size 
)

Gets the buffer size limits supported by the device.

Returns
0 on success, a nonzero error code otherwise.
Parameters
dthe audio device.
formatthe audio format to test buffer limits for.
sizeon success, buffer receives the buffer size limits for the given format.

The given format must be supported by the device, see XtDeviceSupportsFormat.

This function may only be called from the main thread.

See also
XtDeviceOpenStream
XtDeviceSupportsFormat
XtServiceAggregateStream
XtError XtDeviceGetChannelCount ( XtDevice const *  d,
XtBool  output,
int32_t *  count 
)

Gets the maximum number of channels supported by the device.

Returns
0 on success, a nonzero error code otherwise.
Parameters
dthe audio device.
outputtrue to query output channels, false to query input channels.
counton success, receives the maximum channel count.

The channel count represents the maximum number of channels representable by the current device. This value dictates the possible values of the audio format's channel masks only, it does not indicate that the device actually supports streams with the number of channels returned by this method.

This function may only be called from the main thread.

See also
XtFormat
XtDeviceGetChannelName
XtError XtDeviceGetChannelName ( XtDevice const *  d,
XtBool  output,
int32_t  index,
char *  buffer,
int32_t *  size 
)

Gets the name of a specific input/output channel.

Returns
0 on success, a nonzero error code otherwise.
Parameters
dthe audio device.
outputtrue for output channels, false for input channels.
indexthe channel index.
bufferthe string buffer to receive the channel name. If NULL, *size receives the required buffer size.
sizethe size of the buffer.

This function copies up to *size characters into *buffer, including the terminating null character.

This function may only be called from the main thread.

See also
XtDeviceGetChannelCount
void * XtDeviceGetHandle ( XtDevice const *  s)

Implementation-defined handle to the backend device.

ASIO: IASIO*
ALSA: NULL
JACK: jack_client_t*
WASAPI: IMMDevice*
PulseAudio: NULL
DirectSound: IDirectSound* / IDirectSoundCapture*

This function may be called from any thread.

See also
XtStreamGetHandle
XtError XtDeviceGetMix ( XtDevice const *  d,
XtBool valid,
XtMix mix 
)

Gets the device's current mix format.

Returns
0 on success, a nonzero error code otherwise.
Parameters
dthe audio device.
validon success, *valid will be true if the device's current mix format is known.
mixon success, and when the current mix format is known, receives the devices current mix format

It is NOT an error when a device has no current or default mix format. The mix format may be used as a starting point to query for supported audio formats (see XtDeviceSupportsFormat).

This function may only be called from the main thread.

See also
XtDeviceSupportsFormat
XtError XtDeviceOpenStream ( XtDevice d,
XtDeviceStreamParams const *  params,
void *  user,
XtStream **  stream 
)

Opens an audio stream on the given device.

Returns
0 on success, a nonzero error code otherwise.
Parameters
dthe audio device.
paramsthe stream parameters.
useruser data passed to the stream callbacks (may be NULL).
streamon success, receives a pointer to the opened audio stream. On error, *stream will be NULL.

The resulting stream must be closed using XtStreamDestroy. When the requested interleaving mode is not supported by the device it will be emulated.

This function may only be called from the main thread.

See also
XtStreamDestroy
XtDeviceSupportsFormat
XtDeviceSupportsAccess
XtServiceAggregateStream
XtError XtDeviceShowControlPanel ( XtDevice d)

Show the device specific control panel.

Returns
0 on success, a nonzero error code otherwise.
Parameters
dthe audio device.

The service must support the device control panel feature (XtServiceCapsControlPanel). This method is currently supported for ASIO devices only.

This function may only be called from the main thread.

See also
XtServiceCapsControlPanel
XtError XtDeviceSupportsAccess ( XtDevice const *  d,
XtBool  interleaved,
XtBool supports 
)

Indicates whether the device supports the specified access mode.

Returns
0 on success, a nonzero error code otherwise.
Parameters
dthe audio device.
interleavedthe desired access mode. True for interleaved, false for non-interleaved.
supportson success, indicates whether the access mode is supported.

When opening a stream using an access mode that is not supported by the device, the access mode will be emulated.

This function may only be called from the main thread.

See also
XtStreamParams
XtDeviceOpenStream
XtServiceAggregateStream
XtError XtDeviceSupportsFormat ( XtDevice const *  d,
const XtFormat format,
XtBool supports 
)

Indicates whether an audio format is supported by the device.

Returns
0 on success, a nonzero error code otherwise.
Parameters
dthe audio device.
formatthe audio format to test support for.
supportson success, indicates whether the format is supported.

This function may only be called from the main thread.

See also
XtDeviceOpenStream
XtDeviceGetBufferSize
XtServiceAggregateStream