pub struct Device { /* private fields */ }
Expand description
Struct wrapping an IMMDevice.
Implementations§
Source§impl Device
impl Device
Sourcepub unsafe fn from_raw(device: IMMDevice, direction: Direction) -> Device
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.
Sourcepub fn from_immdevice(device: IMMDevice) -> Result<Device, WasapiError>
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.
Sourcepub fn get_iaudioclient(&self) -> Result<AudioClient, WasapiError>
pub fn get_iaudioclient(&self) -> Result<AudioClient, WasapiError>
Get an [IAudioClient] from an [IMMDevice]
Sourcepub fn get_state(&self) -> Result<DeviceState, WasapiError>
pub fn get_state(&self) -> Result<DeviceState, WasapiError>
Read state from an [IMMDevice]
Sourcepub fn get_friendlyname(&self) -> Result<String, WasapiError>
pub fn get_friendlyname(&self) -> Result<String, WasapiError>
Read the friendly name of the endpoint device (for example, “Speakers (XYZ Audio Adapter)”)
Sourcepub fn get_interface_friendlyname(&self) -> Result<String, WasapiError>
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”)
Sourcepub fn get_description(&self) -> Result<String, WasapiError>
pub fn get_description(&self) -> Result<String, WasapiError>
Read the device description of the endpoint device (for example, “Speakers”)
Sourcepub fn get_id(&self) -> Result<String, WasapiError>
pub fn get_id(&self) -> Result<String, WasapiError>
Get the Id of an [IMMDevice]
Sourcepub fn get_direction(&self) -> Direction
pub fn get_direction(&self) -> Direction
Get the direction for this Device