pub struct AudioDevice { /* private fields */ }
Expand description
Represents an open audio device (playback or recording).
Implementations§
Source§impl AudioDevice
impl AudioDevice
pub fn id(&self) -> AudioDeviceID
pub fn new(device_id: AudioDeviceID, audio_subsystem: AudioSubsystem) -> Self
Sourcepub fn open_device_stream(
self,
spec: Option<&AudioSpec>,
) -> Result<AudioStreamOwner, Error>
pub fn open_device_stream( self, spec: Option<&AudioSpec>, ) -> Result<AudioStreamOwner, Error>
Create an AudioStream
for this device with the specified spec.
This device will be closed when the stream is dropped.
The device begins paused, so you must call stream.resume()
to start playback.
Sourcepub fn bind_stream(&self, stream: &AudioStream) -> Result<(), Error>
pub fn bind_stream(&self, stream: &AudioStream) -> Result<(), Error>
Binds an audio stream to this device.
Sourcepub fn bind_streams(&self, streams: &[&AudioStream]) -> Result<(), Error>
pub fn bind_streams(&self, streams: &[&AudioStream]) -> Result<(), Error>
Binds multiple audio streams to this device.
Sourcepub fn open_playback<'a, D>(
_a: &AudioSubsystem,
device: D,
spec: &AudioSpec,
) -> Result<AudioDevice, Error>
pub fn open_playback<'a, D>( _a: &AudioSubsystem, device: D, spec: &AudioSpec, ) -> Result<AudioDevice, Error>
Opens a new audio device for playback (given the desired parameters).
Sourcepub fn open_recording<'a, D>(
_a: &AudioSubsystem,
device: D,
spec: &AudioSpec,
) -> Result<AudioDevice, Error>
pub fn open_recording<'a, D>( _a: &AudioSubsystem, device: D, spec: &AudioSpec, ) -> Result<AudioDevice, Error>
Opens a new audio device for recording (given the desired parameters).
Sourcepub fn open_playback_stream_with_callback<CB, Channel>(
&self,
spec: &AudioSpec,
callback: CB,
) -> Result<AudioStreamWithCallback<CB>, Error>where
CB: AudioCallback<Channel>,
Channel: AudioFormatNum + 'static,
pub fn open_playback_stream_with_callback<CB, Channel>(
&self,
spec: &AudioSpec,
callback: CB,
) -> Result<AudioStreamWithCallback<CB>, Error>where
CB: AudioCallback<Channel>,
Channel: AudioFormatNum + 'static,
Opens a new audio stream for this device with the specified spec.
The device begins paused, so you must call stream.resume()
to start playback.
Sourcepub fn open_recording_stream_with_callback<CB, Channel>(
&self,
spec: &AudioSpec,
callback: CB,
) -> Result<AudioStreamWithCallback<CB>, Error>where
CB: AudioRecordingCallback<Channel>,
Channel: AudioFormatNum + 'static,
pub fn open_recording_stream_with_callback<CB, Channel>(
&self,
spec: &AudioSpec,
callback: CB,
) -> Result<AudioStreamWithCallback<CB>, Error>where
CB: AudioRecordingCallback<Channel>,
Channel: AudioFormatNum + 'static,
Opens a new audio stream for recording with the specified spec.
The device begins paused, so you must call stream.resume()
to start recording.
Trait Implementations§
Source§impl Clone for AudioDevice
impl Clone for AudioDevice
Source§fn clone(&self) -> AudioDevice
fn clone(&self) -> AudioDevice
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more