AudioSubsystem

Struct AudioSubsystem 

Source
pub struct AudioSubsystem { /* private fields */ }

Implementations§

Source§

impl AudioSubsystem

Source

pub fn audio_playback_device_ids(&self) -> Result<Vec<AudioDeviceID>, Error>

Enumerate audio playback devices.

Source

pub fn audio_recording_device_ids(&self) -> Result<Vec<AudioDeviceID>, Error>

Enumerate audio recording devices.

Source

pub fn open_playback_device( &self, spec: &AudioSpec, ) -> Result<AudioDevice, Error>

Open a default playback device with the specified audio spec.

Source

pub fn open_recording_device( &self, spec: &AudioSpec, ) -> Result<AudioDevice, Error>

Open a default recording device with the specified audio spec.

Source

pub fn default_playback_device(&self) -> AudioDevice

Source

pub fn default_recording_device(&self) -> AudioDevice

Source

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,

Source

pub fn open_playback_stream<CB, Channel>( &self, spec: &AudioSpec, callback: CB, ) -> Result<AudioStreamWithCallback<CB>, Error>
where CB: AudioCallback<Channel>, Channel: AudioFormatNum + 'static,

Source

pub fn open_recording_stream<CB, Channel>( &self, spec: &AudioSpec, callback: CB, ) -> Result<AudioStreamWithCallback<CB>, Error>
where CB: AudioRecordingCallback<Channel>, Channel: AudioFormatNum + 'static,

Source

pub fn current_audio_driver(&self) -> &'static str

Source

pub fn audio_playback_device_name(&self, index: u32) -> Result<String, Error>

Source

pub fn audio_recording_device_name(&self, index: u32) -> Result<String, Error>

Source

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.

Source

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. If None, SDL will choose an appropriate format.
Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AudioSubsystem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for AudioSubsystem

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.