2 Copyright (C) 2002-2003 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "public_editor.h"
21 #include "processor_automation_line.h"
22 #include "audio_time_axis.h"
25 #include <ardour/ladspa_plugin.h>
26 #include <ardour/plugin_insert.h>
27 #include <ardour/curve.h>
32 using namespace ARDOUR;
35 ProcessorAutomationLine::ProcessorAutomationLine (const string & name, Processor& proc,
36 TimeAxisView& tv, ArdourCanvas::Group& parent, boost::shared_ptr<AutomationList> l)
38 : AutomationLine (name, tv, parent, l),
41 set_verbose_cursor_uses_gain_mapping (false);
44 Plugin::ParameterDescriptor desc;
46 if ((pi = dynamic_cast<PluginInsert*>(&_processor)) == 0) {
47 fatal << _("insert automation created for non-plugin") << endmsg;
51 pi->plugin()->get_parameter_descriptor (l->param_id(), desc);
62 _range = _upper - _lower;
64 /* XXX set min/max for underlying curve ??? */
68 ProcessorAutomationLine::get_verbose_cursor_string (float fraction)
72 snprintf (buf, sizeof (buf), "%.2f", _lower + (fraction * _range));
77 ProcessorAutomationLine::view_to_model_y (double& y)
79 y = _lower + (y * _range);
83 ProcessorAutomationLine::model_to_view_y (double& y)
85 y = (y - _lower) / _range;