summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs/client/OSCClientReceiver.cpp7
-rw-r--r--src/libs/client/OSCEngineSender.cpp37
-rw-r--r--src/libs/engine/Connection.cpp4
-rw-r--r--src/libs/engine/DSSINode.cpp2
-rw-r--r--src/libs/engine/LADSPANode.cpp20
-rw-r--r--src/libs/engine/LV2Node.cpp24
-rw-r--r--src/libs/engine/MidiNoteNode.cpp10
-rw-r--r--src/libs/engine/Node.hpp6
-rw-r--r--src/libs/engine/NodeBase.cpp9
-rw-r--r--src/libs/engine/NodeBase.hpp15
-rw-r--r--src/libs/engine/NodeFactory.cpp34
-rw-r--r--src/libs/engine/NodeFactory.hpp10
-rw-r--r--src/libs/engine/OSCClientSender.cpp10
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp33
-rw-r--r--src/libs/engine/ObjectSender.cpp7
-rw-r--r--src/libs/engine/Patch.cpp4
-rw-r--r--src/libs/engine/events/AddNodeEvent.cpp6
17 files changed, 130 insertions, 108 deletions
diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp
index 058bf006..d223e211 100644
--- a/src/libs/client/OSCClientReceiver.cpp
+++ b/src/libs/client/OSCClientReceiver.cpp
@@ -156,7 +156,8 @@ OSCClientReceiver::setup_callbacks()
lo_server_thread_add_method(_st, "/ingen/object_renamed", "ss", object_renamed_cb, this);
lo_server_thread_add_method(_st, "/ingen/new_connection", "ss", connection_cb, this);
lo_server_thread_add_method(_st, "/ingen/disconnection", "ss", disconnection_cb, this);
- lo_server_thread_add_method(_st, "/ingen/new_node", "ssii", new_node_cb, this);
+ lo_server_thread_add_method(_st, "/ingen/new_node", "ssTi", new_node_cb, this);
+ lo_server_thread_add_method(_st, "/ingen/new_node", "ssFi", new_node_cb, this);
lo_server_thread_add_method(_st, "/ingen/new_port", "ssi", new_port_cb, this);
lo_server_thread_add_method(_st, "/ingen/metadata_update", NULL, metadata_update_cb, this);
lo_server_thread_add_method(_st, "/ingen/control_change", "sf", control_change_cb, this);
@@ -256,10 +257,10 @@ OSCClientReceiver::_new_node_cb(const char* path, const char* types, lo_arg** ar
{
const char* uri = &argv[0]->s;
const char* node_path = &argv[1]->s;
- const int32_t poly = argv[2]->i;
+ bool polyphonic = (types[2] == 'T');
const int32_t num_ports = argv[3]->i;
- new_node(uri, node_path, poly, num_ports);
+ new_node(uri, node_path, polyphonic, num_ports);
/*_receiving_node_model = new NodeModel(node_path);
_receiving_node_model->polyphonic((poly == 1));
diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp
index 89939b6b..e7b94e48 100644
--- a/src/libs/client/OSCEngineSender.cpp
+++ b/src/libs/client/OSCEngineSender.cpp
@@ -192,11 +192,17 @@ OSCEngineSender::create_node(const string& path,
bool polyphonic)
{
assert(_engine_addr);
- lo_send(_engine_addr, "/ingen/create_node", "issi",
- next_id(),
- path.c_str(),
- plugin_uri.c_str(),
- (polyphonic ? 1 : 0));
+
+ if (polyphonic)
+ lo_send(_engine_addr, "/ingen/create_node", "issT",
+ next_id(),
+ path.c_str(),
+ plugin_uri.c_str());
+ else
+ lo_send(_engine_addr, "/ingen/create_node", "issF",
+ next_id(),
+ path.c_str(),
+ plugin_uri.c_str());
}
@@ -212,13 +218,20 @@ OSCEngineSender::create_node(const string& path,
bool polyphonic)
{
assert(_engine_addr);
- lo_send(_engine_addr, "/ingen/create_node", "issssi",
- next_id(),
- path.c_str(),
- plugin_type.c_str(),
- library_name.c_str(),
- plugin_label.c_str(),
- (polyphonic ? 1 : 0));
+ if (polyphonic)
+ lo_send(_engine_addr, "/ingen/create_node", "issssT",
+ next_id(),
+ path.c_str(),
+ plugin_type.c_str(),
+ library_name.c_str(),
+ plugin_label.c_str());
+ else
+ lo_send(_engine_addr, "/ingen/create_node", "issssF",
+ next_id(),
+ path.c_str(),
+ plugin_type.c_str(),
+ library_name.c_str(),
+ plugin_label.c_str());
}
diff --git a/src/libs/engine/Connection.cpp b/src/libs/engine/Connection.cpp
index 637da891..bae72412 100644
--- a/src/libs/engine/Connection.cpp
+++ b/src/libs/engine/Connection.cpp
@@ -44,8 +44,8 @@ Connection::Connection(Port* src_port, Port* dst_port)
assert(dst_port);
assert(src_port->type() == dst_port->type());
- assert((src_port->parent_node()->poly() == dst_port->parent_node()->poly())
- || (src_port->parent_node()->poly() == 1 || dst_port->parent_node()->poly() == 1));
+ /*assert((src_port->parent_node()->poly() == dst_port->parent_node()->poly())
+ || (src_port->parent_node()->poly() == 1 || dst_port->parent_node()->poly() == 1));*/
if (_must_mix)
_local_buffer = BufferFactory::create(dst_port->type(), dst_port->buffer(0)->size());
diff --git a/src/libs/engine/DSSINode.cpp b/src/libs/engine/DSSINode.cpp
index a72c59db..20a70cd3 100644
--- a/src/libs/engine/DSSINode.cpp
+++ b/src/libs/engine/DSSINode.cpp
@@ -198,7 +198,7 @@ DSSINode::process(SampleCount nframes, FrameTime start, FrameTime end)
void
DSSINode::set_port_buffer(uint32_t voice, uint32_t port_num, Buffer* buf)
{
- assert(voice < _poly);
+ assert(voice < _polyphony);
// Could be a MIDI port after this
if (port_num < _descriptor->PortCount) {
diff --git a/src/libs/engine/LADSPANode.cpp b/src/libs/engine/LADSPANode.cpp
index feb72b9d..67ae0b62 100644
--- a/src/libs/engine/LADSPANode.cpp
+++ b/src/libs/engine/LADSPANode.cpp
@@ -57,11 +57,11 @@ LADSPANode::instantiate()
if (!_ports)
_ports = new Raul::Array<Port*>(_descriptor->PortCount);
- _instances = new LADSPA_Handle[_poly];
+ _instances = new LADSPA_Handle[_polyphony];
size_t port_buffer_size = 0;
- for (uint32_t i=0; i < _poly; ++i) {
+ for (uint32_t i=0; i < _polyphony; ++i) {
_instances[i] = _descriptor->instantiate(_descriptor, _srate);
if (_instances[i] == NULL) {
cerr << "Failed to instantiate plugin!" << endl;
@@ -108,10 +108,10 @@ LADSPANode::instantiate()
|| LADSPA_IS_PORT_OUTPUT(_descriptor->PortDescriptors[j]));
if (LADSPA_IS_PORT_INPUT(_descriptor->PortDescriptors[j])) {
- port = new InputPort(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size);
+ port = new InputPort(this, port_name, j, _polyphony, DataType::FLOAT, port_buffer_size);
_ports->at(j) = port;
} else if (LADSPA_IS_PORT_OUTPUT(_descriptor->PortDescriptors[j])) {
- port = new OutputPort(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size);
+ port = new OutputPort(this, port_name, j, _polyphony, DataType::FLOAT, port_buffer_size);
_ports->at(j) = port;
}
@@ -134,7 +134,7 @@ LADSPANode::instantiate()
// Set default value
if (port->buffer_size() == 1) {
- for (uint32_t i=0; i < _poly; ++i)
+ for (uint32_t i=0; i < _polyphony; ++i)
((AudioBuffer*)port->buffer(i))->set(default_val, 0);
}
@@ -150,7 +150,7 @@ LADSPANode::instantiate()
LADSPANode::~LADSPANode()
{
- for (uint32_t i=0; i < _poly; ++i)
+ for (uint32_t i=0; i < _polyphony; ++i)
_descriptor->cleanup(_instances[i]);
delete[] _instances;
@@ -162,7 +162,7 @@ LADSPANode::activate()
{
NodeBase::activate();
- for (uint32_t i=0; i < _poly; ++i) {
+ for (uint32_t i=0; i < _polyphony; ++i) {
for (unsigned long j=0; j < _descriptor->PortCount; ++j) {
set_port_buffer(i, j, _ports->at(j)->buffer(i));
/* if (port->type() == DataType::FLOAT && port->buffer_size() == 1)
@@ -181,7 +181,7 @@ LADSPANode::deactivate()
{
NodeBase::deactivate();
- for (uint32_t i=0; i < _poly; ++i)
+ for (uint32_t i=0; i < _polyphony; ++i)
if (_descriptor->deactivate != NULL)
_descriptor->deactivate(_instances[i]);
}
@@ -192,7 +192,7 @@ LADSPANode::process(SampleCount nframes, FrameTime start, FrameTime end)
{
NodeBase::pre_process(nframes, start, end);
- for (uint32_t i=0; i < _poly; ++i)
+ for (uint32_t i=0; i < _polyphony; ++i)
_descriptor->run(_instances[i], nframes);
NodeBase::post_process(nframes, start, end);
@@ -202,7 +202,7 @@ LADSPANode::process(SampleCount nframes, FrameTime start, FrameTime end)
void
LADSPANode::set_port_buffer(uint32_t voice, uint32_t port_num, Buffer* buf)
{
- assert(voice < _poly);
+ assert(voice < _polyphony);
AudioBuffer* audio_buffer = dynamic_cast<AudioBuffer*>(buf);
assert(audio_buffer);
diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp
index 1ab03578..8de8c04a 100644
--- a/src/libs/engine/LV2Node.cpp
+++ b/src/libs/engine/LV2Node.cpp
@@ -61,7 +61,7 @@ LV2Node::prepare_poly(uint32_t poly)
_prepared_poly = poly;
_prepared_instances = new Raul::Array<SLV2Instance>(_prepared_poly, *_instances);
- for (uint32_t i = _poly; i < _prepared_poly; ++i) {
+ for (uint32_t i = _polyphony; i < _prepared_poly; ++i) {
_prepared_instances->at(i) = slv2_plugin_instantiate(_lv2_plugin, _srate, NULL);
if ((*_prepared_instances)[i] == NULL) {
cerr << "Failed to instantiate plugin!" << endl;
@@ -87,11 +87,11 @@ LV2Node::apply_poly(Raul::Maid& maid, uint32_t poly)
_instances = _prepared_instances;
for (uint32_t port=0; port < num_ports(); ++port)
- for (uint32_t voice = _poly; voice < _prepared_poly; ++voice)
+ for (uint32_t voice = _polyphony; voice < _prepared_poly; ++voice)
slv2_instance_connect_port((*_instances)[voice], port,
_ports->at(port)->buffer(voice)->raw_data());
- _poly = poly;
+ _polyphony = poly;
_prepared_instances = NULL;
return true;
@@ -114,11 +114,11 @@ LV2Node::instantiate()
_ports = new Raul::Array<Port*>(num_ports);
- _instances = new Raul::Array<SLV2Instance>(_poly);
+ _instances = new Raul::Array<SLV2Instance>(_polyphony);
uint32_t port_buffer_size = 0;
- for (uint32_t i=0; i < _poly; ++i) {
+ for (uint32_t i=0; i < _polyphony; ++i) {
(*_instances)[i] = slv2_plugin_instantiate(_lv2_plugin, _srate, NULL);
if ((*_instances)[i] == NULL) {
cerr << "Failed to instantiate plugin!" << endl;
@@ -174,9 +174,9 @@ LV2Node::instantiate()
bool is_input = (port_direction == SLV2_PORT_DIRECTION_INPUT);
if (is_input)
- port = new InputPort(this, port_name, j, _poly, data_type, port_buffer_size);
+ port = new InputPort(this, port_name, j, _polyphony, data_type, port_buffer_size);
else
- port = new OutputPort(this, port_name, j, _poly, data_type, port_buffer_size);
+ port = new OutputPort(this, port_name, j, _polyphony, data_type, port_buffer_size);
if (is_input && port_type == SLV2_PORT_DATA_TYPE_CONTROL)
((AudioBuffer*)port->buffer(0))->set(slv2_port_get_default_value(_lv2_plugin, id), 0);
@@ -189,7 +189,7 @@ LV2Node::instantiate()
LV2Node::~LV2Node()
{
- for (uint32_t i=0; i < _poly; ++i)
+ for (uint32_t i=0; i < _polyphony; ++i)
slv2_instance_free((*_instances)[i]);
delete _instances;
@@ -201,7 +201,7 @@ LV2Node::activate()
{
NodeBase::activate();
- for (uint32_t i=0; i < _poly; ++i) {
+ for (uint32_t i=0; i < _polyphony; ++i) {
for (unsigned long j=0; j < num_ports(); ++j) {
Port* const port = _ports->at(j);
set_port_buffer(i, j, port->buffer(i));
@@ -224,7 +224,7 @@ LV2Node::deactivate()
{
NodeBase::deactivate();
- for (uint32_t i=0; i < _poly; ++i)
+ for (uint32_t i=0; i < _polyphony; ++i)
slv2_instance_deactivate((*_instances)[i]);
}
@@ -234,7 +234,7 @@ LV2Node::process(SampleCount nframes, FrameTime start, FrameTime end)
{
NodeBase::pre_process(nframes, start, end);
- for (uint32_t i=0; i < _poly; ++i)
+ for (uint32_t i=0; i < _polyphony; ++i)
slv2_instance_run((*_instances)[i], nframes);
NodeBase::post_process(nframes, start, end);
@@ -244,7 +244,7 @@ LV2Node::process(SampleCount nframes, FrameTime start, FrameTime end)
void
LV2Node::set_port_buffer(uint32_t voice, uint32_t port_num, Buffer* buf)
{
- assert(voice < _poly);
+ assert(voice < _polyphony);
if (buf->type() == DataType::FLOAT) {
slv2_instance_connect_port((*_instances)[voice], port_num, ((AudioBuffer*)buf)->data());
diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp
index 4e93d917..91c9d542 100644
--- a/src/libs/engine/MidiNoteNode.cpp
+++ b/src/libs/engine/MidiNoteNode.cpp
@@ -95,7 +95,7 @@ MidiNoteNode::apply_poly(Raul::Maid& maid, uint32_t poly)
maid.push(_voices);
_voices = _prepared_voices;
_prepared_voices = NULL;
- _poly = poly;
+ _polyphony = poly;
return true;
}
@@ -177,7 +177,7 @@ MidiNoteNode::note_on(uchar note_num, uchar velocity, FrameTime time, SampleCoun
uint32_t voice_num = 0;
// Look for free voices
- for (uint32_t i=0; i < _poly; ++i) {
+ for (uint32_t i=0; i < _polyphony; ++i) {
if ((*_voices)[i].state == Voice::Voice::FREE) {
voice = &(*_voices)[i];
voice_num = i;
@@ -190,7 +190,7 @@ MidiNoteNode::note_on(uchar note_num, uchar velocity, FrameTime time, SampleCoun
voice_num = 0;
voice = &(*_voices)[0];
jack_nframes_t oldest_time = (*_voices)[0].time;
- for (uint32_t i=1; i < _poly; ++i) {
+ for (uint32_t i=1; i < _polyphony; ++i) {
if ((*_voices)[i].time < oldest_time) {
voice = &(*_voices)[i];
voice_num = i;
@@ -331,7 +331,7 @@ MidiNoteNode::all_notes_off(FrameTime time, SampleCount nframes, FrameTime start
// FIXME: set all keys to Key::OFF?
- for (uint32_t i=0; i < _poly; ++i) {
+ for (uint32_t i=0; i < _polyphony; ++i) {
((AudioBuffer*)_gate_port->buffer(i))->set(0.0f, time - start);
(*_voices)[i].state = Voice::FREE;
}
@@ -363,7 +363,7 @@ MidiNoteNode::sustain_off(FrameTime time, SampleCount nframes, FrameTime start,
_sustain = false;
- for (uint32_t i=0; i < _poly; ++i)
+ for (uint32_t i=0; i < _polyphony; ++i)
if ((*_voices)[i].state == Voice::HOLDING)
free_voice(i, time, nframes, start, end);
}
diff --git a/src/libs/engine/Node.hpp b/src/libs/engine/Node.hpp
index 3114d369..470075a6 100644
--- a/src/libs/engine/Node.hpp
+++ b/src/libs/engine/Node.hpp
@@ -121,8 +121,10 @@ public:
// FIXME: Only used by client senders. Remove?
virtual const Raul::Array<Port*>& ports() const = 0;
- virtual uint32_t num_ports() const = 0;
- virtual uint32_t poly() const = 0;
+ virtual uint32_t num_ports() const = 0;
+
+ virtual bool polyphonic() const = 0;
+ virtual uint32_t polyphony() const = 0;
/** Used by the process order finding algorithm (ie during connections) */
virtual bool traversed() const = 0;
diff --git a/src/libs/engine/NodeBase.cpp b/src/libs/engine/NodeBase.cpp
index 35d3be4e..faef4a32 100644
--- a/src/libs/engine/NodeBase.cpp
+++ b/src/libs/engine/NodeBase.cpp
@@ -33,10 +33,11 @@ using std::cout; using std::cerr; using std::endl;
namespace Ingen {
-NodeBase::NodeBase(const Plugin* plugin, const string& name, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size)
+NodeBase::NodeBase(const Plugin* plugin, const string& name, bool poly, Patch* parent, SampleRate srate, size_t buffer_size)
: Node(parent, name),
_plugin(plugin),
- _poly(poly),
+ _polyphonic(poly),
+ _polyphony(parent ? parent->internal_poly() : 1),
_srate(srate),
_buffer_size(buffer_size),
_activated(false),
@@ -49,8 +50,8 @@ NodeBase::NodeBase(const Plugin* plugin, const string& name, uint32_t poly, Patc
_dependants(new Raul::List<Node*>())
{
assert(_plugin);
- assert(_poly > 0);
- assert(_parent == NULL || (_poly == parent->internal_poly() || _poly == 1));
+ assert(_polyphony > 0);
+ assert(_parent == NULL || (_polyphony == parent->internal_poly() || _polyphony == 1));
}
diff --git a/src/libs/engine/NodeBase.hpp b/src/libs/engine/NodeBase.hpp
index e74c0d12..8e1bb7f3 100644
--- a/src/libs/engine/NodeBase.hpp
+++ b/src/libs/engine/NodeBase.hpp
@@ -47,7 +47,12 @@ namespace Shared {
class NodeBase : public Node
{
public:
- NodeBase(const Plugin* plugin, const string& name, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size);
+ NodeBase(const Plugin* plugin,
+ const string& name,
+ bool poly,
+ Patch* parent,
+ SampleRate rate,
+ size_t buffer_size);
virtual ~NodeBase();
@@ -75,7 +80,8 @@ public:
SampleRate sample_rate() const { return _srate; }
size_t buffer_size() const { return _buffer_size; }
uint32_t num_ports() const { return _ports ? _ports->size() : 0; }
- uint32_t poly() const { return _poly; }
+ bool polyphonic() const { return _polyphonic; }
+ uint32_t polyphony() const { return _polyphony; }
bool traversed() const { return _traversed; }
void traversed(bool b) { _traversed = b; }
@@ -94,14 +100,15 @@ public:
virtual const Plugin* plugin() const { return _plugin; }
/** A node's parent is always a patch, so static cast should be safe */
- Patch* parent_patch() const { return (Patch*)_parent; }
+ inline Patch* parent_patch() const { return (Patch*)_parent; }
protected:
virtual void signal_input_ready();
const Plugin* _plugin;
- uint32_t _poly;
+ bool _polyphonic;
+ uint32_t _polyphony;
SampleRate _srate;
size_t _buffer_size;
bool _activated;
diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp
index c2432813..649b4c71 100644
--- a/src/libs/engine/NodeFactory.cpp
+++ b/src/libs/engine/NodeFactory.cpp
@@ -178,11 +178,10 @@ NodeFactory::load_plugins()
Node*
NodeFactory::load_plugin(const Plugin* a_plugin,
const string& name,
- uint32_t poly,
+ bool polyphonic,
Patch* parent)
{
assert(parent != NULL);
- assert(poly == 1 || poly == parent->internal_poly());
assert(a_plugin);
Node* r = NULL;
@@ -226,21 +225,21 @@ NodeFactory::load_plugin(const Plugin* a_plugin,
switch (a_plugin->type()) {
#ifdef HAVE_SLV2
case Plugin::LV2:
- r = load_lv2_plugin(plugin->uri(), name, poly, parent, srate, buffer_size);
+ r = load_lv2_plugin(plugin->uri(), name, polyphonic, parent, srate, buffer_size);
break;
#endif
#ifdef HAVE_DSSI
case Plugin::DSSI:
- r = load_dssi_plugin(plugin->uri(), name, poly, parent, srate, buffer_size);
+ r = load_dssi_plugin(plugin->uri(), name, polyphonic, parent, srate, buffer_size);
break;
#endif
#ifdef HAVE_LADSPA
case Plugin::LADSPA:
- r = load_ladspa_plugin(plugin->uri(), name, poly, parent, srate, buffer_size);
+ r = load_ladspa_plugin(plugin->uri(), name, polyphonic, parent, srate, buffer_size);
break;
#endif
case Plugin::Internal:
- r = load_internal_plugin(a_plugin->uri(), name, poly, parent, srate, buffer_size);
+ r = load_internal_plugin(a_plugin->uri(), name, polyphonic, parent, srate, buffer_size);
break;
default:
cerr << "[NodeFactory] WARNING: Unknown plugin type." << endl;
@@ -255,19 +254,18 @@ NodeFactory::load_plugin(const Plugin* a_plugin,
Node*
NodeFactory::load_internal_plugin(const string& uri,
const string& name,
- uint32_t poly,
+ bool polyphonic,
Patch* parent,
SampleRate srate,
size_t buffer_size)
{
assert(parent != NULL);
- assert(poly == 1 || poly == parent->internal_poly());
assert(uri.length() > 6);
assert(uri.substr(0, 6) == "ingen:");
for (list<Plugin*>::iterator i = _internal_plugins.begin(); i != _internal_plugins.end(); ++i)
if ((*i)->uri() == uri)
- return (*i)->instantiate(name, poly, parent, srate, buffer_size);
+ return (*i)->instantiate(name, polyphonic, parent, srate, buffer_size);
return NULL;
}
@@ -331,7 +329,7 @@ NodeFactory::load_lv2_plugins()
Node*
NodeFactory::load_lv2_plugin(const string& plug_uri,
const string& node_name,
- uint32_t poly,
+ bool polyphonic,
Patch* parent,
SampleRate srate,
size_t buffer_size)
@@ -347,7 +345,7 @@ NodeFactory::load_lv2_plugin(const string& plug_uri,
Node* n = NULL;
if (plugin) {
- n = new LV2Node(plugin, node_name, poly, parent, srate, buffer_size);
+ n = new LV2Node(plugin, node_name, polyphonic, parent, srate, buffer_size);
bool success = ((LV2Node*)n)->instantiate();
if (!success) {
delete n;
@@ -464,13 +462,16 @@ NodeFactory::load_dssi_plugins()
*/
Node*
NodeFactory::load_dssi_plugin(const string& uri,
- const string& name, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size)
+ const string& name,
+ bool polyphonic,
+ Patch* parent,
+ SampleRate srate,
+ size_t buffer_size)
{
// FIXME: awful code duplication here
assert(uri != "");
assert(name != "");
- assert(poly > 0);
DSSI_Descriptor_Function df = NULL;
const Plugin* plugin = NULL;
@@ -510,7 +511,7 @@ NodeFactory::load_dssi_plugin(const string& uri,
return NULL;
}
- n = new DSSINode(plugin, name, poly, parent, descriptor, srate, buffer_size);
+ n = new DSSINode(plugin, name, polyphonic, parent, descriptor, srate, buffer_size);
bool success = ((DSSINode*)n)->instantiate();
if (!success) {
@@ -630,14 +631,13 @@ NodeFactory::load_ladspa_plugins()
Node*
NodeFactory::load_ladspa_plugin(const string& uri,
const string& name,
- uint32_t poly,
+ bool polyphonic,
Patch* parent,
SampleRate srate,
size_t buffer_size)
{
assert(uri != "");
assert(name != "");
- assert(poly > 0);
LADSPA_Descriptor_Function df = NULL;
Plugin* plugin = NULL;
@@ -675,7 +675,7 @@ NodeFactory::load_ladspa_plugin(const string& uri,
return NULL;
}
- n = new LADSPANode(plugin, name, poly, parent, descriptor, srate, buffer_size);
+ n = new LADSPANode(plugin, name, polyphonic, parent, descriptor, srate, buffer_size);
bool success = ((LADSPANode*)n)->instantiate();
if (!success) {
diff --git a/src/libs/engine/NodeFactory.hpp b/src/libs/engine/NodeFactory.hpp
index b89f1218..d8f662d4 100644
--- a/src/libs/engine/NodeFactory.hpp
+++ b/src/libs/engine/NodeFactory.hpp
@@ -58,7 +58,7 @@ public:
~NodeFactory();
void load_plugins();
- Node* load_plugin(const Plugin* info, const string& name, uint32_t poly, Patch* parent);
+ Node* load_plugin(const Plugin* info, const string& name, bool polyphonic, Patch* parent);
const list<Plugin*>& plugins() { return _plugins; }
@@ -68,20 +68,20 @@ public:
private:
#ifdef HAVE_LADSPA
void load_ladspa_plugins();
- Node* load_ladspa_plugin(const string& plugin_uri, const string& name, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size);
+ Node* load_ladspa_plugin(const string& plugin_uri, const string& name, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size);
#endif
#ifdef HAVE_SLV2
void load_lv2_plugins();
- Node* load_lv2_plugin(const string& plugin_uri, const string& name, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size);
+ Node* load_lv2_plugin(const string& plugin_uri, const string& name, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size);
#endif
#ifdef HAVE_DSSI
void load_dssi_plugins();
- Node* load_dssi_plugin(const string& plugin_uri, const string& name, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size);
+ Node* load_dssi_plugin(const string& plugin_uri, const string& name, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size);
#endif
- Node* load_internal_plugin(const string& plug_label, const string& name, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size);
+ Node* load_internal_plugin(const string& plug_label, const string& name, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size);
Glib::Module* library(const string& path);
diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp
index 2bcd8282..75353981 100644
--- a/src/libs/engine/OSCClientSender.cpp
+++ b/src/libs/engine/OSCClientSender.cpp
@@ -244,7 +244,7 @@ OSCClientSender::plugins()
* <p> \b /ingen/new_node - Notification of a new node's creation.
* \arg \b plug-uri (const std::string&) - URI of the plugin new node is an instance of
* \arg \b path (const std::string&) - Path of the new node
- * \arg \b polyphonic (integer-boolean) - Node is polyphonic (1 = yes, 0 = no)
+ * \arg \b polyphonic (boolean) - Node is polyphonic
* \arg \b num-ports (integer) - Number of ports (number of new_port messages to expect)\n\n
* \li New nodes are sent as a bundle. The first message in the bundle will be
* this one (/ingen/new_node), followed by a series of /ingen/new_port commands,
@@ -260,8 +260,12 @@ void OSCClientSender::new_node(const std::string& plugin_uri,
//cerr << "Sending node " << node_path << endl;
- lo_send(_address, "/ingen/new_node", "ssii", plugin_uri.c_str(),
- node_path.c_str(), is_polyphonic ? 1 : 0, num_ports);
+ if (is_polyphonic)
+ lo_send(_address, "/ingen/new_node", "ssTi", plugin_uri.c_str(),
+ node_path.c_str(), num_ports);
+ else
+ lo_send(_address, "/ingen/new_node", "ssFi", plugin_uri.c_str(),
+ node_path.c_str(), num_ports);
#if 0
/*
lo_timetag tt;
diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp
index d922d3c9..68790300 100644
--- a/src/libs/engine/OSCEngineReceiver.cpp
+++ b/src/libs/engine/OSCEngineReceiver.cpp
@@ -85,8 +85,10 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t
lo_server_add_method(_server, "/ingen/clear_patch", "is", clear_patch_cb, this);
lo_server_add_method(_server, "/ingen/set_polyphony", "isi", set_polyphony_cb, this);
lo_server_add_method(_server, "/ingen/create_port", "issi", create_port_cb, this);
- lo_server_add_method(_server, "/ingen/create_node", "issssi", create_node_cb, this);
- lo_server_add_method(_server, "/ingen/create_node", "issi", create_node_by_uri_cb, this);
+ lo_server_add_method(_server, "/ingen/create_node", "issssT", create_node_cb, this);
+ lo_server_add_method(_server, "/ingen/create_node", "issssF", create_node_cb, this);
+ lo_server_add_method(_server, "/ingen/create_node", "issT", create_node_by_uri_cb, this);
+ lo_server_add_method(_server, "/ingen/create_node", "issF", create_node_by_uri_cb, this);
lo_server_add_method(_server, "/ingen/destroy", "is", destroy_cb, this);
lo_server_add_method(_server, "/ingen/rename", "iss", rename_cb, this);
lo_server_add_method(_server, "/ingen/connect", "iss", connect_cb, this);
@@ -478,18 +480,17 @@ OSCEngineReceiver::_create_port_cb(const char* path, const char* types, lo_arg**
* \arg \b response-id (integer)
* \arg \b node-path (string) - Full path of the new node (ie. /patch2/subpatch/newnode)
* \arg \b plug-uri (string) - URI of the plugin to load
- * \arg \b poly (integer-boolean) - Whether node is polyphonic (0 = false, 1 = true) </p> \n \n
+ * \arg \b polyphonic (boolean) - Whether node is polyphonic </p> \n \n
*/
int
OSCEngineReceiver::_create_node_by_uri_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- const char* node_path = &argv[1]->s;
- const char* plug_uri = &argv[2]->s;
- const int32_t poly = argv[3]->i;
+ const char* node_path = &argv[1]->s;
+ const char* plug_uri = &argv[2]->s;
+ bool polyphonic = (types[3] == 'T');
- // FIXME: make sure poly is valid
-
- create_node(node_path, plug_uri, (poly == 1));
+ create_node(node_path, plug_uri, polyphonic);
+
return 0;
}
@@ -501,7 +502,7 @@ OSCEngineReceiver::_create_node_by_uri_cb(const char* path, const char* types, l
* \arg \b type (string) - Plugin type ("LADSPA" or "Internal")
* \arg \b lib-name (string) - Name of library where plugin resides (eg "cmt.so")
* \arg \b plug-label (string) - Label (ID) of plugin (eg "sine_fcaa")
- * \arg \b poly (integer-boolean) - Whether node is polyphonic (0 = false, 1 = true)
+ * \arg \b poly (boolean) - Whether node is polyphonic
*
* \li This is only here to provide backwards compatibility for old patches that store LADSPA plugin
* references as libname, label. It is to be removed ASAP, don't use it.
@@ -510,13 +511,13 @@ OSCEngineReceiver::_create_node_by_uri_cb(const char* path, const char* types, l
int
OSCEngineReceiver::_create_node_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- const char* node_path = &argv[1]->s;
- const char* type = &argv[2]->s;
- const char* lib_name = &argv[3]->s;
- const char* plug_label = &argv[4]->s;
- const int32_t poly = argv[5]->i;
+ const char* node_path = &argv[1]->s;
+ const char* type = &argv[2]->s;
+ const char* lib_name = &argv[3]->s;
+ const char* plug_label = &argv[4]->s;
+ bool polyphonic = (types[5] == 'T');
- create_node(node_path, type, lib_name, plug_label, (poly == 1));
+ create_node(node_path, type, lib_name, plug_label, polyphonic);
return 0;
}
diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp
index d585ab71..97a03bce 100644
--- a/src/libs/engine/ObjectSender.cpp
+++ b/src/libs/engine/ObjectSender.cpp
@@ -79,11 +79,6 @@ ObjectSender::send_node(ClientInterface* client, const Node* node, bool recursiv
{
const Plugin* const plugin = node->plugin();
- int polyphonic =
- (node->poly() > 1
- && node->poly() == node->parent_patch()->internal_poly()
- ? 1 : 0);
-
assert(node->path().length() > 0);
if (plugin->type() == Plugin::Patch) {
@@ -98,7 +93,7 @@ ObjectSender::send_node(ClientInterface* client, const Node* node, bool recursiv
client->bundle_begin();
- client->new_node(node->plugin()->uri(), node->path(), polyphonic, node->ports().size());
+ client->new_node(node->plugin()->uri(), node->path(), node->polyphonic(), node->ports().size());
// Send metadata
const GraphObject::MetadataMap& data = node->metadata();
diff --git a/src/libs/engine/Patch.cpp b/src/libs/engine/Patch.cpp
index e8833da8..08d15c69 100644
--- a/src/libs/engine/Patch.cpp
+++ b/src/libs/engine/Patch.cpp
@@ -261,7 +261,7 @@ Patch::add_node(Raul::ListNode<Node*>* ln)
assert(ln != NULL);
assert(ln->elem() != NULL);
assert(ln->elem()->parent_patch() == this);
- assert(ln->elem()->poly() == _internal_poly || ln->elem()->poly() == 1);
+ assert(ln->elem()->polyphony() == _internal_poly);
_nodes.push_back(ln);
}
@@ -326,7 +326,7 @@ Patch::create_port(const string& name, DataType type, size_t buffer_size, bool i
assert( !(type == DataType::UNKNOWN) );
- return new DuplexPort(this, name, 0, _poly, type, buffer_size, is_output);
+ return new DuplexPort(this, name, 0, _polyphony, type, buffer_size, is_output);
}
diff --git a/src/libs/engine/events/AddNodeEvent.cpp b/src/libs/engine/events/AddNodeEvent.cpp
index 3b2b01cf..8dbe5f3f 100644
--- a/src/libs/engine/events/AddNodeEvent.cpp
+++ b/src/libs/engine/events/AddNodeEvent.cpp
@@ -84,10 +84,8 @@ AddNodeEvent::pre_process()
: _engine.node_factory()->plugin(_plugin_type, _plugin_lib, _plugin_label);
if (_patch && plugin) {
- if (_poly)
- _node = _engine.node_factory()->load_plugin(plugin, _path.name(), _patch->internal_poly(), _patch);
- else
- _node = _engine.node_factory()->load_plugin(plugin, _path.name(), 1, _patch);
+
+ _node = _engine.node_factory()->load_plugin(plugin, _path.name(), _poly, _patch);
if (_node != NULL) {
_node->activate();