Device

Struct Device 

Source
pub struct Device { /* private fields */ }
Expand description

Struct wrapping an IMMDevice.

Implementations§

Source§

impl Device

Source

pub unsafe fn from_raw(device: IMMDevice, direction: Direction) -> Device

Build a Device from a supplied [IMMDevice] and Direction

§Safety

The caller must ensure that the [IMMDevice]’s data flow direction is the same as the Direction supplied to the function.

Use Device::from_immdevice, which queries the endpoint, for safe construction.

Source

pub fn from_immdevice(device: IMMDevice) -> Result<Device, WasapiError>

Attempts to build a Device from a supplied [IMMDevice], querying the endpoint for its data flow direction.

Source

pub fn get_iaudioclient(&self) -> Result<AudioClient, WasapiError>

Get an [IAudioClient] from an [IMMDevice]

Source

pub fn get_iaudiosessionmanager( &self, ) -> Result<AudioSessionManager, WasapiError>

Gets an [IAudioSessionManager] from an [IMMDevice]

Source

pub fn get_state(&self) -> Result<DeviceState, WasapiError>

Read state from an [IMMDevice]

Source

pub fn get_friendlyname(&self) -> Result<String, WasapiError>

Read the friendly name of the endpoint device (for example, “Speakers (XYZ Audio Adapter)”)

Source

pub fn get_interface_friendlyname(&self) -> Result<String, WasapiError>

Read the friendly name of the audio adapter to which the endpoint device is attached (for example, “XYZ Audio Adapter”)

Source

pub fn get_description(&self) -> Result<String, WasapiError>

Read the device description of the endpoint device (for example, “Speakers”)

Source

pub fn get_device_format(&self) -> Result<WaveFormat, WasapiError>

Read the device format of the endpoint device, which is the format that the user has selected for the stream that flows between the audio engine and the audio endpoint device when the device operates in shared mode.

Source

pub fn get_id(&self) -> Result<String, WasapiError>

Get the Id of an [IMMDevice]

Source

pub fn get_direction(&self) -> Direction

Get the direction for this Device

Auto Trait Implementations§

§

impl Freeze for Device

§

impl RefUnwindSafe for Device

§

impl !Send for Device

§

impl !Sync for Device

§

impl Unpin for Device

§

impl UnwindSafe for Device

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> 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, 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.