diff options
author | David Robillard <d@drobilla.net> | 2007-07-04 22:57:13 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-07-04 22:57:13 +0000 |
commit | b57510a3a9d789ae1194d3fc6d136044850d3e42 (patch) | |
tree | d072b773faa3342f8cb3ae76d40130b38509bbb1 /gtk2_ardour/automation_line.cc | |
parent | a1052b0eca7bdc8ec1e3ac2996cd16bb48e2a6d2 (diff) |
Display correct value for verbose control point cursor for Midi CC (int) and plugin automation (map to parameter range).
Use double throughout for automation control point y coordinate instead of casting to this and that losing precision.
Fix crash bug in route automation menu.
git-svn-id: svn://localhost/ardour2/trunk@2107 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, 8 insertions, 2 deletions
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 77f9adb757..f396a92d82 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -764,7 +764,7 @@ AutomationLine::determine_visible_control_points (ALPoints& points) } string -AutomationLine::get_verbose_cursor_string (float fraction) +AutomationLine::get_verbose_cursor_string (double fraction) { char buf[32]; @@ -775,7 +775,11 @@ AutomationLine::get_verbose_cursor_string (float fraction) snprintf (buf, sizeof (buf), "%.1fdB", coefficient_to_dB (slider_position_to_gain (fraction))); } } else { - snprintf (buf, sizeof (buf), "%.2f", fraction); + view_to_model_y(fraction); + if (alist->parameter().type() == MidiCCAutomation) + snprintf (buf, sizeof (buf), "%d", (int)fraction); + else + snprintf (buf, sizeof (buf), "%.2f", fraction); } return buf; @@ -1306,6 +1310,8 @@ AutomationLine::view_to_model_y (double& y) 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(); } } |