SoundStream

Trait SoundStream 

Source
pub trait SoundStream: Send {
    // Required methods
    fn get_data(&mut self) -> (&[i16], bool);
    fn seek(&mut self, offset: Time);
    fn channel_count(&self) -> u32;
    fn sample_rate(&self) -> u32;
}
Expand description

Trait for streamed audio sources.

The implementor must be able to be sent to another thread, so it must implement Send.

Required Methods§

Source

fn get_data(&mut self) -> (&[i16], bool)

Request a new chunk of audio samples from the stream source.

Returns (chunk, keep_playing), where chunk is the chunk of audio samples, and keep_playing tells the streaming loop whether to keep playing or to stop.

Source

fn seek(&mut self, offset: Time)

Change the current playing position in the stream source.

Source

fn channel_count(&self) -> u32

Return the number of channels of the stream.

Source

fn sample_rate(&self) -> u32

Get the stream sample rate of the stream.

Implementors§