2008-06-02 21:41:35 +00:00
|
|
|
/*
|
2009-10-14 16:10:01 +00:00
|
|
|
Copyright (C) 2001,2007 Paul Davis
|
2008-06-02 21:41:35 +00:00
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
|
#include <errno.h>
|
2010-08-17 13:10:42 +00:00
|
|
|
|
2015-10-05 22:10:58 +02:00
|
|
|
#include "pbd/gstdio_compat.h"
|
2010-08-17 13:10:42 +00:00
|
|
|
#include <glibmm/miscutils.h>
|
|
|
|
|
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "pbd/error.h"
|
2009-06-09 20:21:19 +00:00
|
|
|
|
|
|
|
|
#include "ardour/amp.h"
|
2012-05-24 06:09:29 +00:00
|
|
|
#include "ardour/automatable.h"
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "ardour/event_type_map.h"
|
2016-01-12 22:04:18 -05:00
|
|
|
#include "ardour/gain_control.h"
|
2016-04-09 16:16:22 -04:00
|
|
|
#include "ardour/monitor_control.h"
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "ardour/midi_track.h"
|
2011-01-27 01:31:03 +00:00
|
|
|
#include "ardour/pan_controllable.h"
|
2012-05-24 06:09:29 +00:00
|
|
|
#include "ardour/pannable.h"
|
2014-11-01 23:29:10 -04:00
|
|
|
#include "ardour/plugin.h"
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "ardour/plugin_insert.h"
|
2016-04-09 16:16:22 -04:00
|
|
|
#include "ardour/record_enable_control.h"
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "ardour/session.h"
|
2016-12-08 15:37:07 -05:00
|
|
|
#ifdef LV2_SUPPORT
|
2014-11-01 23:29:10 -04:00
|
|
|
#include "ardour/uri_map.h"
|
2016-12-08 15:37:07 -05:00
|
|
|
#endif
|
2014-11-02 01:29:33 -05:00
|
|
|
#include "ardour/value_as_string.h"
|
2008-06-02 21:41:35 +00:00
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2008-06-02 21:41:35 +00:00
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
using namespace ARDOUR;
|
|
|
|
|
using namespace PBD;
|
|
|
|
|
|
2011-01-27 01:31:03 +00:00
|
|
|
const string Automatable::xml_node_name = X_("Automation");
|
2008-06-02 21:41:35 +00:00
|
|
|
|
2008-09-21 16:17:02 +00:00
|
|
|
Automatable::Automatable(Session& session)
|
|
|
|
|
: _a_session(session)
|
|
|
|
|
{
|
|
|
|
|
}
|
2008-06-02 21:41:35 +00:00
|
|
|
|
2010-05-19 03:03:28 +00:00
|
|
|
Automatable::Automatable (const Automatable& other)
|
|
|
|
|
: ControlSet (other)
|
|
|
|
|
, _a_session (other._a_session)
|
|
|
|
|
{
|
2012-07-25 17:48:55 +00:00
|
|
|
Glib::Threads::Mutex::Lock lm (other._control_lock);
|
2010-05-19 03:03:28 +00:00
|
|
|
|
|
|
|
|
for (Controls::const_iterator i = other._controls.begin(); i != other._controls.end(); ++i) {
|
|
|
|
|
boost::shared_ptr<Evoral::Control> ac (control_factory (i->first));
|
2010-07-14 00:58:15 +00:00
|
|
|
add_control (ac);
|
2010-05-19 03:03:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
2012-07-13 21:05:45 +00:00
|
|
|
|
|
|
|
|
Automatable::~Automatable ()
|
|
|
|
|
{
|
2017-06-09 23:24:37 +02:00
|
|
|
Glib::Threads::Mutex::Lock lm (_control_lock);
|
|
|
|
|
for (Controls::const_iterator li = _controls.begin(); li != _controls.end(); ++li) {
|
|
|
|
|
boost::dynamic_pointer_cast<AutomationControl>(li->second)->drop_references ();
|
2012-07-13 21:05:45 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
int
|
|
|
|
|
Automatable::old_set_automation_state (const XMLNode& node)
|
|
|
|
|
{
|
2016-05-04 23:09:37 -04:00
|
|
|
XMLProperty const * prop;
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
if ((prop = node.property ("path")) != 0) {
|
|
|
|
|
load_automation (prop->value());
|
|
|
|
|
} else {
|
2008-09-21 16:17:02 +00:00
|
|
|
warning << _("Automation node has no path property") << endmsg;
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
Automatable::load_automation (const string& path)
|
|
|
|
|
{
|
|
|
|
|
string fullpath;
|
|
|
|
|
|
2010-08-17 13:10:42 +00:00
|
|
|
if (Glib::path_is_absolute (path)) { // legacy
|
2008-06-02 21:41:35 +00:00
|
|
|
fullpath = path;
|
|
|
|
|
} else {
|
2008-09-21 16:17:02 +00:00
|
|
|
fullpath = _a_session.automation_dir();
|
2008-06-02 21:41:35 +00:00
|
|
|
fullpath += path;
|
|
|
|
|
}
|
2015-10-05 21:43:44 +02:00
|
|
|
|
|
|
|
|
FILE * in = g_fopen (fullpath.c_str (), "rb");
|
2008-06-02 21:41:35 +00:00
|
|
|
|
|
|
|
|
if (!in) {
|
2008-09-21 16:17:02 +00:00
|
|
|
warning << string_compose(_("cannot open %2 to load automation data (%3)")
|
|
|
|
|
, fullpath, strerror (errno)) << endmsg;
|
2008-06-02 21:41:35 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-25 17:48:55 +00:00
|
|
|
Glib::Threads::Mutex::Lock lm (control_lock());
|
2008-09-29 22:47:40 +00:00
|
|
|
set<Evoral::Parameter> tosave;
|
2008-09-21 16:17:02 +00:00
|
|
|
controls().clear ();
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2015-10-05 21:43:44 +02:00
|
|
|
while (!feof(in)) {
|
2008-06-02 21:41:35 +00:00
|
|
|
double when;
|
|
|
|
|
double value;
|
|
|
|
|
uint32_t port;
|
|
|
|
|
|
2015-10-05 21:43:44 +02:00
|
|
|
if (3 != fscanf (in, "%d %lf %lf", &port, &when, &value)) {
|
|
|
|
|
if (feof(in)) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
goto bad;
|
|
|
|
|
}
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-10-03 03:16:19 +00:00
|
|
|
Evoral::Parameter param(PluginAutomation, 0, port);
|
2008-06-02 21:41:35 +00:00
|
|
|
/* FIXME: this is legacy and only used for plugin inserts? I think? */
|
2008-09-29 22:47:40 +00:00
|
|
|
boost::shared_ptr<Evoral::Control> c = control (param, true);
|
2008-06-02 21:41:35 +00:00
|
|
|
c->list()->add (when, value);
|
2008-09-29 22:47:40 +00:00
|
|
|
tosave.insert (param);
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
2015-10-05 21:43:44 +02:00
|
|
|
::fclose (in);
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
bad:
|
2008-09-21 16:17:02 +00:00
|
|
|
error << string_compose(_("cannot load automation data from %2"), fullpath) << endmsg;
|
|
|
|
|
controls().clear ();
|
2015-10-05 21:43:44 +02:00
|
|
|
::fclose (in);
|
2008-06-02 21:41:35 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2008-09-19 00:47:49 +00:00
|
|
|
Automatable::add_control(boost::shared_ptr<Evoral::Control> ac)
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
2008-09-29 22:47:40 +00:00
|
|
|
Evoral::Parameter param = ac->parameter();
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2010-08-09 22:23:23 +00:00
|
|
|
boost::shared_ptr<AutomationList> al = boost::dynamic_pointer_cast<AutomationList> (ac->list ());
|
2011-06-01 16:50:12 +00:00
|
|
|
|
2016-04-09 16:15:26 -04:00
|
|
|
boost::shared_ptr<AutomationControl> actl (boost::dynamic_pointer_cast<AutomationControl> (ac));
|
|
|
|
|
|
|
|
|
|
if ((!actl || !(actl->flags() & Controllable::NotAutomatable)) && al) {
|
2014-08-31 18:52:37 -04:00
|
|
|
al->automation_state_changed.connect_same_thread (
|
|
|
|
|
_list_connections,
|
|
|
|
|
boost::bind (&Automatable::automation_list_automation_state_changed,
|
|
|
|
|
this, ac->parameter(), _1));
|
|
|
|
|
}
|
2010-08-09 22:23:23 +00:00
|
|
|
|
|
|
|
|
ControlSet::add_control (ac);
|
|
|
|
|
|
2016-04-09 16:15:26 -04:00
|
|
|
if ((!actl || !(actl->flags() & Controllable::NotAutomatable)) && al) {
|
2014-11-01 23:29:10 -04:00
|
|
|
_can_automate_list.insert (param);
|
2014-08-31 18:52:37 -04:00
|
|
|
automation_list_automation_state_changed (param, al->automation_state ()); // sync everything up
|
|
|
|
|
}
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string
|
2008-09-29 22:47:40 +00:00
|
|
|
Automatable::describe_parameter (Evoral::Parameter param)
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
|
|
|
|
/* derived classes like PluginInsert should override this */
|
|
|
|
|
|
2008-09-29 22:47:40 +00:00
|
|
|
if (param == Evoral::Parameter(GainAutomation)) {
|
2008-06-02 21:41:35 +00:00
|
|
|
return _("Fader");
|
2015-04-25 21:24:58 +02:00
|
|
|
} else if (param.type() == TrimAutomation) {
|
|
|
|
|
return _("Trim");
|
2014-07-01 14:36:58 -04:00
|
|
|
} else if (param.type() == MuteAutomation) {
|
|
|
|
|
return _("Mute");
|
2008-06-02 21:41:35 +00:00
|
|
|
} else if (param.type() == MidiCCAutomation) {
|
2013-01-20 08:56:00 +00:00
|
|
|
return string_compose("Controller %1 [%2]", param.id(), int(param.channel()) + 1);
|
2008-06-02 21:41:35 +00:00
|
|
|
} else if (param.type() == MidiPgmChangeAutomation) {
|
|
|
|
|
return string_compose("Program [%1]", int(param.channel()) + 1);
|
|
|
|
|
} else if (param.type() == MidiPitchBenderAutomation) {
|
|
|
|
|
return string_compose("Bender [%1]", int(param.channel()) + 1);
|
2008-09-21 18:08:18 +00:00
|
|
|
} else if (param.type() == MidiChannelPressureAutomation) {
|
|
|
|
|
return string_compose("Pressure [%1]", int(param.channel()) + 1);
|
2016-08-18 12:35:15 -04:00
|
|
|
} else if (param.type() == MidiNotePressureAutomation) {
|
|
|
|
|
return string_compose("PolyPressure [%1]", int(param.channel()) + 1);
|
2015-03-08 01:34:42 -05:00
|
|
|
#ifdef LV2_SUPPORT
|
2014-11-01 23:29:10 -04:00
|
|
|
} else if (param.type() == PluginPropertyAutomation) {
|
|
|
|
|
return string_compose("Property %1", URIMap::instance().id_to_uri(param.id()));
|
2015-03-08 01:34:42 -05:00
|
|
|
#endif
|
2008-06-02 21:41:35 +00:00
|
|
|
} else {
|
2008-09-29 22:47:40 +00:00
|
|
|
return EventTypeMap::instance().to_symbol(param);
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2008-09-29 22:47:40 +00:00
|
|
|
Automatable::can_automate (Evoral::Parameter what)
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
|
|
|
|
_can_automate_list.insert (what);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \a legacy_param is used for loading legacy sessions where an object (IO, Panner)
|
|
|
|
|
* had a single automation parameter, with it's type implicit. Derived objects should
|
|
|
|
|
* pass that type and it will be used for the untyped AutomationList found.
|
|
|
|
|
*/
|
|
|
|
|
int
|
2010-09-18 20:01:36 +00:00
|
|
|
Automatable::set_automation_xml_state (const XMLNode& node, Evoral::Parameter legacy_param)
|
2009-10-14 16:10:01 +00:00
|
|
|
{
|
2012-07-25 17:48:55 +00:00
|
|
|
Glib::Threads::Mutex::Lock lm (control_lock());
|
2008-06-02 21:41:35 +00:00
|
|
|
|
|
|
|
|
/* Don't clear controls, since some may be special derived Controllable classes */
|
|
|
|
|
|
|
|
|
|
XMLNodeList nlist = node.children();
|
|
|
|
|
XMLNodeIterator niter;
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
|
|
|
|
|
|
|
|
|
|
/*if (sscanf ((*niter)->name().c_str(), "parameter-%" PRIu32, ¶m) != 1) {
|
|
|
|
|
error << string_compose (_("%2: badly formatted node name in XML automation state, ignored"), _name) << endmsg;
|
|
|
|
|
continue;
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
if ((*niter)->name() == "AutomationList") {
|
|
|
|
|
|
2016-05-04 23:09:37 -04:00
|
|
|
XMLProperty const * id_prop = (*niter)->property("automation-id");
|
2008-06-02 21:41:35 +00:00
|
|
|
|
2008-09-29 22:47:40 +00:00
|
|
|
Evoral::Parameter param = (id_prop
|
2014-12-01 14:28:03 -05:00
|
|
|
? EventTypeMap::instance().from_symbol(id_prop->value())
|
2008-09-29 22:47:40 +00:00
|
|
|
: legacy_param);
|
|
|
|
|
|
2008-09-21 16:17:02 +00:00
|
|
|
if (param.type() == NullAutomation) {
|
|
|
|
|
warning << "Automation has null type" << endl;
|
|
|
|
|
continue;
|
2016-06-28 18:43:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_can_automate_list.find (param) == _can_automate_list.end ()) {
|
|
|
|
|
warning << "Ignored automation data for non-automatable parameter" << endl;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
if (!id_prop) {
|
|
|
|
|
warning << "AutomationList node without automation-id property, "
|
2008-09-29 22:47:40 +00:00
|
|
|
<< "using default: " << EventTypeMap::instance().to_symbol(legacy_param) << endmsg;
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
|
2011-01-27 01:31:03 +00:00
|
|
|
boost::shared_ptr<AutomationControl> existing = automation_control (param);
|
|
|
|
|
|
2008-10-03 03:16:19 +00:00
|
|
|
if (existing) {
|
2011-01-27 01:31:03 +00:00
|
|
|
existing->alist()->set_state (**niter, 3000);
|
2008-10-03 03:16:19 +00:00
|
|
|
} else {
|
2011-01-27 01:31:03 +00:00
|
|
|
boost::shared_ptr<Evoral::Control> newcontrol = control_factory(param);
|
|
|
|
|
add_control (newcontrol);
|
|
|
|
|
boost::shared_ptr<AutomationList> al (new AutomationList(**niter, param));
|
2008-10-03 03:16:19 +00:00
|
|
|
newcontrol->set_list(al);
|
|
|
|
|
}
|
2008-06-02 21:41:35 +00:00
|
|
|
|
|
|
|
|
} else {
|
2010-09-18 20:01:36 +00:00
|
|
|
error << "Expected AutomationList node, got '" << (*niter)->name() << "'" << endmsg;
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XMLNode&
|
2010-09-18 20:01:36 +00:00
|
|
|
Automatable::get_automation_xml_state ()
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
2012-07-25 17:48:55 +00:00
|
|
|
Glib::Threads::Mutex::Lock lm (control_lock());
|
2011-01-27 01:31:03 +00:00
|
|
|
XMLNode* node = new XMLNode (Automatable::xml_node_name);
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-09-21 16:17:02 +00:00
|
|
|
if (controls().empty()) {
|
2008-06-02 21:41:35 +00:00
|
|
|
return *node;
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-21 16:17:02 +00:00
|
|
|
for (Controls::iterator li = controls().begin(); li != controls().end(); ++li) {
|
2011-06-11 15:35:34 +00:00
|
|
|
boost::shared_ptr<AutomationList> l = boost::dynamic_pointer_cast<AutomationList>(li->second->list());
|
2017-01-09 14:07:15 +00:00
|
|
|
if (l) {
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
node->add_child_nocopy (l->get_state ());
|
|
|
|
|
}
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return *node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2008-09-29 22:47:40 +00:00
|
|
|
Automatable::set_parameter_automation_state (Evoral::Parameter param, AutoState s)
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
2012-07-25 17:48:55 +00:00
|
|
|
Glib::Threads::Mutex::Lock lm (control_lock());
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2012-07-13 21:05:45 +00:00
|
|
|
boost::shared_ptr<AutomationControl> c = automation_control (param, true);
|
2008-06-02 21:41:35 +00:00
|
|
|
|
2012-07-13 21:05:45 +00:00
|
|
|
if (c && (s != c->automation_state())) {
|
|
|
|
|
c->set_automation_state (s);
|
2008-09-21 16:17:02 +00:00
|
|
|
_a_session.set_dirty ();
|
2015-05-04 20:22:13 +02:00
|
|
|
AutomationStateChanged(); /* Emit signal */
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AutoState
|
2010-08-09 22:23:23 +00:00
|
|
|
Automatable::get_parameter_automation_state (Evoral::Parameter param)
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
|
|
|
|
AutoState result = Off;
|
|
|
|
|
|
2012-07-13 21:05:45 +00:00
|
|
|
boost::shared_ptr<AutomationControl> c = automation_control(param);
|
2015-10-05 16:17:49 +02:00
|
|
|
|
2010-08-09 22:23:23 +00:00
|
|
|
if (c) {
|
2012-07-13 21:05:45 +00:00
|
|
|
result = c->automation_state();
|
2010-08-09 22:23:23 +00:00
|
|
|
}
|
2008-06-02 21:41:35 +00:00
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Automatable::protect_automation ()
|
|
|
|
|
{
|
2008-09-19 00:47:49 +00:00
|
|
|
typedef set<Evoral::Parameter> ParameterSet;
|
2011-06-11 15:35:34 +00:00
|
|
|
const ParameterSet& automated_params = what_can_be_automated ();
|
2008-06-02 21:41:35 +00:00
|
|
|
|
2011-06-11 15:35:34 +00:00
|
|
|
for (ParameterSet::const_iterator i = automated_params.begin(); i != automated_params.end(); ++i) {
|
2008-06-02 21:41:35 +00:00
|
|
|
|
2008-09-19 00:47:49 +00:00
|
|
|
boost::shared_ptr<Evoral::Control> c = control(*i);
|
|
|
|
|
boost::shared_ptr<AutomationList> l = boost::dynamic_pointer_cast<AutomationList>(c->list());
|
2008-06-02 21:41:35 +00:00
|
|
|
|
2008-09-19 00:47:49 +00:00
|
|
|
switch (l->automation_state()) {
|
2008-06-02 21:41:35 +00:00
|
|
|
case Write:
|
2008-09-19 00:47:49 +00:00
|
|
|
l->set_automation_state (Off);
|
2008-06-02 21:41:35 +00:00
|
|
|
break;
|
|
|
|
|
case Touch:
|
2008-09-19 00:47:49 +00:00
|
|
|
l->set_automation_state (Play);
|
2008-06-02 21:41:35 +00:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2017-07-22 04:25:07 +02:00
|
|
|
Automatable::non_realtime_locate (framepos_t now)
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
2012-07-13 21:05:45 +00:00
|
|
|
for (Controls::iterator li = controls().begin(); li != controls().end(); ++li) {
|
|
|
|
|
|
|
|
|
|
boost::shared_ptr<AutomationControl> c
|
|
|
|
|
= boost::dynamic_pointer_cast<AutomationControl>(li->second);
|
|
|
|
|
if (c) {
|
2017-07-15 20:45:49 +02:00
|
|
|
boost::shared_ptr<AutomationList> l
|
2012-07-13 21:05:45 +00:00
|
|
|
= boost::dynamic_pointer_cast<AutomationList>(c->list());
|
2008-06-02 21:41:35 +00:00
|
|
|
|
2015-11-01 23:13:40 +11:00
|
|
|
if (l) {
|
2012-07-13 21:05:45 +00:00
|
|
|
l->start_write_pass (now);
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2017-07-22 04:45:48 +02:00
|
|
|
Automatable::non_realtime_transport_stop (framepos_t now, bool /*flush_processors*/)
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
2008-09-21 16:17:02 +00:00
|
|
|
for (Controls::iterator li = controls().begin(); li != controls().end(); ++li) {
|
2014-11-30 22:18:18 -05:00
|
|
|
boost::shared_ptr<AutomationControl> c =
|
|
|
|
|
boost::dynamic_pointer_cast<AutomationControl>(li->second);
|
|
|
|
|
if (!c) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2014-11-30 22:18:18 -05:00
|
|
|
boost::shared_ptr<AutomationList> l =
|
|
|
|
|
boost::dynamic_pointer_cast<AutomationList>(c->list());
|
|
|
|
|
if (!l) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2011-06-01 16:50:12 +00:00
|
|
|
|
2014-11-30 22:18:18 -05:00
|
|
|
/* Stop any active touch gesture just before we mark the write pass
|
|
|
|
|
as finished. If we don't do this, the transport can end up stopped with
|
|
|
|
|
an AutomationList thinking that a touch is still in progress and,
|
|
|
|
|
when the transport is re-started, a touch will magically
|
|
|
|
|
be happening without it ever have being started in the usual way.
|
|
|
|
|
*/
|
2015-09-27 00:57:52 +10:00
|
|
|
const bool list_did_write = !l->in_new_write_pass ();
|
|
|
|
|
|
2017-07-24 01:22:50 +02:00
|
|
|
l->stop_touch (now);
|
2015-10-03 05:08:26 +10:00
|
|
|
|
2015-11-02 02:12:54 +11:00
|
|
|
c->commit_transaction (list_did_write);
|
2014-11-30 22:18:18 -05:00
|
|
|
|
2015-10-03 05:08:26 +10:00
|
|
|
l->write_pass_finished (now, Config->get_automation_thinning_factor ());
|
|
|
|
|
|
|
|
|
|
if (l->automation_state () == Write) {
|
2014-11-30 22:18:18 -05:00
|
|
|
l->set_automation_state (Touch);
|
|
|
|
|
}
|
2015-10-03 01:18:59 +10:00
|
|
|
|
2015-10-03 05:08:26 +10:00
|
|
|
if (l->automation_playback ()) {
|
2015-10-21 23:06:40 -04:00
|
|
|
c->set_value_unchecked (c->list ()->eval (now));
|
2015-10-03 01:18:59 +10:00
|
|
|
}
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-15 20:45:49 +02:00
|
|
|
void
|
|
|
|
|
Automatable::automation_run (framepos_t start, pframes_t nframes)
|
|
|
|
|
{
|
|
|
|
|
for (Controls::iterator li = controls().begin(); li != controls().end(); ++li) {
|
|
|
|
|
boost::shared_ptr<AutomationControl> c =
|
|
|
|
|
boost::dynamic_pointer_cast<AutomationControl>(li->second);
|
|
|
|
|
if (!c) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
c->automation_run (start, nframes);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-19 00:47:49 +00:00
|
|
|
boost::shared_ptr<Evoral::Control>
|
2008-09-21 16:17:02 +00:00
|
|
|
Automatable::control_factory(const Evoral::Parameter& param)
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
2014-12-01 14:28:03 -05:00
|
|
|
Evoral::Control* control = NULL;
|
|
|
|
|
bool make_list = true;
|
|
|
|
|
ParameterDescriptor desc(param);
|
|
|
|
|
boost::shared_ptr<AutomationList> list;
|
2016-04-09 16:16:22 -04:00
|
|
|
|
2008-09-21 18:08:18 +00:00
|
|
|
if (param.type() >= MidiCCAutomation && param.type() <= MidiChannelPressureAutomation) {
|
2009-10-23 20:11:56 +00:00
|
|
|
MidiTrack* mt = dynamic_cast<MidiTrack*>(this);
|
|
|
|
|
if (mt) {
|
|
|
|
|
control = new MidiTrack::MidiControl(mt, param);
|
2014-12-01 14:28:03 -05:00
|
|
|
make_list = false; // No list, this is region "automation"
|
2009-10-23 20:11:56 +00:00
|
|
|
}
|
2008-09-29 01:22:21 +00:00
|
|
|
} else if (param.type() == PluginAutomation) {
|
2009-10-23 20:11:56 +00:00
|
|
|
PluginInsert* pi = dynamic_cast<PluginInsert*>(this);
|
|
|
|
|
if (pi) {
|
2014-11-01 23:29:10 -04:00
|
|
|
pi->plugin(0)->get_parameter_descriptor(param.id(), desc);
|
|
|
|
|
control = new PluginInsert::PluginControl(pi, param, desc);
|
2009-10-23 20:11:56 +00:00
|
|
|
} else {
|
|
|
|
|
warning << "PluginAutomation for non-Plugin" << endl;
|
|
|
|
|
}
|
2014-11-01 23:29:10 -04:00
|
|
|
} else if (param.type() == PluginPropertyAutomation) {
|
|
|
|
|
PluginInsert* pi = dynamic_cast<PluginInsert*>(this);
|
|
|
|
|
if (pi) {
|
|
|
|
|
desc = pi->plugin(0)->get_property_descriptor(param.id());
|
2014-11-07 17:21:43 -05:00
|
|
|
if (desc.datatype != Variant::NOTHING) {
|
2014-11-01 23:29:10 -04:00
|
|
|
if (!Variant::type_is_numeric(desc.datatype)) {
|
2014-12-01 14:28:03 -05:00
|
|
|
make_list = false; // Can't automate non-numeric data yet
|
|
|
|
|
} else {
|
|
|
|
|
list = boost::shared_ptr<AutomationList>(new AutomationList(param, desc));
|
2014-11-01 23:29:10 -04:00
|
|
|
}
|
|
|
|
|
control = new PluginInsert::PluginPropertyControl(pi, param, desc, list);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
warning << "PluginPropertyAutomation for non-Plugin" << endl;
|
|
|
|
|
}
|
2008-10-03 03:16:19 +00:00
|
|
|
} else if (param.type() == GainAutomation) {
|
2016-01-12 22:04:18 -05:00
|
|
|
control = new GainControl(_a_session, param);
|
2015-04-25 21:24:58 +02:00
|
|
|
} else if (param.type() == TrimAutomation) {
|
2016-01-12 22:04:18 -05:00
|
|
|
control = new GainControl(_a_session, param);
|
2011-01-27 01:31:03 +00:00
|
|
|
} else if (param.type() == PanAzimuthAutomation || param.type() == PanWidthAutomation || param.type() == PanElevationAutomation) {
|
|
|
|
|
Pannable* pannable = dynamic_cast<Pannable*>(this);
|
|
|
|
|
if (pannable) {
|
|
|
|
|
control = new PanControllable (_a_session, pannable->describe_parameter (param), pannable, param);
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
} else {
|
2011-01-27 01:31:03 +00:00
|
|
|
warning << "PanAutomation for non-Pannable" << endl;
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
}
|
2016-04-09 16:16:22 -04:00
|
|
|
} else if (param.type() == RecEnableAutomation) {
|
|
|
|
|
Recordable* re = dynamic_cast<Recordable*> (this);
|
|
|
|
|
if (re) {
|
|
|
|
|
control = new RecordEnableControl (_a_session, X_("recenable"), *re);
|
|
|
|
|
}
|
|
|
|
|
} else if (param.type() == MonitoringAutomation) {
|
|
|
|
|
Monitorable* m = dynamic_cast<Monitorable*>(this);
|
|
|
|
|
if (m) {
|
|
|
|
|
control = new MonitorControl (_a_session, X_("monitor"), *m);
|
|
|
|
|
}
|
|
|
|
|
} else if (param.type() == SoloAutomation) {
|
|
|
|
|
Soloable* s = dynamic_cast<Soloable*>(this);
|
|
|
|
|
Muteable* m = dynamic_cast<Muteable*>(this);
|
|
|
|
|
if (s && m) {
|
|
|
|
|
control = new SoloControl (_a_session, X_("solo"), *s, *m);
|
|
|
|
|
}
|
|
|
|
|
} else if (param.type() == MuteAutomation) {
|
|
|
|
|
Muteable* m = dynamic_cast<Muteable*>(this);
|
|
|
|
|
if (m) {
|
|
|
|
|
control = new MuteControl (_a_session, X_("mute"), *m);
|
|
|
|
|
}
|
2009-10-23 20:11:56 +00:00
|
|
|
}
|
|
|
|
|
|
2014-12-01 14:28:03 -05:00
|
|
|
if (make_list && !list) {
|
|
|
|
|
list = boost::shared_ptr<AutomationList>(new AutomationList(param, desc));
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-23 20:11:56 +00:00
|
|
|
if (!control) {
|
2014-12-01 14:28:03 -05:00
|
|
|
control = new AutomationControl(_a_session, param, desc, list);
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
2009-10-23 20:11:56 +00:00
|
|
|
|
2008-09-21 16:17:02 +00:00
|
|
|
return boost::shared_ptr<Evoral::Control>(control);
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
|
2017-05-05 12:31:21 +01:00
|
|
|
boost::shared_ptr<AutomationControl>
|
|
|
|
|
Automatable::automation_control (PBD::ID const & id) const
|
|
|
|
|
{
|
|
|
|
|
Controls::const_iterator li;
|
|
|
|
|
|
|
|
|
|
for (li = _controls.begin(); li != _controls.end(); ++li) {
|
|
|
|
|
boost::shared_ptr<AutomationControl> ac = boost::dynamic_pointer_cast<AutomationControl> (li->second);
|
|
|
|
|
if (ac && (ac->id() == id)) {
|
|
|
|
|
return ac;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return boost::shared_ptr<AutomationControl>();
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-13 17:29:22 +00:00
|
|
|
boost::shared_ptr<AutomationControl>
|
|
|
|
|
Automatable::automation_control (const Evoral::Parameter& id, bool create)
|
|
|
|
|
{
|
|
|
|
|
return boost::dynamic_pointer_cast<AutomationControl>(Evoral::ControlSet::control(id, create));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boost::shared_ptr<const AutomationControl>
|
|
|
|
|
Automatable::automation_control (const Evoral::Parameter& id) const
|
|
|
|
|
{
|
|
|
|
|
return boost::dynamic_pointer_cast<const AutomationControl>(Evoral::ControlSet::control(id));
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-12 00:41:45 +00:00
|
|
|
void
|
|
|
|
|
Automatable::clear_controls ()
|
|
|
|
|
{
|
|
|
|
|
_control_connections.drop_connections ();
|
|
|
|
|
ControlSet::clear_controls ();
|
|
|
|
|
}
|
2011-01-27 18:48:33 +00:00
|
|
|
|
2015-10-07 10:42:28 +02:00
|
|
|
bool
|
|
|
|
|
Automatable::find_next_event (double now, double end, Evoral::ControlEvent& next_event, bool only_active) const
|
|
|
|
|
{
|
|
|
|
|
Controls::const_iterator li;
|
|
|
|
|
|
|
|
|
|
next_event.when = std::numeric_limits<double>::max();
|
|
|
|
|
|
|
|
|
|
for (li = _controls.begin(); li != _controls.end(); ++li) {
|
|
|
|
|
boost::shared_ptr<AutomationControl> c
|
|
|
|
|
= boost::dynamic_pointer_cast<AutomationControl>(li->second);
|
|
|
|
|
|
|
|
|
|
if (only_active && (!c || !c->automation_playback())) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-30 15:13:37 +02:00
|
|
|
boost::shared_ptr<SlavableAutomationControl> sc
|
|
|
|
|
= boost::dynamic_pointer_cast<SlavableAutomationControl>(li->second);
|
|
|
|
|
|
|
|
|
|
if (sc) {
|
|
|
|
|
sc->find_next_event (now, end, next_event);
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-07 10:42:28 +02:00
|
|
|
Evoral::ControlList::const_iterator i;
|
|
|
|
|
boost::shared_ptr<const Evoral::ControlList> alist (li->second->list());
|
|
|
|
|
Evoral::ControlEvent cp (now, 0.0f);
|
|
|
|
|
if (!alist) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = lower_bound (alist->begin(), alist->end(), &cp, Evoral::ControlList::time_comparator);
|
|
|
|
|
i != alist->end() && (*i)->when < end; ++i) {
|
|
|
|
|
if ((*i)->when > now) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (i != alist->end() && (*i)->when < end) {
|
|
|
|
|
if ((*i)->when < next_event.when) {
|
|
|
|
|
next_event.when = (*i)->when;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return next_event.when != std::numeric_limits<double>::max();
|
|
|
|
|
}
|