Struct sdl2::audio::AudioDevice

source ·
pub struct AudioDevice<CB: AudioCallback> { /* private fields */ }
Expand description

Wraps SDL_AudioDeviceID and owns the callback data used by the audio device.

Implementations

Opens a new audio device for playback (given the desired parameters and callback).

Opens a new audio device for capture (given the desired parameters and callback). Supported since SDL 2.0.5

Pauses playback of the audio device.

Starts playback of the audio device.

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.

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

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.