SoundIoDevice

Struct SoundIoDevice 

Source
#[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 SoundIo

Read-only. Set automatically.

§id: *mut c_char

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.

§name: *mut c_char

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

§aim: SoundIoDeviceAim

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

§layouts: *mut SoundIoChannelLayout

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.

§layout_count: c_int§current_layout: SoundIoChannelLayout

See SoundIoDevice::current_format

§formats: *mut SoundIoFormat

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

§format_count: c_int

How many formats are available in SoundIoDevice::formats.

§current_format: SoundIoFormat

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.

§sample_rates: *mut SoundIoSampleRateRange

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.

§sample_rate_count: c_int

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: c_int

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

§software_latency_min: f64

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.

§software_latency_max: f64

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_current: f64

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

§is_raw: bool

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.

§ref_count: c_int

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

§probe_error: c_int

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.

Possible errors:

  • #SoundIoErrorOpeningDevice
  • #SoundIoErrorNoMem

Trait Implementations§

Source§

impl Clone for SoundIoDevice

Source§

fn clone(&self) -> SoundIoDevice

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SoundIoDevice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for SoundIoDevice

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.