pub struct AudioSubsystem { /* private fields */ }
Implementations§
Source§impl AudioSubsystem
impl AudioSubsystem
Sourcepub fn audio_playback_device_ids(&self) -> Result<Vec<AudioDeviceID>, Error>
pub fn audio_playback_device_ids(&self) -> Result<Vec<AudioDeviceID>, Error>
Enumerate audio playback devices.
Sourcepub fn audio_recording_device_ids(&self) -> Result<Vec<AudioDeviceID>, Error>
pub fn audio_recording_device_ids(&self) -> Result<Vec<AudioDeviceID>, Error>
Enumerate audio recording devices.
Sourcepub fn open_playback_device(
&self,
spec: &AudioSpec,
) -> Result<AudioDevice, Error>
pub fn open_playback_device( &self, spec: &AudioSpec, ) -> Result<AudioDevice, Error>
Open a default playback device with the specified audio spec.
Sourcepub fn open_recording_device(
&self,
spec: &AudioSpec,
) -> Result<AudioDevice, Error>
pub fn open_recording_device( &self, spec: &AudioSpec, ) -> Result<AudioDevice, Error>
Open a default recording device with the specified audio spec.
pub fn default_playback_device(&self) -> AudioDevice
pub fn default_recording_device(&self) -> AudioDevice
pub fn open_playback_stream_with_callback<CB, Channel>(
&self,
device: &AudioDevice,
spec: &AudioSpec,
callback: CB,
) -> Result<AudioStreamWithCallback<CB>, Error>where
CB: AudioCallback<Channel>,
Channel: AudioFormatNum + 'static,
pub fn open_playback_stream<CB, Channel>(
&self,
spec: &AudioSpec,
callback: CB,
) -> Result<AudioStreamWithCallback<CB>, Error>where
CB: AudioCallback<Channel>,
Channel: AudioFormatNum + 'static,
pub fn open_recording_stream<CB, Channel>(
&self,
spec: &AudioSpec,
callback: CB,
) -> Result<AudioStreamWithCallback<CB>, Error>where
CB: AudioRecordingCallback<Channel>,
Channel: AudioFormatNum + 'static,
pub fn current_audio_driver(&self) -> &'static str
pub fn audio_playback_device_name(&self, index: u32) -> Result<String, Error>
pub fn audio_recording_device_name(&self, index: u32) -> Result<String, Error>
Sourcepub fn new_stream(
&self,
src_spec: Option<&AudioSpec>,
dst_spec: Option<&AudioSpec>,
) -> Result<AudioStreamOwner, Error>
pub fn new_stream( &self, src_spec: Option<&AudioSpec>, dst_spec: Option<&AudioSpec>, ) -> Result<AudioStreamOwner, Error>
Creates a new audio stream that converts audio data from the source format (src_spec
)
to the destination format (dst_spec
).
§Arguments
src_spec
- The format details of the input audio.dst_spec
- The format details of the output audio.
§Returns
Returns Ok(AudioStream)
on success or an error message on failure.
§Safety
This function is safe to call from any thread.
Sourcepub fn new_playback_stream(
&self,
app_spec: &AudioSpec,
device_spec: Option<&AudioSpec>,
) -> Result<AudioStreamOwner, Error>
pub fn new_playback_stream( &self, app_spec: &AudioSpec, device_spec: Option<&AudioSpec>, ) -> Result<AudioStreamOwner, Error>
Creates a new audio stream for playback.
§Arguments
app_spec
- The format of audio data the application will provide.device_spec
- The format of audio data the audio device expects. IfNone
, SDL will choose an appropriate format.
Sourcepub fn new_recording_stream(
&self,
device_spec: Option<&AudioSpec>,
app_spec: &AudioSpec,
) -> Result<AudioStreamOwner, Error>
pub fn new_recording_stream( &self, device_spec: Option<&AudioSpec>, app_spec: &AudioSpec, ) -> Result<AudioStreamOwner, Error>
Creates a new audio stream for recording.
§Arguments
device_spec
- The format of audio data the audio device provides. IfNone
, SDL will choose an appropriate format.app_spec
- The format of audio data the application wants to receive.
Trait Implementations§
Source§impl Clone for AudioSubsystem
impl Clone for AudioSubsystem
Source§impl Debug for AudioSubsystem
impl Debug for AudioSubsystem
Auto Trait Implementations§
impl Freeze for AudioSubsystem
impl RefUnwindSafe for AudioSubsystem
impl !Send for AudioSubsystem
impl !Sync for AudioSubsystem
impl Unpin for AudioSubsystem
impl UnwindSafe for AudioSubsystem
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