From 4a81c71e970ad91a6e0628e0ffd510d585c938b5 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 20 Jun 2011 14:20:01 +0000 Subject: [PATCH] fix range on SiP cut control; simplify a couple of other things git-svn-id: svn://localhost/ardour2/branches/3.0@9751 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/volume_controller.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/gtk2_ardour/volume_controller.cc b/gtk2_ardour/volume_controller.cc index 7d6a3362de..ca5b0abaa2 100644 --- a/gtk2_ardour/volume_controller.cc +++ b/gtk2_ardour/volume_controller.cc @@ -49,13 +49,7 @@ VolumeController::VolumeController (Glib::RefPtr p, , _linear (linear) { set_print_func (VolumeController::_dB_printer, this); - - if (step < 1.0) { - value->set_width_chars (6 + abs ((int) ceil (log10 (step)))); - } else { - value->set_width_chars (5); // -NNdB - } - + value->set_width_chars (8); } void @@ -152,8 +146,12 @@ VolumeController::adjust (double control_delta) v = gain_to_slider_position_with_max (v, ARDOUR::Config->get_max_gain()); /* adjust in this domain */ v += control_delta; + /* clamp in this domain */ + v = std::max (0.0, std::min (1.0, v)); /* convert back to gain coefficient domain */ v = slider_position_to_gain_with_max (v, ARDOUR::Config->get_max_gain()); + /* clamp in this domain */ + v = std::max (_controllable->lower(), std::min (_controllable->upper(), v)); /* now round to some precision in the dB domain */ v = accurate_coefficient_to_dB (v);