summaryrefslogtreecommitdiff
path: root/gtk2_ardour/automation_line.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-06-30 18:41:50 +0000
committerDavid Robillard <d@drobilla.net>2007-06-30 18:41:50 +0000
commitbbf41757133a29df0d37905f2fdce091878d2ffd (patch)
tree2506ed83985d406019236c68704df0b9542dbe3a /gtk2_ardour/automation_line.cc
parent685fa95e729e5d510b28b4c715da062e9db580d9 (diff)
Another not-quite-there-but-better commit.
Brought plugin automation into the fold of new automation system. Fixed plugin automation, broke panner automation :] (pending Panner work). Made AutomationController better at automatically following it's controller value (mimic what gain meter does). Fixed some visible automation track bugs (but still broken WRT serialization). git-svn-id: svn://localhost/ardour2/trunk@2092 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/automation_line.cc')
-rw-r--r--gtk2_ardour/automation_line.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index 948fe358e8..bbbed006c5 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -248,6 +248,9 @@ AutomationLine::AutomationLine (const string & name, TimeAxisView& tv, ArdourCan
alist->StateChanged.connect (mem_fun(*this, &AutomationLine::list_changed));
trackview.session().register_with_memento_command_factory(alist->id(), this);
+
+ if (alist->param_id().type() == GainAutomation)
+ set_verbose_cursor_uses_gain_mapping (true);
}
AutomationLine::~AutomationLine ()
@@ -1290,3 +1293,34 @@ AutomationLine::set_state (const XMLNode &node)
/* function as a proxy for the model */
return alist->set_state (node);
}
+
+void
+AutomationLine::view_to_model_y (double& y)
+{
+ if (alist->param_id().type() == GainAutomation) {
+ y = slider_position_to_gain (y);
+ y = max (0.0, y);
+ y = min (2.0, y);
+ } else if (alist->param_id().type() == PanAutomation) {
+ // vertical coordinate axis reversal
+ y = 1.0 - y;
+ } else if (alist->param_id().type() == MidiCCAutomation) {
+ y = (int)(y * 127.0);
+ }
+}
+
+void
+AutomationLine::model_to_view_y (double& y)
+{
+ if (alist->param_id().type() == GainAutomation) {
+ y = gain_to_slider_position (y);
+ } else if (alist->param_id().type() == PanAutomation) {
+ // vertical coordinate axis reversal
+ y = 1.0 - y;
+ } else if (alist->param_id().type() == MidiCCAutomation) {
+ y = y / 127.0;
+ } else if (alist->param_id().type() == PluginAutomation) {
+ y = (y - alist->get_min_y()) / (double)(alist->get_max_y()- alist->get_min_y());
+ }
+}
+