dasp
dasp copied to clipboard
Add support for offsetting the phase of a signal
Hi, this PR introduces a new struct and a method to specify the initial phase of a signal, represented by a value between 0 and 1.
Example:
use dasp_signal::{self as signal, Signal};
fn main() {
let step = signal::rate(4.0).const_hz(1.0).offset_phase(0.25);
let mut phase = step.phase();
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);
assert_eq!(phase.next(), 0.5);
}
Feel free to comment on any design choices that could be improved.