mirror of
https://github.com/robbert-vdh/nih-plug.git
synced 2026-07-01 02:36:54 +00:00
Add finer step sizes to parameters
This commit is contained in:
@@ -219,8 +219,8 @@ impl ParamWidgetBase {
|
||||
param_ptr_forward!(pub fn default_plain_value(&self) -> f32);
|
||||
param_ptr_forward!(pub fn default_normalized_value(&self) -> f32);
|
||||
param_ptr_forward!(pub fn step_count(&self) -> Option<usize>);
|
||||
param_ptr_forward!(pub fn previous_normalized_step(&self, from: f32) -> f32);
|
||||
param_ptr_forward!(pub fn next_normalized_step(&self, from: f32) -> f32);
|
||||
param_ptr_forward!(pub fn previous_normalized_step(&self, from: f32, finer: bool) -> f32);
|
||||
param_ptr_forward!(pub fn next_normalized_step(&self, from: f32, finer: bool) -> f32);
|
||||
param_ptr_forward!(pub fn normalized_value_to_string(&self, normalized: f32, include_unit: bool) -> String);
|
||||
param_ptr_forward!(pub fn string_to_normalized_value(&self, string: &str) -> Option<f32>);
|
||||
param_ptr_forward!(pub fn preview_normalized(&self, plain: f32) -> f32);
|
||||
|
||||
@@ -364,8 +364,8 @@ impl ParamSlider {
|
||||
(previous_step, discrete_values.recip())
|
||||
}
|
||||
ParamSliderStyle::CurrentStep { .. } | ParamSliderStyle::CurrentStepLabeled { .. } => {
|
||||
let previous_step = param.previous_normalized_step(current_value);
|
||||
let next_step = param.next_normalized_step(current_value);
|
||||
let previous_step = param.previous_normalized_step(current_value, false);
|
||||
let next_step = param.next_normalized_step(current_value, false);
|
||||
|
||||
(
|
||||
(previous_step + current_value) / 2.0,
|
||||
@@ -570,13 +570,15 @@ impl View for ParamSlider {
|
||||
let mut current_value = self.param_base.unmodulated_normalized_value();
|
||||
|
||||
while self.scrolled_lines >= 1.0 {
|
||||
current_value = self.param_base.next_normalized_step(current_value);
|
||||
current_value = self.param_base.next_normalized_step(current_value, false);
|
||||
self.param_base.set_normalized_value(cx, current_value);
|
||||
self.scrolled_lines -= 1.0;
|
||||
}
|
||||
|
||||
while self.scrolled_lines <= -1.0 {
|
||||
current_value = self.param_base.previous_normalized_step(current_value);
|
||||
current_value = self
|
||||
.param_base
|
||||
.previous_normalized_step(current_value, false);
|
||||
self.param_base.set_normalized_value(cx, current_value);
|
||||
self.scrolled_lines += 1.0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user