Skip to content

Commit

Permalink
breaking change: max tap is now stored in ms
Browse files Browse the repository at this point in the history
for easier formatting in s and ms
  • Loading branch information
magnetophon committed Nov 20, 2024
1 parent 0473e18 commit 39d882b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "DEL2"
version = "0.2.0"
version = "0.3.0"
edition = "2021"
authors = ["Bart Brouns <[email protected]>"]
license = "AGPL-3.0-only"
Expand Down
2 changes: 1 addition & 1 deletion src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub fn create(editor_data: Data, editor_state: Arc<ViziaState>) -> Option<Box<dy
.class("row");
HStack::new(cx, |cx| {
Label::new(cx, "max tap").class("slider-label");
ParamSlider::new(cx, Data::params, |params| &params.global.max_tap_seconds)
ParamSlider::new(cx, Data::params, |params| &params.global.max_tap_ms)
.set_style(ParamSliderStyle::FromLeft)
.class("widget");
})
Expand Down
22 changes: 11 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ struct GlobalParams {
release_ms: FloatParam,
#[id = "min_tap_milliseconds"]
pub min_tap_milliseconds: FloatParam,
#[id = "max_tap_seconds"]
pub max_tap_seconds: FloatParam,
#[id = "max_tap_ms"]
pub max_tap_ms: FloatParam,
}

impl GlobalParams {
Expand Down Expand Up @@ -260,19 +260,19 @@ impl GlobalParams {
factor: FloatRange::skew_factor(-1.5),
},
)
.with_step_size(0.1)
.with_unit(" ms"),
max_tap_seconds: FloatParam::new(
.with_value_to_string(Del2::v2s_f32_ms_then_s(3))
.with_string_to_value(Del2::s2v_f32_ms_then_s()),
max_tap_ms: FloatParam::new(
"max tap",
3.03,
3030.0,
FloatRange::Skewed {
min: 0.5,
max: MAX_TAP_SECONDS as f32,
min: 500.0,
max: (MAX_TAP_SECONDS * 1000) as f32,
factor: FloatRange::skew_factor(-0.8),
},
)
.with_step_size(0.01)
.with_unit(" s"),
.with_value_to_string(Del2::v2s_f32_ms_then_s(3))
.with_string_to_value(Del2::s2v_f32_ms_then_s()),
}
}
}
Expand Down Expand Up @@ -853,7 +853,7 @@ impl Del2 {
fn update_min_max_tap_samples(&mut self) {
let sample_rate = self.params.sample_rate.load(Ordering::SeqCst);
self.params.max_tap_samples.store(
(sample_rate * self.params.global.max_tap_seconds.value()) as u32,
(sample_rate * self.params.global.max_tap_ms.value() * 0.001) as u32,
Ordering::SeqCst,
);
self.min_tap_samples =
Expand Down

0 comments on commit 39d882b

Please sign in to comment.