Merge pull request #218 from mathstuf/cleanups

Cleanups
This commit is contained in:
Pierre Krieger 2019-01-28 20:19:06 +01:00 committed by GitHub
commit 25d3151917
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 55 deletions

View file

@ -21,11 +21,7 @@ where
/// A source that delays the given source by a certain amount.
#[derive(Clone, Debug)]
pub struct Delay<I>
where
I: Source,
I::Item: Sample,
{
pub struct Delay<I> {
input: I,
remaining_samples: usize,
requested_duration: Duration,

View file

@ -4,23 +4,15 @@ use std::time::Duration;
use Sample;
use Source;
/// When the inner source is empty this decrements an AtomicUsize
/// When the inner source is empty this decrements an `AtomicUsize`.
#[derive(Debug, Clone)]
pub struct Done<I>
where
I: Source,
I::Item: Sample,
{
pub struct Done<I> {
input: I,
signal: Arc<AtomicUsize>,
signal_sent: bool,
}
impl<I> Done<I>
where
I: Source,
I::Item: Sample,
{
impl<I> Done<I> {
#[inline]
pub fn new(input: I, signal: Arc<AtomicUsize>) -> Done<I> {
Done {

View file

@ -18,13 +18,9 @@ where
}
}
/// Filter that modifies each sample by a given value.
/// Filter that modifies raises the volume from silence over a time period.
#[derive(Clone, Debug)]
pub struct FadeIn<I>
where
I: Source,
I::Item: Sample,
{
pub struct FadeIn<I> {
input: I,
remaining_ns: f32,
total_ns: f32,

View file

@ -11,22 +11,12 @@ use Source;
/// It implements `Source` as well, but all the data is guaranteed to be in a single frame whose
/// channels and samples rate have been passed to `new`.
#[derive(Clone)]
pub struct SamplesConverter<I, D>
where
I: Source,
I::Item: Sample,
D: Sample,
{
pub struct SamplesConverter<I, D> {
inner: I,
dest: PhantomData<D>,
}
impl<I, D> SamplesConverter<I, D>
where
I: Source,
I::Item: Sample,
D: Sample,
{
impl<I, D> SamplesConverter<I, D> {
#[inline]
pub fn new(input: I) -> SamplesConverter<I, D> {
SamplesConverter {

View file

@ -4,11 +4,7 @@ use Sample;
use Source;
/// Internal function that builds a `Speed` object.
pub fn speed<I>(input: I, factor: f32) -> Speed<I>
where
I: Source,
I::Item: Sample,
{
pub fn speed<I>(input: I, factor: f32) -> Speed<I> {
Speed {
input: input,
factor: factor,
@ -17,11 +13,7 @@ where
/// Filter that modifies each sample by a given value.
#[derive(Clone, Debug)]
pub struct Speed<I>
where
I: Source,
I::Item: Sample,
{
pub struct Speed<I> {
input: I,
factor: f32,
}

View file

@ -3,12 +3,8 @@ use std::time::Duration;
use Sample;
use Source;
/// Internal function that builds a `Repeat` object.
pub fn take_duration<I>(input: I, duration: Duration) -> TakeDuration<I>
where
I: Source,
I::Item: Sample,
{
/// Internal function that builds a `TakeDuration` object.
pub fn take_duration<I>(input: I, duration: Duration) -> TakeDuration<I> {
TakeDuration {
input: input,
remaining_duration: duration,
@ -18,11 +14,7 @@ where
/// A source that repeats the given source.
#[derive(Clone, Debug)]
pub struct TakeDuration<I>
where
I: Source,
I::Item: Sample,
{
pub struct TakeDuration<I> {
input: I,
remaining_duration: Duration,
requested_duration: Duration,