2008-06-02 21:41:35 +00:00
|
|
|
/*
|
2009-10-14 16:10:01 +00:00
|
|
|
Copyright (C) 2001 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.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
2012-05-24 06:09:29 +00:00
|
|
|
#include <list>
|
2008-06-02 21:41:35 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "pbd/xml++.h"
|
|
|
|
|
#include "pbd/enumwriter.h"
|
|
|
|
|
|
2012-05-24 06:09:29 +00:00
|
|
|
#include "ardour/chan_count.h"
|
|
|
|
|
#include "ardour/data_type.h"
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "ardour/io.h"
|
2012-05-24 06:09:29 +00:00
|
|
|
#include "ardour/io_processor.h"
|
|
|
|
|
#include "ardour/processor.h"
|
2009-05-13 21:34:09 +00:00
|
|
|
#include "ardour/route.h"
|
2012-05-24 06:09:29 +00:00
|
|
|
#include "ardour/session_object.h"
|
|
|
|
|
#include "ardour/types.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;
|
|
|
|
|
|
2012-05-24 06:09:29 +00:00
|
|
|
namespace ARDOUR { class Session; }
|
|
|
|
|
|
2009-05-13 21:34:09 +00:00
|
|
|
/* create an IOProcessor that proxies to a new IO object */
|
|
|
|
|
|
2009-06-09 20:21:19 +00:00
|
|
|
IOProcessor::IOProcessor (Session& s, bool with_input, bool with_output,
|
2012-07-17 13:59:46 +00:00
|
|
|
const string& proc_name, const string io_name, DataType dtype, bool sendish)
|
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(s, proc_name)
|
|
|
|
|
{
|
2009-06-09 20:21:19 +00:00
|
|
|
/* these are true in this constructor whether we actually create the associated
|
|
|
|
|
IO objects or not.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
_own_input = true;
|
|
|
|
|
_own_output = true;
|
|
|
|
|
|
|
|
|
|
if (with_input) {
|
2012-07-17 13:59:46 +00:00
|
|
|
_input.reset (new IO(s, io_name.empty() ? proc_name : io_name, IO::Input, dtype, sendish));
|
2009-06-09 20:21:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (with_output) {
|
2012-07-17 13:59:46 +00:00
|
|
|
_output.reset (new IO(s, io_name.empty() ? proc_name : io_name, IO::Output, dtype, sendish));
|
2009-06-09 20:21:19 +00:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
2009-05-13 21:34:09 +00:00
|
|
|
/* create an IOProcessor that proxies to an existing IO object */
|
|
|
|
|
|
2009-10-14 16:10:01 +00:00
|
|
|
IOProcessor::IOProcessor (Session& s, boost::shared_ptr<IO> in, boost::shared_ptr<IO> out,
|
2009-07-21 15:55:17 +00:00
|
|
|
const string& proc_name, DataType /*dtype*/)
|
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(s, proc_name)
|
2009-06-09 20:21:19 +00:00
|
|
|
, _input (in)
|
|
|
|
|
, _output (out)
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
2009-06-16 14:58:33 +00:00
|
|
|
if (in) {
|
|
|
|
|
_own_input = false;
|
|
|
|
|
} else {
|
|
|
|
|
_own_input = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (out) {
|
|
|
|
|
_own_output = false;
|
|
|
|
|
} else {
|
|
|
|
|
_own_output = true;
|
|
|
|
|
}
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IOProcessor::~IOProcessor ()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-13 21:34:09 +00:00
|
|
|
void
|
2009-06-09 20:21:19 +00:00
|
|
|
IOProcessor::set_input (boost::shared_ptr<IO> io)
|
|
|
|
|
{
|
|
|
|
|
/* CALLER MUST HOLD PROCESS LOCK */
|
|
|
|
|
|
|
|
|
|
_input = io;
|
|
|
|
|
_own_input = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
IOProcessor::set_output (boost::shared_ptr<IO> io)
|
2009-05-13 21:34:09 +00:00
|
|
|
{
|
|
|
|
|
/* CALLER MUST HOLD PROCESS LOCK */
|
|
|
|
|
|
2009-06-09 20:21:19 +00:00
|
|
|
_output = io;
|
|
|
|
|
_own_output = false;
|
2009-05-13 21:34:09 +00:00
|
|
|
}
|
|
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
XMLNode&
|
2017-10-04 00:35:29 +02:00
|
|
|
IOProcessor::state ()
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
2017-10-04 00:35:29 +02:00
|
|
|
XMLNode& node (Processor::state ());
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2016-08-27 15:54:48 +10:00
|
|
|
node.set_property ("own-input", _own_input);
|
|
|
|
|
|
|
|
|
|
if (_input) {
|
|
|
|
|
if (_own_input) {
|
2017-10-04 00:35:29 +02:00
|
|
|
XMLNode& i (_input->get_state ());
|
2009-06-16 14:58:33 +00:00
|
|
|
// i.name() = X_("output");
|
|
|
|
|
node.add_child_nocopy (i);
|
2016-08-27 15:54:48 +10:00
|
|
|
} else {
|
|
|
|
|
node.set_property ("input", _input->name ());
|
2009-06-09 20:21:19 +00:00
|
|
|
}
|
|
|
|
|
}
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2016-08-27 15:54:48 +10:00
|
|
|
node.set_property ("own-output", _own_output);
|
|
|
|
|
|
|
|
|
|
if (_output) {
|
|
|
|
|
if (_own_output) {
|
2017-10-04 00:35:29 +02:00
|
|
|
XMLNode& o (_output->get_state ());
|
2009-06-16 14:58:33 +00:00
|
|
|
node.add_child_nocopy (o);
|
2016-08-27 15:54:48 +10:00
|
|
|
} else {
|
|
|
|
|
node.set_property ("output", _output->name ());
|
2009-06-09 20:21:19 +00:00
|
|
|
}
|
2009-05-13 21:34:09 +00:00
|
|
|
}
|
2008-06-02 21:41:35 +00:00
|
|
|
|
|
|
|
|
return node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2009-10-15 00:57:55 +00:00
|
|
|
IOProcessor::set_state (const XMLNode& node, int version)
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
2010-09-03 15:34:09 +00:00
|
|
|
if (version < 3000) {
|
|
|
|
|
return set_state_2X (node, version);
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-04 23:09:37 -04:00
|
|
|
XMLProperty const * prop;
|
2008-07-16 19:49:19 +00:00
|
|
|
const XMLNode *io_node = 0;
|
2008-06-02 21:41:35 +00:00
|
|
|
|
2009-10-15 18:56:11 +00:00
|
|
|
Processor::set_state(node, version);
|
2008-06-02 21:41:35 +00:00
|
|
|
|
2017-03-31 19:53:14 +02:00
|
|
|
bool ignore_name = node.property ("ignore-name");
|
2012-03-15 02:31:09 +00:00
|
|
|
|
2016-08-27 15:54:48 +10:00
|
|
|
node.get_property ("own-input", _own_input);
|
|
|
|
|
node.get_property ("own-output", _own_output);
|
2009-05-13 21:34:09 +00:00
|
|
|
|
2009-06-09 20:21:19 +00:00
|
|
|
/* don't attempt to set state for a proxied IO that we don't own */
|
|
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
XMLNodeList nlist = node.children();
|
|
|
|
|
XMLNodeIterator niter;
|
2009-11-21 17:20:57 +00:00
|
|
|
const string instr = enum_2_string (IO::Input);
|
|
|
|
|
const string outstr = enum_2_string (IO::Output);
|
2015-10-05 16:17:49 +02:00
|
|
|
|
2016-08-27 15:54:48 +10:00
|
|
|
std::string str;
|
2016-04-03 03:06:15 +02:00
|
|
|
if (_own_input && _input) {
|
2009-06-09 20:21:19 +00:00
|
|
|
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
|
2017-04-20 22:47:45 +02:00
|
|
|
if ((*niter)->get_property ("name", str) && (_name == str || ignore_name)) {
|
2016-08-27 15:54:48 +10:00
|
|
|
if ((*niter)->get_property ("direction", str) && str == instr) {
|
|
|
|
|
io_node = (*niter);
|
|
|
|
|
break;
|
2009-11-21 17:20:57 +00:00
|
|
|
}
|
2009-06-09 20:21:19 +00:00
|
|
|
}
|
|
|
|
|
}
|
2015-10-05 16:17:49 +02:00
|
|
|
|
2009-06-09 20:21:19 +00:00
|
|
|
if (io_node) {
|
2009-10-15 18:56:11 +00:00
|
|
|
_input->set_state(*io_node, version);
|
2015-10-05 16:17:49 +02:00
|
|
|
|
2009-06-09 20:21:19 +00:00
|
|
|
// legacy sessions: use IO name
|
|
|
|
|
if ((prop = node.property ("name")) == 0) {
|
|
|
|
|
set_name (_input->name());
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
2015-10-05 16:17:49 +02:00
|
|
|
|
2009-06-09 20:21:19 +00:00
|
|
|
} else {
|
2009-11-21 17:20:57 +00:00
|
|
|
/* no input, which is OK */
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
2015-10-05 16:17:49 +02:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
2015-10-05 16:17:49 +02:00
|
|
|
|
2016-04-03 03:06:15 +02:00
|
|
|
if (_own_output && _output) {
|
2009-06-09 20:21:19 +00:00
|
|
|
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
|
2009-11-21 17:20:57 +00:00
|
|
|
if ((*niter)->name() == "IO") {
|
2017-04-20 22:47:45 +02:00
|
|
|
if ((*niter)->get_property ("name", str) && (_name == str || ignore_name)) {
|
2016-08-27 15:54:48 +10:00
|
|
|
if ((*niter)->get_property ("direction", str) && str == outstr) {
|
|
|
|
|
io_node = (*niter);
|
|
|
|
|
break;
|
2009-11-21 17:20:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
2009-06-09 20:21:19 +00:00
|
|
|
}
|
2008-07-16 19:49:19 +00:00
|
|
|
}
|
2015-10-05 16:17:49 +02:00
|
|
|
|
2009-06-09 20:21:19 +00:00
|
|
|
if (io_node) {
|
2009-10-15 18:56:11 +00:00
|
|
|
_output->set_state(*io_node, version);
|
2015-10-05 16:17:49 +02:00
|
|
|
|
2009-06-09 20:21:19 +00:00
|
|
|
// legacy sessions: use IO name
|
|
|
|
|
if ((prop = node.property ("name")) == 0) {
|
|
|
|
|
set_name (_output->name());
|
|
|
|
|
}
|
2009-06-16 14:58:33 +00:00
|
|
|
} else {
|
2009-11-21 17:20:57 +00:00
|
|
|
/* no output, which is OK */
|
2009-06-16 14:58:33 +00:00
|
|
|
}
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-03 15:34:09 +00:00
|
|
|
int
|
|
|
|
|
IOProcessor::set_state_2X (const XMLNode& node, int version)
|
|
|
|
|
{
|
|
|
|
|
_own_input = _own_output = true;
|
|
|
|
|
|
|
|
|
|
Processor::set_state_2X (node, version);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
void
|
2017-09-18 12:39:17 -04:00
|
|
|
IOProcessor::silence (samplecnt_t nframes, samplepos_t /* start_sample */)
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
2009-06-09 20:21:19 +00:00
|
|
|
if (_own_output && _output) {
|
|
|
|
|
_output->silence (nframes);
|
2009-05-13 21:34:09 +00:00
|
|
|
}
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
2009-01-30 20:18:31 +00:00
|
|
|
|
|
|
|
|
ChanCount
|
|
|
|
|
IOProcessor::natural_output_streams() const
|
|
|
|
|
{
|
2009-06-09 20:21:19 +00:00
|
|
|
return _output ? _output->n_ports() : ChanCount::ZERO;
|
2009-01-30 20:18:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ChanCount
|
|
|
|
|
IOProcessor::natural_input_streams () const
|
|
|
|
|
{
|
2009-06-09 20:21:19 +00:00
|
|
|
return _input ? _input->n_ports() : ChanCount::ZERO;
|
2009-01-30 20:18:31 +00:00
|
|
|
}
|
|
|
|
|
|
2009-05-13 21:34:09 +00:00
|
|
|
bool
|
|
|
|
|
IOProcessor::set_name (const std::string& name)
|
|
|
|
|
{
|
|
|
|
|
bool ret = SessionObject::set_name (name);
|
|
|
|
|
|
2009-06-09 20:21:19 +00:00
|
|
|
if (ret && _own_input && _input) {
|
|
|
|
|
ret = _input->set_name (name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ret && _own_output && _output) {
|
|
|
|
|
ret = _output->set_name (name);
|
2009-05-13 21:34:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2009-06-16 14:58:33 +00:00
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
IOProcessor::feeds (boost::shared_ptr<Route> other) const
|
|
|
|
|
{
|
|
|
|
|
return _output && _output->connected_to (other->input());
|
|
|
|
|
}
|
2009-07-15 20:29:02 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
IOProcessor::disconnect ()
|
|
|
|
|
{
|
|
|
|
|
if (_input) {
|
|
|
|
|
_input->disconnect (this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_output) {
|
|
|
|
|
_output->disconnect (this);
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-03-15 02:31:09 +00:00
|
|
|
|
|
|
|
|
/** Set up the XML description of a send so that we will not
|
|
|
|
|
* reset its name or bitslot during ::set_state()
|
|
|
|
|
* @param state XML send state.
|
|
|
|
|
* @param session Session.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
IOProcessor::prepare_for_reset (XMLNode &state, const std::string& name)
|
|
|
|
|
{
|
2016-08-27 15:54:48 +10:00
|
|
|
state.set_property ("ignore-bitslot", true);
|
|
|
|
|
state.set_property ("ignore-name", true);
|
2012-03-15 02:31:09 +00:00
|
|
|
|
|
|
|
|
XMLNode* io_node = state.child (IO::state_node_name.c_str());
|
|
|
|
|
|
|
|
|
|
if (io_node) {
|
2012-03-16 22:36:06 +00:00
|
|
|
IO::prepare_for_reset (*io_node, name);
|
2012-03-15 02:31:09 +00:00
|
|
|
}
|
|
|
|
|
}
|