Skip to content

Conversation

viktaur
Copy link

@viktaur viktaur commented Feb 27, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant