[−][src]Struct sdl2::audio::AudioDevice
Wraps SDL_AudioDeviceID
and owns the callback data used by the audio device.
Methods
impl<CB: AudioCallback> AudioDevice<CB>
[src]
pub fn open_playback<'a, F, D>(
a: &AudioSubsystem,
device: D,
spec: &AudioSpecDesired,
get_callback: F
) -> Result<AudioDevice<CB>, String> where
F: FnOnce(AudioSpec) -> CB,
D: Into<Option<&'a str>>,
[src]
a: &AudioSubsystem,
device: D,
spec: &AudioSpecDesired,
get_callback: F
) -> Result<AudioDevice<CB>, String> where
F: FnOnce(AudioSpec) -> CB,
D: Into<Option<&'a str>>,
Opens a new audio device for playback (given the desired parameters and callback).
pub fn open_capture<'a, F, D>(
a: &AudioSubsystem,
device: D,
spec: &AudioSpecDesired,
get_callback: F
) -> Result<AudioDevice<CB>, String> where
F: FnOnce(AudioSpec) -> CB,
D: Into<Option<&'a str>>,
[src]
a: &AudioSubsystem,
device: D,
spec: &AudioSpecDesired,
get_callback: F
) -> Result<AudioDevice<CB>, String> where
F: FnOnce(AudioSpec) -> CB,
D: Into<Option<&'a str>>,
Opens a new audio device for capture (given the desired parameters and callback). Supported since SDL 2.0.5
pub fn subsystem(&self) -> &AudioSubsystem
[src]
pub fn spec(&self) -> &AudioSpec
[src]
pub fn status(&self) -> AudioStatus
[src]
pub fn pause(&self)
[src]
Pauses playback of the audio device.
pub fn resume(&self)
[src]
Starts playback of the audio device.
pub fn lock(&mut self) -> AudioDeviceLockGuard<CB>
[src]
Locks the audio device using SDL_LockAudioDevice
.
When the returned lock guard is dropped, SDL_UnlockAudioDevice
is
called.
Use this method to read and mutate callback data.
pub fn close_and_get_callback(self) -> CB
[src]
Closes the audio device and saves the callback data from being dropped.
Note that simply dropping AudioDevice
will close the audio device,
but the callback data will be dropped.
Auto Trait Implementations
impl<CB> !Send for AudioDevice<CB>
impl<CB> !Sync for AudioDevice<CB>
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,