Skip to main content

RawStreamingDataSource

Trait RawStreamingDataSource 

Source
pub trait RawStreamingDataSource:
    Iterator<Item = f32>
    + Send
    + Sync
    + Debug {
    // Required methods
    fn sample_rate(&self) -> usize;
    fn channel_count(&self) -> usize;

    // Provided methods
    fn rewind(&mut self) -> Result<(), SoundError> { ... }
    fn time_seek(&mut self, _duration: Duration) { ... }
    fn duration(&self) -> Option<Duration> { ... }
}
Expand description

A samples generator.

§Notes

Iterator implementation (the next() method) must produce samples in interleaved format, this means that samples emitted by the method should be in LRLRLR.. order, where L and R are samples from left and right channels respectively. The sound engine supports both mono and stereo sample sources.

Required Methods§

Source

fn sample_rate(&self) -> usize

Should return sample rate of the source.

Source

fn channel_count(&self) -> usize

Should return total channel count.

Provided Methods§

Source

fn rewind(&mut self) -> Result<(), SoundError>

Tells whether the provider should restart.

Source

fn time_seek(&mut self, _duration: Duration)

Allows you to start playback from given duration.

Source

fn duration(&self) -> Option<Duration>

Returns total duration of data. Can be None if internal decoder does not supports seeking.

Implementors§