2008-06-02 21:41:35 +00:00
|
|
|
/*
|
2009-10-14 16:10:01 +00:00
|
|
|
Copyright (C) 2000 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.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
2009-07-13 00:26:28 +00:00
|
|
|
#ifdef WAF_BUILD
|
|
|
|
|
#include "libardour-config.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "pbd/xml++.h"
|
|
|
|
|
|
2012-05-24 06:09:29 +00:00
|
|
|
#include "ardour/automatable.h"
|
|
|
|
|
#include "ardour/chan_count.h"
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "ardour/processor.h"
|
2012-05-24 06:09:29 +00:00
|
|
|
#include "ardour/types.h"
|
2008-06-02 21:41:35 +00:00
|
|
|
|
2011-11-21 17:42:29 +00:00
|
|
|
#ifdef WINDOWS_VST_SUPPORT
|
|
|
|
|
#include "ardour/windows_vst_plugin.h"
|
2008-06-02 21:41:35 +00:00
|
|
|
#endif
|
|
|
|
|
|
2011-10-18 15:08:42 +00:00
|
|
|
#ifdef AUDIOUNIT_SUPPORT
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "ardour/audio_unit.h"
|
2008-06-02 21:41:35 +00:00
|
|
|
#endif
|
|
|
|
|
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "ardour/audioengine.h"
|
|
|
|
|
#include "ardour/session.h"
|
|
|
|
|
#include "ardour/types.h"
|
2008-06-02 21:41:35 +00:00
|
|
|
|
|
|
|
|
#include "i18n.h"
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
using namespace ARDOUR;
|
|
|
|
|
using namespace PBD;
|
|
|
|
|
|
2012-05-24 06:09:29 +00:00
|
|
|
namespace ARDOUR { class Session; }
|
|
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
// Always saved as Processor, but may be IOProcessor or Send in legacy sessions
|
|
|
|
|
const string Processor::state_node_name = "Processor";
|
|
|
|
|
|
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
|
|
|
Processor::Processor(Session& session, const string& name)
|
2008-09-21 16:17:02 +00:00
|
|
|
: SessionObject(session, name)
|
2010-07-13 01:26:30 +00:00
|
|
|
, Automatable (session)
|
2009-07-21 14:39:21 +00:00
|
|
|
, _pending_active(false)
|
2008-06-02 21:41:35 +00:00
|
|
|
, _active(false)
|
|
|
|
|
, _next_ab_is_active(false)
|
|
|
|
|
, _configured(false)
|
2009-11-18 20:01:37 +00:00
|
|
|
, _display_to_user (true)
|
2010-05-17 23:28:13 +00:00
|
|
|
, _pre_fader (false)
|
2011-04-13 01:44:46 +00:00
|
|
|
, _ui_pointer (0)
|
2013-11-22 18:22:55 +01:00
|
|
|
, _owner (0)
|
2011-02-01 02:41:31 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Processor::Processor (const Processor& other)
|
2011-02-07 01:12:55 +00:00
|
|
|
: Evoral::ControlSet (other)
|
|
|
|
|
, SessionObject (other.session(), other.name())
|
2011-02-01 02:41:31 +00:00
|
|
|
, Automatable (other.session())
|
2011-09-30 17:55:14 +00:00
|
|
|
, Latent (other)
|
2011-02-01 02:41:31 +00:00
|
|
|
, _pending_active(other._pending_active)
|
|
|
|
|
, _active(other._active)
|
|
|
|
|
, _next_ab_is_active(false)
|
|
|
|
|
, _configured(false)
|
|
|
|
|
, _display_to_user (true)
|
|
|
|
|
, _pre_fader (false)
|
2011-04-13 01:44:46 +00:00
|
|
|
, _ui_pointer (0)
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XMLNode&
|
|
|
|
|
Processor::get_state (void)
|
|
|
|
|
{
|
|
|
|
|
return state (true);
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-14 16:10:01 +00:00
|
|
|
/* NODE STRUCTURE
|
|
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
<Automation [optionally with visible="...." ]>
|
|
|
|
|
<parameter-N>
|
|
|
|
|
<AutomationList id=N>
|
|
|
|
|
<events>
|
|
|
|
|
X1 Y1
|
|
|
|
|
X2 Y2
|
|
|
|
|
....
|
|
|
|
|
</events>
|
|
|
|
|
</parameter-N>
|
|
|
|
|
<Automation>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
XMLNode&
|
|
|
|
|
Processor::state (bool full_state)
|
|
|
|
|
{
|
|
|
|
|
XMLNode* node = new XMLNode (state_node_name);
|
|
|
|
|
char buf[64];
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
id().print (buf, sizeof (buf));
|
|
|
|
|
node->add_property("id", buf);
|
|
|
|
|
node->add_property("name", _name);
|
2009-10-14 16:10:01 +00:00
|
|
|
node->add_property("active", active() ? "yes" : "no");
|
2008-06-02 21:41:35 +00:00
|
|
|
|
|
|
|
|
if (_extra_xml){
|
|
|
|
|
node->add_child_copy (*_extra_xml);
|
|
|
|
|
}
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
if (full_state) {
|
2010-09-18 20:01:36 +00:00
|
|
|
XMLNode& automation = Automatable::get_automation_xml_state();
|
2011-06-11 15:35:34 +00:00
|
|
|
if (!automation.children().empty() || !automation.properties().empty()) {
|
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 (automation);
|
|
|
|
|
}
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
|
2011-07-15 00:03:18 +00:00
|
|
|
snprintf (buf, sizeof (buf), "%" PRId64, _user_latency);
|
|
|
|
|
node->add_property("user-latency", buf);
|
|
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
return *node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2009-10-21 00:15:42 +00:00
|
|
|
Processor::set_state_2X (const XMLNode & node, int /*version*/)
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
2009-10-15 00:57:55 +00:00
|
|
|
XMLProperty const * prop;
|
|
|
|
|
|
|
|
|
|
XMLNodeList children = node.children ();
|
2012-03-13 20:14:55 +00:00
|
|
|
|
2009-10-15 00:57:55 +00:00
|
|
|
for (XMLNodeIterator i = children.begin(); i != children.end(); ++i) {
|
|
|
|
|
|
|
|
|
|
if ((*i)->name() == X_("IO")) {
|
2012-03-13 20:14:55 +00:00
|
|
|
|
2009-10-15 00:57:55 +00:00
|
|
|
if ((prop = (*i)->property ("name")) != 0) {
|
|
|
|
|
set_name (prop->value ());
|
|
|
|
|
}
|
2012-03-13 20:14:55 +00:00
|
|
|
|
2011-10-18 13:18:47 +00:00
|
|
|
set_id (**i);
|
2009-10-15 00:57:55 +00:00
|
|
|
|
|
|
|
|
if ((prop = (*i)->property ("active")) != 0) {
|
2010-08-07 23:31:33 +00:00
|
|
|
bool const a = string_is_affirmative (prop->value ());
|
|
|
|
|
if (_active != a) {
|
|
|
|
|
if (a) {
|
|
|
|
|
activate ();
|
|
|
|
|
} else {
|
|
|
|
|
deactivate ();
|
|
|
|
|
}
|
2009-10-15 00:57:55 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
Processor::set_state (const XMLNode& node, int version)
|
|
|
|
|
{
|
|
|
|
|
if (version < 3000) {
|
|
|
|
|
return set_state_2X (node, version);
|
|
|
|
|
}
|
2011-06-01 16:50:12 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
const XMLProperty *prop;
|
2008-07-16 19:49:19 +00:00
|
|
|
const XMLProperty *legacy_active = 0;
|
2012-03-13 20:14:55 +00:00
|
|
|
bool leave_name_alone = (node.property ("ignore-name") != 0);
|
|
|
|
|
|
|
|
|
|
if (!leave_name_alone) {
|
|
|
|
|
// may not exist for legacy 3.0 sessions
|
|
|
|
|
if ((prop = node.property ("name")) != 0) {
|
|
|
|
|
/* don't let derived classes have a crack at set_name,
|
|
|
|
|
as some (like Send) will screw with the one we suggest.
|
|
|
|
|
*/
|
|
|
|
|
Processor::set_name (prop->value());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set_id (node);
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XMLNodeList nlist = node.children();
|
|
|
|
|
XMLNodeIterator niter;
|
|
|
|
|
|
2011-06-11 15:35:34 +00:00
|
|
|
Stateful::save_extra_xml (node);
|
|
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
|
|
|
|
|
|
|
|
|
|
if ((*niter)->name() == X_("Automation")) {
|
|
|
|
|
|
|
|
|
|
XMLProperty *prop;
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
if ((prop = (*niter)->property ("path")) != 0) {
|
|
|
|
|
old_set_automation_state (*(*niter));
|
|
|
|
|
} else {
|
2010-09-18 20:01:36 +00:00
|
|
|
set_automation_xml_state (*(*niter), Evoral::Parameter(PluginAutomation));
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-16 19:49:19 +00:00
|
|
|
} else if ((*niter)->name() == "Redirect") {
|
|
|
|
|
if ( !(legacy_active = (*niter)->property("active"))) {
|
|
|
|
|
error << string_compose(_("No %1 property flag in element %2"), "active", (*niter)->name()) << endl;
|
|
|
|
|
}
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((prop = node.property ("active")) == 0) {
|
2008-07-16 19:49:19 +00:00
|
|
|
if (legacy_active) {
|
|
|
|
|
prop = legacy_active;
|
|
|
|
|
} else {
|
|
|
|
|
error << _("No child node with active property") << endmsg;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
|
2010-08-07 23:31:33 +00:00
|
|
|
bool const a = string_is_affirmative (prop->value ());
|
|
|
|
|
if (_active != a) {
|
|
|
|
|
if (a) {
|
|
|
|
|
activate ();
|
|
|
|
|
} else {
|
|
|
|
|
deactivate ();
|
|
|
|
|
}
|
2009-10-14 16:10:01 +00:00
|
|
|
}
|
2008-07-16 19:49:19 +00:00
|
|
|
|
2011-07-15 00:03:18 +00:00
|
|
|
if ((prop = node.property ("user-latency")) != 0) {
|
|
|
|
|
_user_latency = atoi (prop->value ());
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-25 10:15:54 +00:00
|
|
|
/** @pre Caller must hold process lock */
|
2008-09-10 15:03:30 +00:00
|
|
|
bool
|
|
|
|
|
Processor::configure_io (ChanCount in, ChanCount out)
|
|
|
|
|
{
|
2009-05-04 15:50:51 +00:00
|
|
|
/* This class assumes 1:1 input:output.static output stream count.
|
|
|
|
|
Derived classes must override and set _configured_output appropriately
|
2009-10-14 16:10:01 +00:00
|
|
|
if this is not the case
|
2009-06-09 20:21:19 +00:00
|
|
|
*/
|
2008-09-10 15:03:30 +00:00
|
|
|
|
2009-10-14 16:10:01 +00:00
|
|
|
_configured_input = in;
|
|
|
|
|
_configured_output = out;
|
2008-09-10 15:03:30 +00:00
|
|
|
_configured = true;
|
|
|
|
|
|
2009-12-17 18:24:23 +00:00
|
|
|
ConfigurationChanged (in, out); /* EMIT SIGNAL */
|
2009-05-04 17:05:55 +00:00
|
|
|
|
2008-09-10 15:03:30 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
2009-11-18 20:01:37 +00:00
|
|
|
|
|
|
|
|
void
|
2011-06-01 16:50:12 +00:00
|
|
|
Processor::set_display_to_user (bool yn)
|
2009-11-18 20:01:37 +00:00
|
|
|
{
|
|
|
|
|
_display_to_user = yn;
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-17 23:28:13 +00:00
|
|
|
void
|
|
|
|
|
Processor::set_pre_fader (bool p)
|
|
|
|
|
{
|
|
|
|
|
_pre_fader = p;
|
|
|
|
|
}
|
2011-02-01 02:41:31 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Processor::set_ui (void* p)
|
|
|
|
|
{
|
2011-04-13 01:44:46 +00:00
|
|
|
_ui_pointer = p;
|
2011-02-01 02:41:31 +00:00
|
|
|
}
|
2013-10-14 11:12:50 -04:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Processor::set_owner (SessionObject* o)
|
|
|
|
|
{
|
|
|
|
|
_owner = o;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SessionObject*
|
|
|
|
|
Processor::owner() const
|
|
|
|
|
{
|
|
|
|
|
return _owner;
|
|
|
|
|
}
|