projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Properly announce support for Vendor string
[ardour.git]
/
libs
/
ardour
/
io_processor.cc
diff --git
a/libs/ardour/io_processor.cc
b/libs/ardour/io_processor.cc
index d5e0f3e0eb7b2ec432666b02b54dbb56ff30b641..e87b5a59127c2b3651a966269f516ebf971c230a 100644
(file)
--- a/
libs/ardour/io_processor.cc
+++ b/
libs/ardour/io_processor.cc
@@
-17,36
+17,33
@@
*/
*/
-#include <fstream>
-#include <algorithm>
+#include <list>
#include <string>
#include <string>
-#include <cerrno>
-#include <unistd.h>
-#include <sstream>
-
#include "pbd/xml++.h"
#include "pbd/enumwriter.h"
#include "pbd/xml++.h"
#include "pbd/enumwriter.h"
-#include "ardour/io_processor.h"
-#include "ardour/session.h"
-#include "ardour/utils.h"
-#include "ardour/send.h"
-#include "ardour/port_insert.h"
-#include "ardour/plugin_insert.h"
+#include "ardour/chan_count.h"
+#include "ardour/data_type.h"
#include "ardour/io.h"
#include "ardour/io.h"
+#include "ardour/io_processor.h"
+#include "ardour/processor.h"
#include "ardour/route.h"
#include "ardour/route.h"
+#include "ardour/session_object.h"
+#include "ardour/types.h"
-#include "i18n.h"
+#include "
pbd/
i18n.h"
using namespace std;
using namespace ARDOUR;
using namespace PBD;
using namespace std;
using namespace ARDOUR;
using namespace PBD;
+namespace ARDOUR { class Session; }
+
/* create an IOProcessor that proxies to a new IO object */
IOProcessor::IOProcessor (Session& s, bool with_input, bool with_output,
/* create an IOProcessor that proxies to a new IO object */
IOProcessor::IOProcessor (Session& s, bool with_input, bool with_output,
- const string& proc_name, const string io_name, DataType dtype)
+ const string& proc_name, const string io_name, DataType dtype
, bool sendish
)
: Processor(s, proc_name)
{
/* these are true in this constructor whether we actually create the associated
: Processor(s, proc_name)
{
/* these are true in this constructor whether we actually create the associated
@@
-57,11
+54,11
@@
IOProcessor::IOProcessor (Session& s, bool with_input, bool with_output,
_own_output = true;
if (with_input) {
_own_output = true;
if (with_input) {
- _input.reset (new IO(s, io_name.empty() ? proc_name : io_name, IO::Input, dtype));
+ _input.reset (new IO(s, io_name.empty() ? proc_name : io_name, IO::Input, dtype
, sendish
));
}
if (with_output) {
}
if (with_output) {
- _output.reset (new IO(s, io_name.empty() ? proc_name : io_name, IO::Output, dtype));
+ _output.reset (new IO(s, io_name.empty() ? proc_name : io_name, IO::Output, dtype
, sendish
));
}
}
}
}
@@
-109,34
+106,30
@@
IOProcessor::set_output (boost::shared_ptr<IO> io)
}
XMLNode&
}
XMLNode&
-IOProcessor::state (
bool full_state
)
+IOProcessor::state ()
{
{
- XMLNode& node (Processor::state (full_state));
+ XMLNode& node (Processor::state ());
+
+ node.set_property ("own-input", _own_input);
- if (_own_input) {
- node.add_property ("own-input", "yes");
- if (_input) {
- XMLNode& i (_input->state (full_state));
+ if (_input) {
+ if (_own_input) {
+ XMLNode& i (_input->get_state ());
// i.name() = X_("output");
node.add_child_nocopy (i);
// i.name() = X_("output");
node.add_child_nocopy (i);
- }
- } else {
- node.add_property ("own-input", "no");
- if (_input) {
- node.add_property ("input", _input->name());
+ } else {
+ node.set_property ("input", _input->name ());
}
}
}
}
- if (_own_output) {
- node.add_property ("own-output", "yes");
- if (_output) {
- XMLNode& o (_output->state (full_state));
+ node.set_property ("own-output", _own_output);
+
+ if (_output) {
+ if (_own_output) {
+ XMLNode& o (_output->get_state ());
node.add_child_nocopy (o);
node.add_child_nocopy (o);
- }
- } else {
- node.add_property ("own-output", "no");
- if (_output) {
- node.add_property ("output", _output->name());
+ } else {
+ node.set_property ("output", _output->name ());
}
}
}
}
@@
-150,19
+143,15
@@
IOProcessor::set_state (const XMLNode& node, int version)
return set_state_2X (node, version);
}
return set_state_2X (node, version);
}
-
const XMLProperty *
prop;
+
XMLProperty const *
prop;
const XMLNode *io_node = 0;
Processor::set_state(node, version);
const XMLNode *io_node = 0;
Processor::set_state(node, version);
+ bool ignore_name = node.property ("ignore-name");
- if ((prop = node.property ("own-input")) != 0) {
- _own_input = string_is_affirmative (prop->value());
- }
-
- if ((prop = node.property ("own-output")) != 0) {
- _own_output = string_is_affirmative (prop->value());
- }
+ node.get_property ("own-input", _own_input);
+ node.get_property ("own-output", _own_output);
/* don't attempt to set state for a proxied IO that we don't own */
/* don't attempt to set state for a proxied IO that we don't own */
@@
-170,56
+159,47
@@
IOProcessor::set_state (const XMLNode& node, int version)
XMLNodeIterator niter;
const string instr = enum_2_string (IO::Input);
const string outstr = enum_2_string (IO::Output);
XMLNodeIterator niter;
const string instr = enum_2_string (IO::Input);
const string outstr = enum_2_string (IO::Output);
-
- if (_own_input) {
+
+ std::string str;
+ if (_own_input && _input) {
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
- const XMLProperty* prop;
- if ((prop = (*niter)->property ("name")) != 0) {
- if (_name == prop->value()) {
- if ((prop = (*niter)->property ("direction")) != 0) {
- if (prop->value() == instr) {
- io_node = (*niter);
- break;
- }
- }
+ if ((*niter)->get_property ("name", str) && (_name == str || ignore_name)) {
+ if ((*niter)->get_property ("direction", str) && str == instr) {
+ io_node = (*niter);
+ break;
}
}
}
}
}
}
-
+
if (io_node) {
_input->set_state(*io_node, version);
if (io_node) {
_input->set_state(*io_node, version);
-
+
// legacy sessions: use IO name
if ((prop = node.property ("name")) == 0) {
set_name (_input->name());
}
// legacy sessions: use IO name
if ((prop = node.property ("name")) == 0) {
set_name (_input->name());
}
-
+
} else {
/* no input, which is OK */
}
} else {
/* no input, which is OK */
}
-
+
}
}
-
- if (_own_output) {
+
+ if (_own_output
&& _output
) {
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
if ((*niter)->name() == "IO") {
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
if ((*niter)->name() == "IO") {
- const XMLProperty* prop;
- if ((prop = (*niter)->property ("name")) != 0) {
- if (_name == prop->value()) {
- if ((prop = (*niter)->property ("direction")) != 0) {
- if (prop->value() == outstr) {
- io_node = (*niter);
- break;
- }
- }
+ if ((*niter)->get_property ("name", str) && (_name == str || ignore_name)) {
+ if ((*niter)->get_property ("direction", str) && str == outstr) {
+ io_node = (*niter);
+ break;
}
}
}
}
}
}
}
}
-
+
if (io_node) {
_output->set_state(*io_node, version);
if (io_node) {
_output->set_state(*io_node, version);
-
+
// legacy sessions: use IO name
if ((prop = node.property ("name")) == 0) {
set_name (_output->name());
// legacy sessions: use IO name
if ((prop = node.property ("name")) == 0) {
set_name (_output->name());
@@
-243,21
+223,13
@@
IOProcessor::set_state_2X (const XMLNode& node, int version)
}
void
}
void
-IOProcessor::silence (
framecnt_t nframes
)
+IOProcessor::silence (
samplecnt_t nframes, samplepos_t /* start_sample */
)
{
if (_own_output && _output) {
_output->silence (nframes);
}
}
{
if (_own_output && _output) {
_output->silence (nframes);
}
}
-void
-IOProcessor::increment_port_buffer_offset (pframes_t offset)
-{
- if (_own_output && _output) {
- _output->increment_port_buffer_offset (offset);
- }
-}
-
ChanCount
IOProcessor::natural_output_streams() const
{
ChanCount
IOProcessor::natural_output_streams() const
{
@@
-312,12
+284,15
@@
IOProcessor::disconnect ()
void
IOProcessor::prepare_for_reset (XMLNode &state, const std::string& name)
{
void
IOProcessor::prepare_for_reset (XMLNode &state, const std::string& name)
{
- state.
add_property ("ignore-bitslot", "1"
);
- state.
add_property ("ignore-name", "1"
);
+ state.
set_property ("ignore-bitslot", true
);
+ state.
set_property ("ignore-name", true
);
- XMLNode* io_node = state.child (IO::state_node_name.c_str());
+ XMLNodeList nlist = state.children();
+ XMLNodeIterator niter;
- if (io_node) {
- IO::prepare_for_reset (*io_node, name);
+ for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+ if ((*niter)->name() == IO::state_node_name.c_str()) {
+ IO::prepare_for_reset (**niter, name);
+ }
}
}
}
}