Skip to main content

Decodable

Trait Decodable 

Source
pub trait Decodable:
    Send
    + Sync
    + 'static {
    type Decoder: Source<Item = f32> + Send + Iterator;

    // Required method
    fn decoder(&self) -> Self::Decoder;
}
Expand description

A type implementing this trait can be converted to a rodio::Source type.

It must be Send and Sync in order to be registered. Types that implement this trait usually contain raw sound data that can be converted into an iterator of samples. This trait is implemented for AudioSource. Check the example decodable for how to implement this trait on a custom type.

Required Associated Types§

Source

type Decoder: Source<Item = f32> + Send + Iterator

The type of the iterator of the audio samples, which iterates over samples of type rodio::Sample. Must be a rodio::Source so that it can provide information on the audio it is iterating over.

Required Methods§

Source

fn decoder(&self) -> Self::Decoder

Build and return a Self::Decoder of the implementing type

Implementors§

Source§

impl Decodable for AudioSource

Source§

impl Decodable for Pitch

Source§

type Decoder = TakeDuration<SineWave>