#[repr(C)]pub struct SoundIoDevice {Show 19 fields
pub soundio: *mut SoundIo,
pub id: *mut c_char,
pub name: *mut c_char,
pub aim: SoundIoDeviceAim,
pub layouts: *mut SoundIoChannelLayout,
pub layout_count: c_int,
pub current_layout: SoundIoChannelLayout,
pub formats: *mut SoundIoFormat,
pub format_count: c_int,
pub current_format: SoundIoFormat,
pub sample_rates: *mut SoundIoSampleRateRange,
pub sample_rate_count: c_int,
pub sample_rate_current: c_int,
pub software_latency_min: f64,
pub software_latency_max: f64,
pub software_latency_current: f64,
pub is_raw: bool,
pub ref_count: c_int,
pub probe_error: c_int,
}Expand description
The size of this struct is not part of the API or ABI.
Fields§
§soundio: *mut SoundIoRead-only. Set automatically.
id: *mut c_charA 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.
name: *mut c_charUser-friendly UTF-8 encoded text to describe the device.
aim: SoundIoDeviceAimTells whether this device is an input device or an output device.
layouts: *mut SoundIoChannelLayoutChannel 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.
layout_count: c_int§current_layout: SoundIoChannelLayoutSee SoundIoDevice::current_format
formats: *mut SoundIoFormatList of formats this device supports. See also SoundIoDevice::current_format.
format_count: c_intHow many formats are available in SoundIoDevice::formats.
current_format: SoundIoFormatA 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.
sample_rates: *mut SoundIoSampleRateRangeSample 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.
sample_rate_count: c_intHow 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: c_intSee SoundIoDevice::current_format 0 if sample rate information is missing due to a probe error.
software_latency_min: f64Software 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.
software_latency_max: f64Software 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_current: f64Software 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
is_raw: boolRaw 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.
ref_count: c_intDevices are reference counted. See ::soundio_device_ref and ::soundio_device_unref.
probe_error: c_intThis 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.
Possible errors:
- #SoundIoErrorOpeningDevice
- #SoundIoErrorNoMem
Trait Implementations§
Source§impl Clone for SoundIoDevice
impl Clone for SoundIoDevice
Source§fn clone(&self) -> SoundIoDevice
fn clone(&self) -> SoundIoDevice
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more