[][src]Struct beryllium::AudioQueue

pub struct AudioQueue<'sdl> { /* fields omitted */ }

Handle to an audio device in "queue" mode, and info about its settings.

Methods

impl<'sdl> AudioQueue<'sdl>[src]

pub fn frequency(&self) -> i32[src]

Samples per second

pub fn format(&self) -> AudioFormat[src]

Sample data format

pub fn channels(&self) -> u8[src]

Channel count

pub fn silence(&self) -> u8[src]

Silence value

pub fn sample_count(&self) -> usize[src]

Samples in the buffer

pub fn buffer_size(&self) -> usize[src]

Size (in bytes) of the buffer

pub fn set_paused(&self, pause_on: bool)[src]

Sets the device into paused state or not.

pub fn queued_audio_size(&self) -> usize[src]

Gets the current number of bytes of queued audio.

NOTE: this seems to be a somewhat unreliable metric. When the queue runs low SDL2 seems to automatically re-queue some silence for you, but that silence time counts into the queue size. In other words, if you just leave the queue playing without pushing any new audio the queued byte size never hits 0. The queue size will go to 0 as expected if you clear it while playback it paused.

pub fn clear(&self)[src]

Clears any queued data that has not yet been sent to the sound card.

pub fn queue_audio(&self, data: &[u8]) -> Result<(), String>[src]

Pushes audio data into the queue.

The size of the queue has no particular limit, but you can't queue more than u32::MAX bytes at once.

Trait Implementations

impl<'sdl> Drop for AudioQueue<'sdl>[src]

impl<'sdl> Debug for AudioQueue<'sdl>[src]

Auto Trait Implementations

impl<'sdl> Unpin for AudioQueue<'sdl>

impl<'sdl> !Sync for AudioQueue<'sdl>

impl<'sdl> !Send for AudioQueue<'sdl>

impl<'sdl> UnwindSafe for AudioQueue<'sdl>

impl<'sdl> RefUnwindSafe for AudioQueue<'sdl>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]