diff options
author | David Robillard <d@drobilla.net> | 2008-05-02 21:34:00 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-05-02 21:34:00 +0000 |
commit | fb1fbf71af452ecff0a257bda228d1b31912c8ee (patch) | |
tree | 6d926ea7578bc751675556c17693e2525bdab01f /gtk2_ardour/automation_line.cc | |
parent | ab2af5d185d0346ab1ef4e6f3e69138f3f708958 (diff) |
Fix range problems for pitch wheel controller.
git-svn-id: svn://localhost/ardour2/branches/3.0@3308 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/automation_line.cc')
-rw-r--r-- | gtk2_ardour/automation_line.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 81e4d34989..8c721c7e84 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -1169,6 +1169,7 @@ AutomationLine::set_state (const XMLNode &node) void AutomationLine::view_to_model_y (double& y) { + /* TODO: This should be more generic ... */ if (alist->parameter().type() == GainAutomation) { y = slider_position_to_gain (y); y = max (0.0, y); @@ -1176,25 +1177,26 @@ AutomationLine::view_to_model_y (double& y) } else if (alist->parameter().type() == PanAutomation) { // vertical coordinate axis reversal y = 1.0 - y; - } else if (alist->parameter().type() == MidiCCAutomation) { - y = (int)(y * 127.0); } else if (alist->parameter().type() == PluginAutomation) { y = y * (double)(alist->get_max_y()- alist->get_min_y()) + alist->get_min_y(); + } else { + y = (int)(y * alist->parameter().max()); } } void AutomationLine::model_to_view_y (double& y) { + /* TODO: This should be more generic ... */ if (alist->parameter().type() == GainAutomation) { y = gain_to_slider_position (y); } else if (alist->parameter().type() == PanAutomation) { // vertical coordinate axis reversal y = 1.0 - y; - } else if (alist->parameter().type() == MidiCCAutomation) { - y = y / 127.0; } else if (alist->parameter().type() == PluginAutomation) { y = (y - alist->get_min_y()) / (double)(alist->get_max_y()- alist->get_min_y()); + } else { + y = y / (double)alist->parameter().max(); /* ... like this */ } } |