summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-06-20 14:20:01 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-06-20 14:20:01 +0000
commit4a81c71e970ad91a6e0628e0ffd510d585c938b5 (patch)
tree73b99d391ea02af97a3f20f24f4d4c926fc54d56
parentb27233293306324c6a2ee598dcb5d0248c7e1e16 (diff)
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
-rw-r--r--gtk2_ardour/volume_controller.cc12
1 files 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<Gdk::Pixbuf> 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);