summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-09-20 20:54:31 +0000
committerDavid Robillard <d@drobilla.net>2007-09-20 20:54:31 +0000
commit615ceaaf519d0c42a9215c4835e1f7348f2e5dca (patch)
tree79093453605d8a1b2ff97dc07cff14324bc14f06
parenta4625db3f26716fb7a34614c76582ab92b5212e8 (diff)
downloadingen-615ceaaf519d0c42a9215c4835e1f7348f2e5dca.tar.gz
ingen-615ceaaf519d0c42a9215c4835e1f7348f2e5dca.tar.bz2
ingen-615ceaaf519d0c42a9215c4835e1f7348f2e5dca.zip
Remove useless InternalNode class.
Percolate boolean polyphony down through Node class heirarchy (instead of integer). git-svn-id: http://svn.drobilla.net/lad/ingen@742 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/libs/engine/DSSINode.cpp2
-rw-r--r--src/libs/engine/DSSINode.hpp2
-rw-r--r--src/libs/engine/InputPort.cpp2
-rw-r--r--src/libs/engine/InternalNode.hpp52
-rw-r--r--src/libs/engine/LADSPANode.cpp4
-rw-r--r--src/libs/engine/LADSPANode.hpp2
-rw-r--r--src/libs/engine/LV2Node.cpp25
-rw-r--r--src/libs/engine/LV2Node.hpp3
-rw-r--r--src/libs/engine/Makefile.am1
-rw-r--r--src/libs/engine/MidiControlNode.cpp11
-rw-r--r--src/libs/engine/MidiControlNode.hpp5
-rw-r--r--src/libs/engine/MidiNoteNode.cpp40
-rw-r--r--src/libs/engine/MidiNoteNode.hpp8
-rw-r--r--src/libs/engine/MidiTriggerNode.cpp13
-rw-r--r--src/libs/engine/MidiTriggerNode.hpp8
-rw-r--r--src/libs/engine/NodeBase.cpp12
-rw-r--r--src/libs/engine/Plugin.cpp10
-rw-r--r--src/libs/engine/Plugin.hpp2
-rw-r--r--src/libs/engine/TransportNode.cpp11
-rw-r--r--src/libs/engine/TransportNode.hpp10
-rw-r--r--src/libs/engine/events/DestroyEvent.cpp3
-rw-r--r--src/libs/engine/events/MidiLearnEvent.cpp1
-rw-r--r--src/libs/engine/events/NoteOffEvent.cpp1
23 files changed, 97 insertions, 131 deletions
diff --git a/src/libs/engine/DSSINode.cpp b/src/libs/engine/DSSINode.cpp
index 20a70cd3..c2d05d36 100644
--- a/src/libs/engine/DSSINode.cpp
+++ b/src/libs/engine/DSSINode.cpp
@@ -29,7 +29,7 @@ using namespace std;
namespace Ingen {
-DSSINode::DSSINode(const Plugin* plugin, const string& name, uint32_t poly, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size)
+DSSINode::DSSINode(const Plugin* plugin, const string& name, bool polyphonic, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size)
: LADSPANode(plugin, name, 1, parent, descriptor->LADSPA_Plugin, srate, buffer_size),
_dssi_descriptor(descriptor),
_ui_addr(NULL),
diff --git a/src/libs/engine/DSSINode.hpp b/src/libs/engine/DSSINode.hpp
index aa309089..2c97fdc3 100644
--- a/src/libs/engine/DSSINode.hpp
+++ b/src/libs/engine/DSSINode.hpp
@@ -40,7 +40,7 @@ public:
typedef std::map<int, string> Bank;
- DSSINode(const Plugin* plugin, const string& name, uint32_t poly, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size);
+ DSSINode(const Plugin* plugin, const string& name, bool polyphonic, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size);
~DSSINode();
bool instantiate();
diff --git a/src/libs/engine/InputPort.cpp b/src/libs/engine/InputPort.cpp
index edc89225..2d76210b 100644
--- a/src/libs/engine/InputPort.cpp
+++ b/src/libs/engine/InputPort.cpp
@@ -183,6 +183,8 @@ InputPort::pre_process(SampleCount nframes, FrameTime start, FrameTime end)
for (uint32_t i=0; i < _poly; ++i)
_buffers->at(i)->prepare_read(nframes);
+ //cerr << path() << " poly = " << _poly << ", mixdown: " << do_mixdown << endl;
+
if (!do_mixdown) {
assert(_buffers->at(0)->is_joined_to((*_connections.begin())->buffer(0)));
return;
diff --git a/src/libs/engine/InternalNode.hpp b/src/libs/engine/InternalNode.hpp
deleted file mode 100644
index 6264d1a6..00000000
--- a/src/libs/engine/InternalNode.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * Ingen 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.
- *
- * Ingen 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 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.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef INTERNALNODE_H
-#define INTERNALNODE_H
-
-#include <cstdlib>
-#include "NodeBase.hpp"
-#include "Plugin.hpp"
-#include "types.hpp"
-
-namespace Ingen {
-
-class Patch;
-
-
-/** Base class for Internal (builtin) nodes
- *
- * \ingroup engine
- */
-class InternalNode : public NodeBase
-{
-public:
- InternalNode(const Plugin* plugin, const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size)
- : NodeBase(plugin, path, poly, parent, srate, buffer_size)
- {
- }
-
- virtual ~InternalNode() {}
-
-protected:
- Plugin* plugin() const { return const_cast<Plugin*>(_plugin); }
-};
-
-
-} // namespace Ingen
-
-#endif // INTERNALNODE_H
diff --git a/src/libs/engine/LADSPANode.cpp b/src/libs/engine/LADSPANode.cpp
index 3e3f863e..ad1761e8 100644
--- a/src/libs/engine/LADSPANode.cpp
+++ b/src/libs/engine/LADSPANode.cpp
@@ -33,8 +33,8 @@ namespace Ingen {
* Object is not usable until instantiate() is called with success.
* (It _will_ crash!)
*/
-LADSPANode::LADSPANode(const Plugin* plugin, const string& path, uint32_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, SampleRate srate, size_t buffer_size)
-: NodeBase(plugin, path, poly, parent, srate, buffer_size),
+LADSPANode::LADSPANode(const Plugin* plugin, const string& path, bool polyphonic, Patch* parent, const LADSPA_Descriptor* descriptor, SampleRate srate, size_t buffer_size)
+: NodeBase(plugin, path, polyphonic, parent, srate, buffer_size),
_descriptor(descriptor),
_instances(NULL)
{
diff --git a/src/libs/engine/LADSPANode.hpp b/src/libs/engine/LADSPANode.hpp
index e12feb72..3c673f0b 100644
--- a/src/libs/engine/LADSPANode.hpp
+++ b/src/libs/engine/LADSPANode.hpp
@@ -34,7 +34,7 @@ namespace Ingen {
class LADSPANode : public NodeBase
{
public:
- LADSPANode(const Plugin* plugin, const string& name, uint32_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, SampleRate srate, size_t buffer_size);
+ LADSPANode(const Plugin* plugin, const string& name, bool polyphonic, Patch* parent, const LADSPA_Descriptor* descriptor, SampleRate srate, size_t buffer_size);
virtual ~LADSPANode();
virtual bool instantiate();
diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp
index 146bc4bf..6d66f332 100644
--- a/src/libs/engine/LV2Node.cpp
+++ b/src/libs/engine/LV2Node.cpp
@@ -39,15 +39,14 @@ namespace Ingen {
*/
LV2Node::LV2Node(const Plugin* plugin,
const string& name,
- uint32_t poly,
+ bool polyphonic,
Patch* parent,
SampleRate srate,
size_t buffer_size)
- : NodeBase(plugin, name, poly, parent, srate, buffer_size)
+ : NodeBase(plugin, name, polyphonic, parent, srate, buffer_size)
, _lv2_plugin(plugin->slv2_plugin())
, _instances(NULL)
, _prepared_instances(NULL)
- , _prepared_poly(poly)
{
assert(_lv2_plugin);
}
@@ -56,14 +55,16 @@ LV2Node::LV2Node(const Plugin* plugin,
bool
LV2Node::prepare_poly(uint32_t poly)
{
+ if (!_polyphonic)
+ return true;
+
NodeBase::prepare_poly(poly);
- if (poly <= _prepared_poly)
+ if (poly <= _prepared_instances->size())
return true;
- _prepared_poly = poly;
- _prepared_instances = new Raul::Array<SLV2Instance>(_prepared_poly, *_instances);
- for (uint32_t i = _polyphony; i < _prepared_poly; ++i) {
+ _prepared_instances = new Raul::Array<SLV2Instance>(poly, *_instances);
+ for (uint32_t i = _polyphony; i < _prepared_instances->size(); ++i) {
_prepared_instances->at(i) = slv2_plugin_instantiate(_lv2_plugin, _srate, NULL);
if ((*_prepared_instances)[i] == NULL) {
cerr << "Failed to instantiate plugin!" << endl;
@@ -81,7 +82,10 @@ LV2Node::prepare_poly(uint32_t poly)
bool
LV2Node::apply_poly(Raul::Maid& maid, uint32_t poly)
{
- assert(poly <= _prepared_poly);
+ if (!_polyphonic)
+ return true;
+
+ assert(poly <= _prepared_instances->size());
NodeBase::apply_poly(maid, poly);
@@ -90,13 +94,14 @@ 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 = _polyphony; voice < _prepared_poly; ++voice)
+ for (uint32_t voice = _polyphony; voice < _prepared_instances->size(); ++voice)
slv2_instance_connect_port((*_instances)[voice], port,
_ports->at(port)->buffer(voice)->raw_data());
+
+ _prepared_instances = NULL;
}
_polyphony = poly;
- _prepared_instances = NULL;
return true;
}
diff --git a/src/libs/engine/LV2Node.hpp b/src/libs/engine/LV2Node.hpp
index 52f7d6a1..c566b138 100644
--- a/src/libs/engine/LV2Node.hpp
+++ b/src/libs/engine/LV2Node.hpp
@@ -36,7 +36,7 @@ class LV2Node : public NodeBase
public:
LV2Node(const Plugin* plugin,
const string& name,
- uint32_t poly,
+ bool polyphonic,
Patch* parent,
SampleRate srate,
size_t buffer_size);
@@ -61,7 +61,6 @@ protected:
SLV2Plugin _lv2_plugin;
Raul::Array<SLV2Instance>* _instances;
Raul::Array<SLV2Instance>* _prepared_instances;
- uint32_t _prepared_poly;
};
diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am
index 185c7804..44d3825b 100644
--- a/src/libs/engine/Makefile.am
+++ b/src/libs/engine/Makefile.am
@@ -43,7 +43,6 @@ libingen_engine_la_SOURCES = \
GraphObject.hpp \
InputPort.cpp \
InputPort.hpp \
- InternalNode.hpp \
JackAudioDriver.cpp \
JackAudioDriver.hpp \
JackMidiDriver.cpp \
diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp
index bcec357c..3d4924b6 100644
--- a/src/libs/engine/MidiControlNode.cpp
+++ b/src/libs/engine/MidiControlNode.cpp
@@ -29,8 +29,8 @@
namespace Ingen {
-MidiControlNode::MidiControlNode(const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size)
-: InternalNode(new Plugin(Plugin::Internal, "ingen:control_node"), path, 1, parent, srate, buffer_size),
+MidiControlNode::MidiControlNode(const string& path, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size)
+: NodeBase(new Plugin(Plugin::Internal, "ingen:control_node"), path, false, parent, srate, buffer_size),
_learning(false)
{
_ports = new Raul::Array<Port*>(7);
@@ -63,9 +63,10 @@ MidiControlNode::MidiControlNode(const string& path, uint32_t poly, Patch* paren
_control_port = new OutputPort(this, "Out(CR)", 6, 1, DataType::FLOAT, 1);
_ports->at(6) = _control_port;
- plugin()->plug_label("midi_control_in");
- assert(plugin()->uri() == "ingen:control_node");
- plugin()->name("Ingen Control Node (MIDI)");
+ Plugin* p = const_cast<Plugin*>(_plugin);
+ p->plug_label("midi_control_in");
+ assert(p->uri() == "ingen:control_node");
+ p->name("Ingen Control Node (MIDI)");
}
diff --git a/src/libs/engine/MidiControlNode.hpp b/src/libs/engine/MidiControlNode.hpp
index 6d2b480c..ee97fa8a 100644
--- a/src/libs/engine/MidiControlNode.hpp
+++ b/src/libs/engine/MidiControlNode.hpp
@@ -20,7 +20,6 @@
#include <string>
#include "NodeBase.hpp"
-#include "InternalNode.hpp"
#include "MidiBuffer.hpp"
namespace Ingen {
@@ -37,10 +36,10 @@ class OutputPort;
*
* \ingroup engine
*/
-class MidiControlNode : public InternalNode
+class MidiControlNode : public NodeBase
{
public:
- MidiControlNode(const std::string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size);
+ MidiControlNode(const std::string& path, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size);
void process(SampleCount nframes, FrameTime start, FrameTime end);
diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp
index fac654f0..3ac33a68 100644
--- a/src/libs/engine/MidiNoteNode.cpp
+++ b/src/libs/engine/MidiNoteNode.cpp
@@ -27,6 +27,7 @@
#include "OutputPort.hpp"
#include "Plugin.hpp"
#include "AudioDriver.hpp"
+#include "Patch.hpp"
#include "util.hpp"
using std::cerr; using std::cout; using std::endl;
@@ -35,11 +36,11 @@ using std::cerr; using std::cout; using std::endl;
namespace Ingen {
-MidiNoteNode::MidiNoteNode(const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size)
-: InternalNode(new Plugin(Plugin::Internal, "ingen:note_node"), path, poly, parent, srate, buffer_size),
- _voices(new Raul::Array<Voice>(poly)),
+MidiNoteNode::MidiNoteNode(const string& path, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size)
+: NodeBase(new Plugin(Plugin::Internal, "ingen:note_node"), path, polyphonic, parent, srate, buffer_size),
+ _voices(new Raul::Array<Voice>(_polyphony)),
_prepared_voices(NULL),
- _prepared_poly(poly),
+
_sustain(false)
{
_ports = new Raul::Array<Port*>(5);
@@ -47,27 +48,28 @@ MidiNoteNode::MidiNoteNode(const string& path, uint32_t poly, Patch* parent, Sam
_midi_in_port = new InputPort(this, "MIDIIn", 0, 1, DataType::MIDI, _buffer_size);
_ports->at(0) = _midi_in_port;
- _freq_port = new OutputPort(this, "Frequency", 1, poly, DataType::FLOAT, _buffer_size);
+ _freq_port = new OutputPort(this, "Frequency", 1, _polyphony, DataType::FLOAT, _buffer_size);
_ports->at(1) = _freq_port;
- _vel_port = new OutputPort(this, "Velocity", 2, poly, DataType::FLOAT, _buffer_size);
+ _vel_port = new OutputPort(this, "Velocity", 2, _polyphony, DataType::FLOAT, _buffer_size);
_vel_port->set_metadata("ingen:minimum", 0.0f);
_vel_port->set_metadata("ingen:maximum", 1.0f);
_ports->at(2) = _vel_port;
- _gate_port = new OutputPort(this, "Gate", 3, poly, DataType::FLOAT, _buffer_size);
+ _gate_port = new OutputPort(this, "Gate", 3, _polyphony, DataType::FLOAT, _buffer_size);
_gate_port->set_metadata("ingen:toggled", 1);
_gate_port->set_metadata("ingen:default", 0.0f);
_ports->at(3) = _gate_port;
- _trig_port = new OutputPort(this, "Trigger", 4, poly, DataType::FLOAT, _buffer_size);
+ _trig_port = new OutputPort(this, "Trigger", 4, _polyphony, DataType::FLOAT, _buffer_size);
_trig_port->set_metadata("ingen:toggled", 1);
_trig_port->set_metadata("ingen:default", 0.0f);
_ports->at(4) = _trig_port;
- plugin()->plug_label("note_in");
- assert(plugin()->uri() == "ingen:note_node");
- plugin()->name("Ingen Note Node (MIDI, OSC)");
+ Plugin* p = const_cast<Plugin*>(_plugin);
+ p->plug_label("note_in");
+ assert(p->uri() == "ingen:note_node");
+ p->name("Ingen Note Node (MIDI, OSC)");
}
@@ -80,10 +82,14 @@ MidiNoteNode::~MidiNoteNode()
bool
MidiNoteNode::prepare_poly(uint32_t poly)
{
- InternalNode::prepare_poly(poly);
+ if (!_polyphonic)
+ return true;
+
+ NodeBase::prepare_poly(poly);
_prepared_voices = new Raul::Array<Voice>(poly, *_voices);
- _prepared_poly = poly;
+
+ cerr << path() << " prepared poly " << poly << endl;
return true;
}
@@ -92,16 +98,22 @@ MidiNoteNode::prepare_poly(uint32_t poly)
bool
MidiNoteNode::apply_poly(Raul::Maid& maid, uint32_t poly)
{
+ if (!_polyphonic)
+ return true;
+
NodeBase::apply_poly(maid, poly);
if (_prepared_voices) {
- assert(poly <= _prepared_poly);
+ assert(poly <= _prepared_voices->size());
maid.push(_voices);
_voices = _prepared_voices;
_prepared_voices = NULL;
}
_polyphony = poly;
+ assert(_voices->size() >= _polyphony);
+
+ cerr << path() << " applied poly " << poly << endl;
return true;
}
diff --git a/src/libs/engine/MidiNoteNode.hpp b/src/libs/engine/MidiNoteNode.hpp
index c7110f91..34a926ff 100644
--- a/src/libs/engine/MidiNoteNode.hpp
+++ b/src/libs/engine/MidiNoteNode.hpp
@@ -19,11 +19,10 @@
#define MIDINOTENODE_H
#include <string>
-#include "InternalNode.hpp"
#include "types.hpp"
+#include "NodeBase.hpp"
#include "MidiBuffer.hpp"
-using std::string;
namespace Ingen {
@@ -37,10 +36,10 @@ class OutputPort;
*
* \ingroup engine
*/
-class MidiNoteNode : public InternalNode
+class MidiNoteNode : public NodeBase
{
public:
- MidiNoteNode(const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size);
+ MidiNoteNode(const std::string& path, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size);
~MidiNoteNode();
bool prepare_poly(uint32_t poly);
@@ -75,7 +74,6 @@ private:
Raul::Array<Voice>* _voices;
Raul::Array<Voice>* _prepared_voices;
- uint32_t _prepared_poly;
Key _keys[128];
bool _sustain; ///< Whether or not hold pedal is depressed
diff --git a/src/libs/engine/MidiTriggerNode.cpp b/src/libs/engine/MidiTriggerNode.cpp
index 393cf2f4..7d8fa952 100644
--- a/src/libs/engine/MidiTriggerNode.cpp
+++ b/src/libs/engine/MidiTriggerNode.cpp
@@ -27,8 +27,8 @@
namespace Ingen {
-MidiTriggerNode::MidiTriggerNode(const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size)
-: InternalNode(new Plugin(Plugin::Internal, "ingen:trigger_node"), path, 1, parent, srate, buffer_size)
+MidiTriggerNode::MidiTriggerNode(const string& path, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size)
+: NodeBase(new Plugin(Plugin::Internal, "ingen:trigger_node"), path, false, parent, srate, buffer_size)
{
_ports = new Raul::Array<Port*>(5);
@@ -48,12 +48,13 @@ MidiTriggerNode::MidiTriggerNode(const string& path, uint32_t poly, Patch* paren
_trig_port = new OutputPort(this, "Trigger", 3, 1, DataType::FLOAT, _buffer_size);
_ports->at(3) = _trig_port;
- _vel_port = new OutputPort(this, "Velocity", 4, poly, DataType::FLOAT, _buffer_size);
+ _vel_port = new OutputPort(this, "Velocity", 4, 1, DataType::FLOAT, _buffer_size);
_ports->at(4) = _vel_port;
- plugin()->plug_label("trigger_in");
- assert(plugin()->uri() == "ingen:trigger_node");
- plugin()->name("Ingen Trigger Node (MIDI, OSC)");
+ Plugin* p = const_cast<Plugin*>(_plugin);
+ p->plug_label("trigger_in");
+ assert(p->uri() == "ingen:trigger_node");
+ p->name("Ingen Trigger Node (MIDI, OSC)");
}
diff --git a/src/libs/engine/MidiTriggerNode.hpp b/src/libs/engine/MidiTriggerNode.hpp
index 12f68789..83dbe65f 100644
--- a/src/libs/engine/MidiTriggerNode.hpp
+++ b/src/libs/engine/MidiTriggerNode.hpp
@@ -19,11 +19,9 @@
#define MIDITRIGGERNODE_H
#include <string>
-#include "InternalNode.hpp"
+#include "NodeBase.hpp"
#include "MidiBuffer.hpp"
-using std::string;
-
namespace Ingen {
class InputPort;
@@ -40,10 +38,10 @@ class OutputPort;
*
* \ingroup engine
*/
-class MidiTriggerNode : public InternalNode
+class MidiTriggerNode : public NodeBase
{
public:
- MidiTriggerNode(const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size);
+ MidiTriggerNode(const std::string& path, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size);
void process(SampleCount nframes, FrameTime start, FrameTime end);
diff --git a/src/libs/engine/NodeBase.cpp b/src/libs/engine/NodeBase.cpp
index e8df05d6..90d5864f 100644
--- a/src/libs/engine/NodeBase.cpp
+++ b/src/libs/engine/NodeBase.cpp
@@ -33,10 +33,10 @@ using std::cout; using std::cerr; using std::endl;
namespace Ingen {
-NodeBase::NodeBase(const Plugin* plugin, const string& name, bool poly, Patch* parent, SampleRate srate, size_t buffer_size)
-: Node(parent, name, poly),
+NodeBase::NodeBase(const Plugin* plugin, const string& name, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size)
+: Node(parent, name, polyphonic),
_plugin(plugin),
- _polyphony(parent ? parent->internal_poly() : 1),
+ _polyphony((polyphonic && parent) ? parent->internal_poly() : 1),
_srate(srate),
_buffer_size(buffer_size),
_activated(false),
@@ -85,6 +85,9 @@ NodeBase::deactivate()
bool
NodeBase::prepare_poly(uint32_t poly)
{
+ if (!_polyphonic)
+ return true;
+
if (_ports)
for (size_t i=0; i < _ports->size(); ++i)
_ports->at(i)->prepare_poly(poly);
@@ -96,6 +99,9 @@ NodeBase::prepare_poly(uint32_t poly)
bool
NodeBase::apply_poly(Raul::Maid& maid, uint32_t poly)
{
+ if (!_polyphonic)
+ return true;
+
if (_ports)
for (size_t i=0; i < _ports->size(); ++i)
_ports->at(i)->apply_poly(maid, poly);
diff --git a/src/libs/engine/Plugin.cpp b/src/libs/engine/Plugin.cpp
index 9e92f32c..11e59162 100644
--- a/src/libs/engine/Plugin.cpp
+++ b/src/libs/engine/Plugin.cpp
@@ -24,18 +24,18 @@
namespace Ingen {
Node*
-Plugin::instantiate(const string& name, uint32_t poly, Ingen::Patch* parent, SampleRate srate, size_t buffer_size)
+Plugin::instantiate(const string& name, bool polyphonic, Ingen::Patch* parent, SampleRate srate, size_t buffer_size)
{
assert(_type == Internal);
if (_uri == "ingen:note_node") {
- return new MidiNoteNode(name, poly, parent, srate, buffer_size);
+ return new MidiNoteNode(name, polyphonic, parent, srate, buffer_size);
} else if (_uri == "ingen:trigger_node") {
- return new MidiTriggerNode(name, poly, parent, srate, buffer_size);
+ return new MidiTriggerNode(name, polyphonic, parent, srate, buffer_size);
} else if (_uri == "ingen:control_node") {
- return new MidiControlNode(name, poly, parent, srate, buffer_size);
+ return new MidiControlNode(name, polyphonic, parent, srate, buffer_size);
} else if (_uri == "ingen:transport_node") {
- return new TransportNode(name, poly, parent, srate, buffer_size);
+ return new TransportNode(name, polyphonic, parent, srate, buffer_size);
} else {
return NULL;
}
diff --git a/src/libs/engine/Plugin.hpp b/src/libs/engine/Plugin.hpp
index 46a2fd0f..c4e6b4ce 100644
--- a/src/libs/engine/Plugin.hpp
+++ b/src/libs/engine/Plugin.hpp
@@ -120,7 +120,7 @@ public:
void slv2_plugin(SLV2Plugin p) { _slv2_plugin = p; }
#endif
- Node* instantiate(const string& name, uint32_t poly, Ingen::Patch* parent, SampleRate srate, size_t buffer_size);
+ Node* instantiate(const string& name, bool polyphonic, Ingen::Patch* parent, SampleRate srate, size_t buffer_size);
private:
Type _type;
diff --git a/src/libs/engine/TransportNode.cpp b/src/libs/engine/TransportNode.cpp
index 096ef6d2..afa4cf21 100644
--- a/src/libs/engine/TransportNode.cpp
+++ b/src/libs/engine/TransportNode.cpp
@@ -27,8 +27,8 @@
namespace Ingen {
-TransportNode::TransportNode(const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size)
-: InternalNode(new Plugin(Plugin::Internal, "ingen:transport_node"), path, 1, parent, srate, buffer_size)
+TransportNode::TransportNode(const string& path, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size)
+: NodeBase(new Plugin(Plugin::Internal, "ingen:transport_node"), path, false, parent, srate, buffer_size)
{
#if 0
_num_ports = 10;
@@ -74,9 +74,10 @@ TransportNode::TransportNode(const string& path, uint32_t poly, Patch* parent, S
// new PortInfo("Bar Tick", AUDIO, OUTPUT, 0, 0, 1), buffer_size);
_ports.at(9) = bar_trig_port;
#endif
- plugin()->plug_label("transport");
- assert(plugin()->uri() == "ingen:transport_node");
- plugin()->name("Ingen Transport Node (BROKEN)");
+ Plugin* p = const_cast<Plugin*>(_plugin);
+ p->plug_label("transport");
+ assert(p->uri() == "ingen:transport_node");
+ p->name("Ingen Transport Node (BROKEN)");
}
diff --git a/src/libs/engine/TransportNode.hpp b/src/libs/engine/TransportNode.hpp
index d6edab51..2d90d501 100644
--- a/src/libs/engine/TransportNode.hpp
+++ b/src/libs/engine/TransportNode.hpp
@@ -15,19 +15,15 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#ifndef TRANSPORTNODE_H
#define TRANSPORTNODE_H
-
#include <string>
#include <jack/transport.h>
-#include "InternalNode.hpp"
+#include "NodeBase.hpp"
namespace Ingen {
-using std::string;
-
/** Transport Node, brings timing information into patches.
*
@@ -35,10 +31,10 @@ using std::string;
* signature, etc.. all sample accurate. Using this you can do
* tempo-synced effects or even synthesis, etc.
*/
-class TransportNode : public InternalNode
+class TransportNode : public NodeBase
{
public:
- TransportNode(const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size);
+ TransportNode(const std::string& path, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size);
virtual void process(SampleCount nframes, FrameTime start, FrameTime end);
};
diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp
index 2c4fd7da..435894bd 100644
--- a/src/libs/engine/events/DestroyEvent.cpp
+++ b/src/libs/engine/events/DestroyEvent.cpp
@@ -20,11 +20,10 @@
#include "Engine.hpp"
#include "Patch.hpp"
#include "Tree.hpp"
-#include "Node.hpp"
+#include "NodeBase.hpp"
#include "Plugin.hpp"
#include "AudioDriver.hpp"
#include "MidiDriver.hpp"
-#include "InternalNode.hpp"
#include "DisconnectNodeEvent.hpp"
#include "DisconnectPortEvent.hpp"
#include "ClientBroadcaster.hpp"
diff --git a/src/libs/engine/events/MidiLearnEvent.cpp b/src/libs/engine/events/MidiLearnEvent.cpp
index 441236fc..d0de3d39 100644
--- a/src/libs/engine/events/MidiLearnEvent.cpp
+++ b/src/libs/engine/events/MidiLearnEvent.cpp
@@ -22,6 +22,7 @@
#include "Node.hpp"
#include "MidiControlNode.hpp"
#include "ClientBroadcaster.hpp"
+#include "Plugin.hpp"
namespace Ingen {
diff --git a/src/libs/engine/events/NoteOffEvent.cpp b/src/libs/engine/events/NoteOffEvent.cpp
index 5768e265..4f683903 100644
--- a/src/libs/engine/events/NoteOffEvent.cpp
+++ b/src/libs/engine/events/NoteOffEvent.cpp
@@ -20,6 +20,7 @@
#include "Engine.hpp"
#include "ObjectStore.hpp"
#include "Node.hpp"
+#include "Plugin.hpp"
#include "MidiNoteNode.hpp"
#include "MidiTriggerNode.hpp"