pub struct Device { /* private fields */ }Expand description
An abstraction over cpal::Device, represents a physical output device
Implementations§
Source§impl Device
impl Device
Sourcepub fn play_default_output(
player: &mut impl SamplesPlayerTrait,
) -> Result<(), PlayError>
pub fn play_default_output( player: &mut impl SamplesPlayerTrait, ) -> Result<(), PlayError>
Plays the samples on the default device of the default host
Sourcepub fn create_stream<T: Sample>(
&self,
metadata: &impl AudioMetadataTrait,
samples: Arc<Mutex<Samples<T>>>,
) -> Result<Stream, PlayError>
pub fn create_stream<T: Sample>( &self, metadata: &impl AudioMetadataTrait, samples: Arc<Mutex<Samples<T>>>, ) -> Result<Stream, PlayError>
Creates a stream that will play the metadata based on the metadata given
Sourcepub fn play<T: Sample>(
self,
player: &mut impl SamplesPlayerTrait,
) -> Result<(), PlayError>
pub fn play<T: Sample>( self, player: &mut impl SamplesPlayerTrait, ) -> Result<(), PlayError>
Plays the samples in the SamplesPlayer on this device
Sourcepub fn default_output() -> Option<Device>
pub fn default_output() -> Option<Device>
Returns the default output device of the default host. Be aware that there may be none
Sourcepub fn list_device_names() -> Vec<String>
pub fn list_device_names() -> Vec<String>
Gives the name of all devices on all hosts
Sourcepub fn new_from_name(device_name: &str) -> Option<Device>
pub fn new_from_name(device_name: &str) -> Option<Device>
Creates a new device from its device name
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more