summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-05-02 21:34:00 +0000
committerDavid Robillard <d@drobilla.net>2008-05-02 21:34:00 +0000
commitfb1fbf71af452ecff0a257bda228d1b31912c8ee (patch)
tree6d926ea7578bc751675556c17693e2525bdab01f /gtk2_ardour
parentab2af5d185d0346ab1ef4e6f3e69138f3f708958 (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')
-rw-r--r--gtk2_ardour/automation_line.cc10
-rw-r--r--gtk2_ardour/midi_time_axis.cc3
2 files changed, 8 insertions, 5 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 */
}
}
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index cf17543040..95b77abaf4 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -339,7 +339,8 @@ MidiTimeAxisView::create_automation_child (Parameter param, bool show)
boost::shared_ptr<AutomationControl> c = _route->control(param);
if (!c) {
- boost::shared_ptr<AutomationList> al(new ARDOUR::AutomationList(param, 0, 127, 64));
+ boost::shared_ptr<AutomationList> al(new ARDOUR::AutomationList(param,
+ param.min(), param.max(), (param.max() - param.min() / 2)));
c = boost::shared_ptr<AutomationControl>(_route->control_factory(al));
_route->add_control(c);
}