pub struct Rate { /* private fields */ }
Expand description
The rate at which phrase a Signal is sampled.
Implementations§
Source§impl Rate
impl Rate
Sourcepub fn const_hz(self, hz: f64) -> ConstHz
pub fn const_hz(self, hz: f64) -> ConstHz
Create a ConstHz
signal which consistently yields hz / rate
.
Sourcepub fn hz<S>(self, hz: S) -> Hz<S>
pub fn hz<S>(self, hz: S) -> Hz<S>
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 Copy for Rate
impl StructuralPartialEq for Rate
Auto Trait Implementations§
impl Freeze for Rate
impl RefUnwindSafe for Rate
impl Send for Rate
impl Sync for Rate
impl Unpin for Rate
impl UnwindSafe for Rate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more