use std::time::Duration;
use super::Sample;
pub use self::amplify::Amplify;
pub use self::done::Done;
pub use self::empty::Empty;
pub use self::fadein::FadeIn;
pub use self::pausable::Pausable;
pub use self::periodic::PeriodicAccess;
pub use self::samples_converter::SamplesConverter;
pub use self::skippable::Skippable;
pub use self::speed::Speed;
pub use self::stoppable::Stoppable;
pub use self::take::TakeDuration;
pub use self::uniform::UniformSourceIterator;
pub use self::zero::Zero;
mod amplify;
mod done;
mod empty;
mod fadein;
mod pausable;
mod periodic;
mod samples_converter;
mod skippable;
mod speed;
mod stoppable;
mod take;
mod uniform;
mod zero;
pub trait Source: Iterator
where
Self::Item: Sample,
{
fn current_frame_len(&self) -> Option<usize>;
fn channels(&self) -> u16;
fn sample_rate(&self) -> u32;
fn total_duration(&self) -> Option<Duration>;
fn seek(&mut self, time: Duration) -> Option<Duration>;
fn elapsed(&mut self) -> Duration;
#[inline]
fn take_duration(self, duration: Duration) -> TakeDuration<Self>
where
Self: Sized,
{
take::take_duration(self, duration)
}
#[inline]
fn amplify(self, value: f32) -> Amplify<Self>
where
Self: Sized,
{
amplify::amplify(self, value)
}
#[inline]
fn fade_in(self, duration: Duration) -> FadeIn<Self>
where
Self: Sized,
{
fadein::fadein(self, duration)
}
#[inline]
fn periodic_access<F>(self, period: Duration, access: F) -> PeriodicAccess<Self, F>
where
Self: Sized,
F: FnMut(&mut Self),
{
periodic::periodic(self, period, access)
}
#[inline]
fn convert_samples<D>(self) -> SamplesConverter<Self, D>
where
Self: Sized,
D: Sample,
{
SamplesConverter::new(self)
}
#[inline]
fn pausable(self, initially_paused: bool) -> Pausable<Self>
where
Self: Sized,
{
pausable::pausable(self, initially_paused)
}
#[inline]
fn stoppable(self) -> Stoppable<Self>
where
Self: Sized,
{
stoppable::stoppable(self)
}
#[inline]
fn skippable(self) -> Skippable<Self>
where
Self: Sized,
{
skippable::skippable(self)
}
#[inline]
fn speed(self, ratio: f32) -> Speed<Self>
where
Self: Sized,
{
speed::speed(self, ratio)
}
}