Conversation
| } | ||
| } | ||
|
|
||
| pub fn extract_callback_float_value(event: ChangeData) -> Option<f64> { |
There was a problem hiding this comment.
happy for suggestions on name/implementation of this
There was a problem hiding this comment.
👍 on pulling this one out to utils
| pub type SampleSeq = u64; | ||
| pub type Ms = f64; | ||
| pub fn sample_seq_duration_ms(sample_rate: usize, first: SampleSeq, last: SampleSeq) -> Ms { | ||
| (last - first) as f64 / sample_rate as f64 * 1000.0 | ||
| } |
There was a problem hiding this comment.
Also interested in any feedback here
There was a problem hiding this comment.
I think you have to put the output into the input if you want feedback 🥁
There was a problem hiding this comment.
What do you think of changing this function to return a value in seconds? Mixlab mostly uses seconds or samples as timing units, and I notice that in Clock we're dividing this value by 1000.0 before using it anyway
haileys
left a comment
There was a problem hiding this comment.
Few things, but otherwise good to go
| html! { | ||
| <> | ||
| <label for={&bpm_id}>{"BPM"}</label> | ||
| <input type="number" |
There was a problem hiding this comment.
@bjeanes taught me today that inputs don't actually need ids to be used with labels. We can actually wrap the <label> tag around <input>. I haven't updated the rest of the code yet, but we can start doing that here?
| } | ||
| } | ||
|
|
||
| pub fn extract_callback_float_value(event: ChangeData) -> Option<f64> { |
There was a problem hiding this comment.
👍 on pulling this one out to utils
| let current_beat_elapsed_percent = 1.0 / beats_per_second * current_beat_elapsed_seconds; | ||
|
|
||
| // For the first 25% of the beat, output high, otherwise, output low | ||
| if current_beat_elapsed_percent < 0.25 { |
There was a problem hiding this comment.
Can you call this frac or something rather than percent?
| pub type SampleSeq = u64; | ||
| pub type Ms = f64; | ||
| pub fn sample_seq_duration_ms(sample_rate: usize, first: SampleSeq, last: SampleSeq) -> Ms { | ||
| (last - first) as f64 / sample_rate as f64 * 1000.0 | ||
| } |
There was a problem hiding this comment.
What do you think of changing this function to return a value in seconds? Mixlab mostly uses seconds or samples as timing units, and I notice that in Clock we're dividing this value by 1000.0 before using it anyway
Co-Authored-By: Charlie Somerville <charlie@charlie.bz>
No description provided.