SoundIoDevice

The size of this struct is not part of the API or ABI.

Members

Variables

aim
SoundIoDeviceAim aim;

Tells whether this device is an input device or an output device.

current_format
SoundIoFormat current_format;

A device is either a raw device or it is a virtual device that is provided by a software mixing service such as dmix or PulseAudio (see SoundIoDevice::is_raw). If it is a raw device, current_format is meaningless; the device has no current format until you open it. On the other hand, if it is a virtual device, current_format describes the destination sample format that your audio will be converted to. Or, if you're the lucky first application to open the device, you might cause the current_format to change to your format. Generally, you want to ignore current_format and use whatever format is most convenient for you which is supported by the device, because when you are the only application left, the mixer might decide to switch current_format to yours. You can learn the supported formats via formats and SoundIoDevice::format_count. If this information is missing due to a probe error, formats will be NULL. If current_format is unavailable, it will be set to #SoundIoFormatInvalid. Devices are guaranteed to have at least 1 format available.

current_layout
SoundIoChannelLayout current_layout;

See SoundIoDevice::current_format

format_count
int format_count;

How many formats are available in SoundIoDevice::formats.

formats
SoundIoFormat* formats;

List of formats this device supports. See also SoundIoDevice::current_format.

id
char* id;

A string of bytes that uniquely identifies this device. If the same physical device supports both input and output, that makes one SoundIoDevice for the input and one SoundIoDevice for the output. In this case, the id of each SoundIoDevice will be the same, and SoundIoDevice::aim will be different. Additionally, if the device supports raw mode, there may be up to four devices with the same id: one for each value of SoundIoDevice::is_raw and one for each value of SoundIoDevice::aim.

is_raw
bool is_raw;

Raw means that you are directly opening the hardware device and not going through a proxy such as dmix, PulseAudio, or JACK. When you open a raw device, other applications on the computer are not able to simultaneously access the device. Raw devices do not perform automatic resampling and thus tend to have fewer formats available.

layout_count
int layout_count;
Undocumented in source.
layouts
SoundIoChannelLayout* layouts;

Channel layouts are handled similarly to SoundIoDevice::formats. If this information is missing due to a SoundIoDevice::probe_error, layouts will be NULL. It's OK to modify this data, for example calling ::soundio_sort_channel_layouts on it. Devices are guaranteed to have at least 1 channel layout.

name
char* name;

User-friendly UTF-8 encoded text to describe the device.

probe_error
int probe_error;

This is set to a SoundIoError representing the result of the device probe. Ideally this will be SoundIoErrorNone in which case all the fields of the device will be populated. If there is an error code here then information about formats, sample rates, and channel layouts might be missing.

ref_count
int ref_count;

Devices are reference counted. See ::soundio_device_ref and ::soundio_device_unref.

sample_rate_count
int sample_rate_count;

How many sample rate ranges are available in SoundIoDevice::sample_rates. 0 if sample rate information is missing due to a probe error.

sample_rate_current
int sample_rate_current;

See SoundIoDevice::current_format 0 if sample rate information is missing due to a probe error.

sample_rates
SoundIoSampleRateRange* sample_rates;

Sample rate is the number of frames per second. Sample rate is handled very similar to SoundIoDevice::formats. If sample rate information is missing due to a probe error, the field will be set to NULL. Devices which have SoundIoDevice::probe_error set to #SoundIoErrorNone are guaranteed to have at least 1 sample rate available.

software_latency_current
double software_latency_current;

Software latency in seconds. If this value is unknown or irrelevant, it is set to 0.0. For PulseAudio and WASAPI this value is unknown until you open a stream. See SoundIoDevice::current_format

software_latency_max
double software_latency_max;

Software latency maximum in seconds. If this value is unknown or irrelevant, it is set to 0.0. For PulseAudio and WASAPI this value is unknown until you open a stream.

software_latency_min
double software_latency_min;

Software latency minimum in seconds. If this value is unknown or irrelevant, it is set to 0.0. For PulseAudio and WASAPI this value is unknown until you open a stream.

soundio
SoundIo* soundio;

Read-only. Set automatically.

Meta