[][src]Struct dasp_signal::Rate

pub struct Rate { /* fields omitted */ }

The rate at which phrase a Signal is sampled.

Implementations

impl Rate[src]

pub fn const_hz(self, hz: f64) -> ConstHz[src]

Create a ConstHz signal which consistently yields hz / rate.

pub fn hz<S>(self, hz: S) -> Hz<S> where
    S: Signal<Frame = f64>, 
[src]

Create a Hz signal which yields phase step sizes controlled by an input signal hz.

Example

use dasp_signal::{self as signal, Signal};

fn main() {
    let step = signal::rate(4.0).hz(signal::gen(|| 1.0));
    let mut phase = signal::phase(step);
    assert_eq!(phase.next(), 0.0);
    assert_eq!(phase.next(), 0.25);
    assert_eq!(phase.next(), 0.5);
    assert_eq!(phase.next(), 0.75);
    assert_eq!(phase.next(), 0.0);
    assert_eq!(phase.next(), 0.25);
}

Trait Implementations

impl Clone for Rate[src]

impl Copy for Rate[src]

impl Debug for Rate[src]

impl PartialEq<Rate> for Rate[src]

impl StructuralPartialEq for Rate[src]

Auto Trait Implementations

impl RefUnwindSafe for Rate

impl Send for Rate

impl Sync for Rate

impl Unpin for Rate

impl UnwindSafe for Rate

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<S, T> Duplex<S> for T where
    T: FromSample<S> + ToSample<S>, 
[src]

impl<T> From<T> for T[src]

impl<S> FromSample<S> for S[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> ToSample<U> for T where
    U: FromSample<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.