From 24727e65befc310f24196d11a56ec7b269977c16 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 4 Dec 2014 00:29:28 -0500 Subject: Make gain controls step by roughly 1.0/0.1 dB. Shoot for roughly 30 steps for all controls. Always keep sensible step information in ParameterDescriptor and just convert for the UI. This is a little weird, but it's less weird than it was before, and works. --- gtk2_ardour/automation_controller.cc | 15 ++------------- gtk2_ardour/gain_meter.cc | 12 ++++++++---- 2 files changed, 10 insertions(+), 17 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/automation_controller.cc b/gtk2_ardour/automation_controller.cc index f4a0d7d2f1..6acf37f953 100644 --- a/gtk2_ardour/automation_controller.cc +++ b/gtk2_ardour/automation_controller.cc @@ -126,19 +126,8 @@ AutomationController::create(boost::shared_ptr printer, const double lo = ac->internal_to_interface(desc.lower); const double up = ac->internal_to_interface(desc.upper); const double normal = ac->internal_to_interface(desc.normal); - double smallstep = desc.smallstep; - double largestep = desc.largestep; - if (smallstep == 0.0) { - smallstep = up / 1000.; - } else { - smallstep = ac->internal_to_interface(desc.lower + smallstep); - } - - if (largestep == 0.0) { - largestep = up / 40.; - } else { - largestep = ac->internal_to_interface(desc.lower + largestep); - } + const double smallstep = ac->internal_to_interface(desc.lower + desc.smallstep); + const double largestep = ac->internal_to_interface(desc.lower + desc.largestep); Gtk::Adjustment* adjustment = manage ( new Gtk::Adjustment (normal, lo, up, smallstep, largestep)); diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc index 7b7ad33f9a..1dfd086b95 100644 --- a/gtk2_ardour/gain_meter.cc +++ b/gtk2_ardour/gain_meter.cc @@ -49,6 +49,7 @@ #include "ardour/meter.h" #include "ardour/audio_track.h" #include "ardour/midi_track.h" +#include "ardour/dB.h" #include "i18n.h" @@ -82,11 +83,14 @@ reset_cursor_to_default_state (Gtk::StateType, Gtk::Entry* widget) } GainMeterBase::GainMeterBase (Session* s, bool horizontal, int fader_length, int fader_girth) - : gain_adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0.0, 1.0, 0.01, 0.1) + : gain_adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), // value + 0.0, // lower + 1.0, // upper + dB_coeff_step(Config->get_max_gain()) / 10.0, // step increment + dB_coeff_step(Config->get_max_gain())) // page increment , gain_automation_style_button ("") , gain_automation_state_button ("") , _data_type (DataType::AUDIO) - { using namespace Menu_Helpers; @@ -260,8 +264,8 @@ GainMeterBase::setup_gain_adjustment () _data_type = DataType::AUDIO; gain_adjustment.set_lower (0.0); gain_adjustment.set_upper (1.0); - gain_adjustment.set_step_increment (0.01); - gain_adjustment.set_page_increment (0.1); + gain_adjustment.set_step_increment (dB_coeff_step(Config->get_max_gain()) / 10.0); + gain_adjustment.set_page_increment (dB_coeff_step(Config->get_max_gain())); gain_slider->set_default_value (gain_to_slider_position (1)); } else { _data_type = DataType::MIDI; -- cgit v1.2.3