Trait rodio::source::Source [] [src]

pub trait Source: Iterator where Self::Item: Sample {
    fn get_current_frame_len(&self) -> Option<usize>;
    fn get_channels(&self) -> u16;
    fn get_samples_rate(&self) -> u32;
    fn get_total_duration(&self) -> Option<Duration>;

    fn buffered(self) -> Buffered<Self> where Self: Sized { ... }
    fn mix<S>(self, other: S) -> Mix<Self, S> where Self: Sized, S: Source, S::Item: Sample { ... }
    fn repeat_infinite(self) -> Repeat<Self> where Self: Sized { ... }
    fn take_duration(self, duration: Duration) -> TakeDuration<Self> where Self: Sized { ... }
    fn delay(self, duration: Duration) -> Delay<Self> where Self: Sized { ... }
    fn amplify(self, value: f32) -> Amplify<Self> where Self: Sized { ... }
    fn fade_in(self, duration: Duration) -> FadeIn<Self> where Self: Sized { ... }
    fn speed(self, ratio: f32) -> Speed<Self> where Self: Sized { ... }
    fn reverb(self, duration: Duration, amplitude: f32) -> Mix<Self, Delay<Amplify<Self>>> where Self: Sized + Clone { ... }
}

A source of samples.

Required Methods

Returns the number of samples before the current channel ends. None means "infinite". Should never return 0 unless there's no more data.

After the engine has finished reading the specified number of samples, it will assume that the value of get_channels() and/or get_samples_rate() have changed.

Returns the number of channels. Channels are always interleaved.

Returns the rate at which the source should be played.

Returns the total duration of this source, if known.

None indicates at the same time "infinite" or "unknown".

Provided Methods

Stores the source in a buffer in addition to returning it. This iterator can be cloned.

Mixes this source with another one.

Repeats this source forever.

Note that this works by storing the data in a buffer, so the amount of memory used is proportional to the size of the sound.

Takes a certain duration of this source and then stops.

Delays the sound by a certain duration.

The rate and channels of the silence will use the same format as the first frame of the source.

Amplifies the sound by the given value.

Fades in the sound.

Changes the play speed of the sound. Does not adjust the samples, only the play speed.

Adds a basic reverb effect.

This function requires the source to implement Clone. This can be done by using buffered().

Example

use std::time::Duration;

let source = source.buffered().reverb(Duration::from_millis(100), 0.7);

Implementors