XT-Audio
Functions
XtService.h File Reference

Service queries and device creation. More...

Go to the source code of this file.

Functions

XtServiceCaps XtServiceGetCapabilities (XtService const *s)
 Get service capabilities. More...
 
XtError XtServiceOpenDevice (XtService const *s, char const *id, XtDevice **device)
 Open an audio device. More...
 
XtError XtServiceOpenDeviceList (XtService const *s, XtEnumFlags flags, XtDeviceList **list)
 Enumerate available devices. More...
 
XtError XtServiceGetDefaultDeviceId (XtService const *s, XtBool output, XtBool *valid, char *buffer, int32_t *size)
 Get default device id. More...
 
XtError XtServiceAggregateStream (XtService const *s, XtAggregateStreamParams const *params, void *user, XtStream **stream)
 Combines multiple audio devices into a single stream. More...
 

Detailed Description

Service queries and device creation.

Contains functions to query service capabilities and open devices.

Function Documentation

XtError XtServiceAggregateStream ( XtService const *  s,
XtAggregateStreamParams const *  params,
void *  user,
XtStream **  stream 
)

Combines multiple audio devices into a single stream.

Returns
0 on success, a nonzero error code otherwise.
Parameters
sthe audio service.
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.

Each underlying stream is opened using the combination of the shared mix format and the device-specific channel specification as the audio format.

Aggregate streams use an intermediate buffer to keep underlying streams in sync. The total latency overhead of the aggregate stream is bounded by the largest buffer size of any of the underlying streams times a constant factor.

Use XtDeviceGetBufferSize to query supported buffer sizes. The resulting stream must be closed using XtStreamDestroy.

When the requested interleaving mode is not supported by any device it will be emulated.

The service must support stream aggregation (XtServiceCapsAggregation).

This function may only be called from the main thread.

See also
XtStreamDestroy
XtDeviceOpenStream
XtDeviceSupportsFormat
XtDeviceSupportsAccess
XtServiceCapsAggregation
XtServiceCaps XtServiceGetCapabilities ( XtService const *  s)

Get service capabilities.

Returns
the capabilities for the given service.
Parameters
sthe audio service.

This function may be called from any thread.

See also
XtFormat
XtBuffer
XtStreamGetLatency
XtServiceAggregateStream
XtDeviceShowControlPanel
XtOnXRun
XtError XtServiceGetDefaultDeviceId ( XtService const *  s,
XtBool  output,
XtBool valid,
char *  buffer,
int32_t *  size 
)

Get default device id.

Returns
0 on success, a nonzero error code otherwise.
Parameters
sthe audio service.
outputXtTrue for default output device, XtFalse for default input device
validon success, *valid will be true if a default device is present
bufferthe string buffer to receive the device id. If NULL, *size receives the required buffer size.
sizethe size of the buffer.

It is NOT an error when no default device is present.

See also
XtDeviceListGetId
XtServiceOpenDevice
XtError XtServiceOpenDevice ( XtService const *  s,
char const *  id,
XtDevice **  device 
)

Open an audio device.

Returns
0 on success, a nonzero error code otherwise.
Parameters
sthe audio service.
idthe device id.
deviceon success, receives a pointer to the opened device. On error, *device is set to NULL.

Use XtDeviceDestroy to clean up the device.

This function may only be called from the main thread.

See also
XtDeviceDestroy
XtDeviceListGetId
XtServiceGetDefaultDeviceId
XtError XtServiceOpenDeviceList ( XtService const *  s,
XtEnumFlags  flags,
XtDeviceList **  list 
)

Enumerate available devices.

Returns
0 on success, a nonzero error code otherwise.
Parameters
sthe audio service.
flagsspecifies whether to enumerate input, output or all devices.
liston success, receives a pointer to the opened device list. On error, *list is set to NULL.

Use XtDeviceListDestroy to clean up the device list.

This function may only be called from the main thread.

See also
XtDeviceListDestroy
XtDeviceListGetId
XtDeviceListGetCount
XtServiceGetDefaultDeviceId
XtServiceOpenDevice