Struct sdl2::audio::AudioDevice
[−]
[src]
pub struct AudioDevice<CB: AudioCallback> { /* fields omitted */ }
Wraps SDL_AudioDeviceID and owns the callback data used by the audio device.
Methods
impl<CB: AudioCallback> AudioDevice<CB>
[src]
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>>,
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 given the desired parameters and callback.
fn subsystem(&self) -> &AudioSubsystem
fn spec(&self) -> &AudioSpec
fn status(&self) -> AudioStatus
fn pause(&self)
Pauses playback of the audio device.
fn resume(&self)
Starts playback of the audio device.
fn lock<'a>(&'a mut self) -> AudioDeviceLockGuard<'a, CB>
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.
fn close_and_get_callback(self) -> CB
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.