summaryrefslogtreecommitdiffstats
path: root/src/libs/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/engine')
-rw-r--r--src/libs/engine/DSSINode.cpp (renamed from src/libs/engine/DSSIPlugin.cpp)62
-rw-r--r--src/libs/engine/DSSINode.h (renamed from src/libs/engine/DSSIPlugin.h)18
-rw-r--r--src/libs/engine/InternalNode.h5
-rw-r--r--src/libs/engine/LADSPANode.cpp (renamed from src/libs/engine/LADSPAPlugin.cpp)22
-rw-r--r--src/libs/engine/LADSPANode.h (renamed from src/libs/engine/LADSPAPlugin.h)18
-rw-r--r--src/libs/engine/LV2Node.cpp (renamed from src/libs/engine/LV2Plugin.cpp)34
-rw-r--r--src/libs/engine/LV2Node.h (renamed from src/libs/engine/LV2Plugin.h)31
-rw-r--r--src/libs/engine/Makefile.am12
-rw-r--r--src/libs/engine/MidiControlNode.cpp6
-rw-r--r--src/libs/engine/MidiNoteNode.cpp6
-rw-r--r--src/libs/engine/MidiTriggerNode.cpp4
-rw-r--r--src/libs/engine/Node.h1
-rw-r--r--src/libs/engine/NodeBase.cpp18
-rw-r--r--src/libs/engine/NodeBase.h10
-rw-r--r--src/libs/engine/NodeFactory.cpp23
-rw-r--r--src/libs/engine/NodeFactory.h2
-rw-r--r--src/libs/engine/Patch.cpp18
-rw-r--r--src/libs/engine/Patch.h8
-rw-r--r--src/libs/engine/Plugin.h8
-rw-r--r--src/libs/engine/TransportNode.cpp4
-rw-r--r--src/libs/engine/events/DSSIConfigureEvent.cpp2
-rw-r--r--src/libs/engine/events/DSSIConfigureEvent.h10
-rw-r--r--src/libs/engine/events/DSSIControlEvent.cpp2
-rw-r--r--src/libs/engine/events/DSSIControlEvent.h10
-rw-r--r--src/libs/engine/events/DSSIProgramEvent.cpp2
-rw-r--r--src/libs/engine/events/DSSIProgramEvent.h10
-rw-r--r--src/libs/engine/events/DSSIUpdateEvent.cpp4
-rw-r--r--src/libs/engine/events/DSSIUpdateEvent.h8
28 files changed, 162 insertions, 196 deletions
diff --git a/src/libs/engine/DSSIPlugin.cpp b/src/libs/engine/DSSINode.cpp
index 8876f797..2eb72361 100644
--- a/src/libs/engine/DSSIPlugin.cpp
+++ b/src/libs/engine/DSSINode.cpp
@@ -14,7 +14,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "DSSIPlugin.h"
+#include "DSSINode.h"
#include <map>
#include <set>
#include "Om.h"
@@ -28,8 +28,8 @@ using namespace std;
namespace Om {
-DSSIPlugin::DSSIPlugin(const string& name, size_t poly, Patch* parent, DSSI_Descriptor* descriptor, samplerate srate, size_t buffer_size)
-: LADSPAPlugin(name, 1, parent, descriptor->LADSPA_Plugin, srate, buffer_size),
+DSSINode::DSSINode(const Plugin* plugin, const string& name, size_t poly, 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),
_bank(-1),
@@ -42,7 +42,7 @@ DSSIPlugin::DSSIPlugin(const string& name, size_t poly, Patch* parent, DSSI_Desc
}
-DSSIPlugin::~DSSIPlugin()
+DSSINode::~DSSINode()
{
if (_ui_addr != NULL)
lo_address_free(_ui_addr);
@@ -52,12 +52,12 @@ DSSIPlugin::~DSSIPlugin()
}
-/** This needs to be overridden here because LADSPAPlugin::instantiate()
+/** This needs to be overridden here because LADSPANode::instantiate()
* allocates the port array, and we want to add the MIDI input port to that
* array.
*/
bool
-DSSIPlugin::instantiate()
+DSSINode::instantiate()
{
assert(!_ports);
@@ -67,8 +67,8 @@ DSSIPlugin::instantiate()
_ports->at(_ports->size()-1) = _midi_in_port;
}
- // LADSPAPlugin::instantiate checks if _ports is already allocated
- if (!LADSPAPlugin::instantiate()) {
+ // LADSPANode::instantiate checks if _ports is already allocated
+ if (!LADSPANode::instantiate()) {
delete _ports;
return false;
}
@@ -78,9 +78,9 @@ DSSIPlugin::instantiate()
void
-DSSIPlugin::activate()
+DSSINode::activate()
{
- LADSPAPlugin::activate();
+ LADSPANode::activate();
update_programs(false);
set_default_program();
@@ -90,7 +90,7 @@ DSSIPlugin::activate()
void
-DSSIPlugin::set_ui_url(const string& url)
+DSSINode::set_ui_url(const string& url)
{
if (_ui_addr != NULL)
lo_address_free(_ui_addr);
@@ -105,7 +105,7 @@ DSSIPlugin::set_ui_url(const string& url)
void
-DSSIPlugin::set_control(size_t port_num, sample val)
+DSSINode::set_control(size_t port_num, sample val)
{
assert(port_num < _descriptor->PortCount);
((PortBase<sample>*)_ports->at(port_num))->set_value(val, 0);
@@ -113,7 +113,7 @@ DSSIPlugin::set_control(size_t port_num, sample val)
void
-DSSIPlugin::configure(const string& key, const string& val)
+DSSINode::configure(const string& key, const string& val)
{
_dssi_descriptor->configure(_instances[0], key.c_str(), val.c_str());
_configures[key] = val;
@@ -122,7 +122,7 @@ DSSIPlugin::configure(const string& key, const string& val)
void
-DSSIPlugin::program(int bank, int program)
+DSSINode::program(int bank, int program)
{
if (_dssi_descriptor->select_program)
_dssi_descriptor->select_program(_instances[0], bank, program);
@@ -133,7 +133,7 @@ DSSIPlugin::program(int bank, int program)
void
-DSSIPlugin::convert_events()
+DSSINode::convert_events()
{
assert(has_midi_input());
assert(_midi_in_port != NULL);
@@ -153,14 +153,14 @@ DSSIPlugin::convert_events()
bool
-DSSIPlugin::has_midi_input() const
+DSSINode::has_midi_input() const
{
return (_dssi_descriptor->run_synth || _dssi_descriptor->run_multiple_synths);
}
void
-DSSIPlugin::run(size_t nframes)
+DSSINode::run(size_t nframes)
{
NodeBase::run(nframes);
@@ -176,13 +176,13 @@ DSSIPlugin::run(size_t nframes)
_dssi_descriptor->run_multiple_synths(1, _instances, nframes,
events, events_sizes);
} else {
- LADSPAPlugin::run(nframes);
+ LADSPANode::run(nframes);
}
}
void
-DSSIPlugin::send_control(int port_num, float value)
+DSSINode::send_control(int port_num, float value)
{
string path = _ui_base_path + "/control";
lo_send(_ui_addr, path.c_str(), "if", port_num, value);
@@ -190,7 +190,7 @@ DSSIPlugin::send_control(int port_num, float value)
void
-DSSIPlugin::send_program(int bank, int value)
+DSSINode::send_program(int bank, int value)
{
string path = _ui_base_path + "/program";
lo_send(_ui_addr, path.c_str(), "ii", bank, value);
@@ -198,7 +198,7 @@ DSSIPlugin::send_program(int bank, int value)
void
-DSSIPlugin::send_configure(const string& key, const string& val)
+DSSINode::send_configure(const string& key, const string& val)
{
string path = _ui_base_path + "/configure";
lo_send(_ui_addr, path.c_str(), "ss", key.c_str(), val.c_str());
@@ -206,7 +206,7 @@ DSSIPlugin::send_configure(const string& key, const string& val)
void
-DSSIPlugin::send_show()
+DSSINode::send_show()
{
string path = _ui_base_path + "/show";
lo_send(_ui_addr, path.c_str(), NULL);
@@ -214,7 +214,7 @@ DSSIPlugin::send_show()
void
-DSSIPlugin::send_hide()
+DSSINode::send_hide()
{
string path = _ui_base_path + "/hide";
lo_send(_ui_addr, path.c_str(), NULL);
@@ -222,7 +222,7 @@ DSSIPlugin::send_hide()
void
-DSSIPlugin::send_quit()
+DSSINode::send_quit()
{
string path = _ui_base_path + "/quit";
lo_send(_ui_addr, path.c_str(), NULL);
@@ -230,7 +230,7 @@ DSSIPlugin::send_quit()
void
-DSSIPlugin::send_update()
+DSSINode::send_update()
{
// send "configure"s
for (map<string, string>::iterator i = _configures.begin(); i != _configures.end(); ++i)
@@ -250,7 +250,7 @@ DSSIPlugin::send_update()
bool
-DSSIPlugin::update_programs(bool send_events)
+DSSINode::update_programs(bool send_events)
{
// remember all old banks and programs
set<pair<int, int> > to_be_deleted;
@@ -301,7 +301,7 @@ DSSIPlugin::update_programs(bool send_events)
void
-DSSIPlugin::set_default_program()
+DSSINode::set_default_program()
{
map<int, Bank>::const_iterator iter = _banks.begin();
if (iter != _banks.end()) {
@@ -312,8 +312,8 @@ DSSIPlugin::set_default_program()
}
-const map<int, DSSIPlugin::Bank>&
-DSSIPlugin::get_programs() const
+const map<int, DSSINode::Bank>&
+DSSINode::get_programs() const
{
return _banks;
}
@@ -321,9 +321,9 @@ DSSIPlugin::get_programs() const
/*
void
-DSSIPlugin::send_creation_messages(ClientInterface* client) const
+DSSINode::send_creation_messages(ClientInterface* client) const
{
- LADSPAPlugin::send_creation_messages(client);
+ LADSPANode::send_creation_messages(client);
for (map<int, Bank>::const_iterator i = get_programs().begin();
i != get_programs().end(); ++i) {
diff --git a/src/libs/engine/DSSIPlugin.h b/src/libs/engine/DSSINode.h
index 30afd9d2..deef0b8b 100644
--- a/src/libs/engine/DSSIPlugin.h
+++ b/src/libs/engine/DSSINode.h
@@ -14,13 +14,13 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef DSSIPLUGIN_H
-#define DSSIPLUGIN_H
+#ifndef DSSINODE_H
+#define DSSINODE_H
#include <asoundlib.h>
#include <dssi.h>
#include <lo/lo.h>
-#include "LADSPAPlugin.h"
+#include "LADSPANode.h"
namespace Om {
@@ -33,14 +33,14 @@ namespace Shared {
/** An instance of a DSSI plugin.
*/
-class DSSIPlugin : public LADSPAPlugin
+class DSSINode : public LADSPANode
{
public:
typedef map<int, string> Bank;
- DSSIPlugin(const string& name, size_t poly, Patch* parent, DSSI_Descriptor* descriptor, samplerate srate, size_t buffer_size);
- ~DSSIPlugin();
+ DSSINode(const Plugin* plugin, const string& name, size_t poly, Patch* parent, DSSI_Descriptor* descriptor, samplerate srate, size_t buffer_size);
+ ~DSSINode();
bool instantiate();
@@ -66,8 +66,8 @@ public:
private:
// Prevent copies (undefined)
- DSSIPlugin(const DSSIPlugin& copy);
- DSSIPlugin& operator=(const DSSIPlugin& copy);
+ DSSINode(const DSSINode& copy);
+ DSSINode& operator=(const DSSINode& copy);
bool has_midi_input() const;
@@ -105,5 +105,5 @@ private:
} // namespace Om
-#endif // DSSIPLUGIN_H
+#endif // DSSINODE_H
diff --git a/src/libs/engine/InternalNode.h b/src/libs/engine/InternalNode.h
index 14a4bc95..e7c35ebd 100644
--- a/src/libs/engine/InternalNode.h
+++ b/src/libs/engine/InternalNode.h
@@ -33,8 +33,8 @@ class Patch;
class InternalNode : public NodeBase
{
public:
- InternalNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size)
- : NodeBase(path, poly, parent, srate, buffer_size),
+ InternalNode(const Plugin* plugin, const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size)
+ : NodeBase(plugin, path, poly, parent, srate, buffer_size),
_is_added(false)
{
_plugin.lib_path("/Om");
@@ -53,7 +53,6 @@ public:
//{ NodeBase::send_creation_messages(client); }
virtual const Plugin* plugin() const { return &_plugin; }
- virtual void plugin(const Plugin* const) { exit(EXIT_FAILURE); }
protected:
// Disallow copies (undefined)
diff --git a/src/libs/engine/LADSPAPlugin.cpp b/src/libs/engine/LADSPANode.cpp
index 37d66805..0ca0aca7 100644
--- a/src/libs/engine/LADSPAPlugin.cpp
+++ b/src/libs/engine/LADSPANode.cpp
@@ -15,7 +15,7 @@
*/
-#include "LADSPAPlugin.h"
+#include "LADSPANode.h"
#include <iostream>
#include <cassert>
#include "float.h"
@@ -28,13 +28,13 @@
namespace Om {
-/** Partially construct a LADSPAPlugin.
+/** Partially construct a LADSPANode.
*
* Object is not usable until instantiate() is called with success.
* (It _will_ crash!)
*/
-LADSPAPlugin::LADSPAPlugin(const string& path, size_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, samplerate srate, size_t buffer_size)
-: NodeBase(path, poly, parent, srate, buffer_size),
+LADSPANode::LADSPANode(const Plugin* plugin, const string& path, size_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, samplerate srate, size_t buffer_size)
+: NodeBase(plugin, path, poly, parent, srate, buffer_size),
_descriptor(descriptor),
_instances(NULL)
{
@@ -51,7 +51,7 @@ LADSPAPlugin::LADSPAPlugin(const string& path, size_t poly, Patch* parent, const
* value is false, this object may not be used.
*/
bool
-LADSPAPlugin::instantiate()
+LADSPANode::instantiate()
{
// Note that a DSSI plugin might tack more on to the end of this
if (!_ports)
@@ -128,7 +128,7 @@ LADSPAPlugin::instantiate()
}
-LADSPAPlugin::~LADSPAPlugin()
+LADSPANode::~LADSPANode()
{
for (size_t i=0; i < _poly; ++i)
_descriptor->cleanup(_instances[i]);
@@ -138,7 +138,7 @@ LADSPAPlugin::~LADSPAPlugin()
void
-LADSPAPlugin::activate()
+LADSPANode::activate()
{
NodeBase::activate();
@@ -160,7 +160,7 @@ LADSPAPlugin::activate()
void
-LADSPAPlugin::deactivate()
+LADSPANode::deactivate()
{
NodeBase::deactivate();
@@ -171,7 +171,7 @@ LADSPAPlugin::deactivate()
void
-LADSPAPlugin::run(size_t nframes)
+LADSPANode::run(size_t nframes)
{
NodeBase::run(nframes); // mixes down input ports
for (size_t i=0; i < _poly; ++i)
@@ -180,7 +180,7 @@ LADSPAPlugin::run(size_t nframes)
void
-LADSPAPlugin::set_port_buffer(size_t voice, size_t port_num, void* buf)
+LADSPANode::set_port_buffer(size_t voice, size_t port_num, void* buf)
{
assert(voice < _poly);
@@ -193,7 +193,7 @@ LADSPAPlugin::set_port_buffer(size_t voice, size_t port_num, void* buf)
#if 0
// Based on code stolen from jack-rack
void
-LADSPAPlugin::get_port_vals(ulong port_index, PortInfo* info)
+LADSPANode::get_port_vals(ulong port_index, PortInfo* info)
{
LADSPA_Data upper = 0.0f;
LADSPA_Data lower = 0.0f;
diff --git a/src/libs/engine/LADSPAPlugin.h b/src/libs/engine/LADSPANode.h
index e91b6a36..c8b498c9 100644
--- a/src/libs/engine/LADSPAPlugin.h
+++ b/src/libs/engine/LADSPANode.h
@@ -14,8 +14,8 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef LADSPAPLUGIN_H
-#define LADSPAPLUGIN_H
+#ifndef LADSPANODE_H
+#define LADSPANODE_H
#include <string>
#include <ladspa.h>
@@ -30,11 +30,11 @@ namespace Om {
*
* \ingroup engine
*/
-class LADSPAPlugin : public NodeBase
+class LADSPANode : public NodeBase
{
public:
- LADSPAPlugin(const string& name, size_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, samplerate srate, size_t buffer_size);
- virtual ~LADSPAPlugin();
+ LADSPANode(const Plugin* plugin, const string& name, size_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, samplerate srate, size_t buffer_size);
+ virtual ~LADSPANode();
virtual bool instantiate();
@@ -50,18 +50,16 @@ public:
protected:
// Prevent copies (undefined)
- LADSPAPlugin(const LADSPAPlugin& copy);
- LADSPAPlugin& operator=(const LADSPAPlugin&);
+ LADSPANode(const LADSPANode& copy);
+ LADSPANode& operator=(const LADSPANode&);
//void get_port_vals(ulong port_index, PortInfo* info);
const LADSPA_Descriptor* _descriptor;
LADSPA_Handle* _instances;
-
- const Plugin* _plugin;
};
} // namespace Om
-#endif // LADSPAPLUGIN_H
+#endif // LADSPANODE_H
diff --git a/src/libs/engine/LV2Plugin.cpp b/src/libs/engine/LV2Node.cpp
index 411caa36..34bbe61e 100644
--- a/src/libs/engine/LV2Plugin.cpp
+++ b/src/libs/engine/LV2Node.cpp
@@ -14,7 +14,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "LV2Plugin.h"
+#include "LV2Node.h"
#include <iostream>
#include <cassert>
#include "float.h"
@@ -27,19 +27,19 @@
namespace Om {
-/** Partially construct a LV2Plugin.
+/** Partially construct a LV2Node.
*
* Object is not usable until instantiate() is called with success.
* (It _will_ crash!)
*/
-LV2Plugin::LV2Plugin(const string& name,
- size_t poly,
- Patch* parent,
- const SLV2Plugin* plugin,
- samplerate srate,
- size_t buffer_size)
-: NodeBase(name, poly, parent, srate, buffer_size),
- _lv2_plugin(plugin),
+LV2Node::LV2Node(const Plugin* plugin,
+ const string& name,
+ size_t poly,
+ Patch* parent,
+ samplerate srate,
+ size_t buffer_size)
+: NodeBase(plugin, name, poly, parent, srate, buffer_size),
+ _lv2_plugin(plugin->slv2_plugin()),
_instances(NULL)
{
assert(_lv2_plugin);
@@ -55,7 +55,7 @@ LV2Plugin::LV2Plugin(const string& name,
* value is false, this object may not be used.
*/
bool
-LV2Plugin::instantiate()
+LV2Node::instantiate()
{
size_t num_ports = slv2_plugin_get_num_ports(_lv2_plugin);
assert(num_ports > 0);
@@ -122,7 +122,7 @@ LV2Plugin::instantiate()
}
-LV2Plugin::~LV2Plugin()
+LV2Node::~LV2Node()
{
for (size_t i=0; i < _poly; ++i)
slv2_instance_free(_instances[i]);
@@ -132,7 +132,7 @@ LV2Plugin::~LV2Plugin()
void
-LV2Plugin::activate()
+LV2Node::activate()
{
NodeBase::activate();
@@ -153,7 +153,7 @@ LV2Plugin::activate()
void
-LV2Plugin::deactivate()
+LV2Node::deactivate()
{
NodeBase::deactivate();
@@ -163,7 +163,7 @@ LV2Plugin::deactivate()
void
-LV2Plugin::run(size_t nframes)
+LV2Node::run(size_t nframes)
{
NodeBase::run(nframes); // mixes down input ports
for (size_t i=0; i < _poly; ++i)
@@ -172,7 +172,7 @@ LV2Plugin::run(size_t nframes)
void
-LV2Plugin::set_port_buffer(size_t voice, size_t port_num, void* buf)
+LV2Node::set_port_buffer(size_t voice, size_t port_num, void* buf)
{
assert(voice < _poly);
@@ -186,7 +186,7 @@ LV2Plugin::set_port_buffer(size_t voice, size_t port_num, void* buf)
#if 0
// Based on code stolen from jack-rack
void
-LV2Plugin::get_port_vals(ulong port_index, PortInfo* info)
+LV2Node::get_port_vals(ulong port_index, PortInfo* info)
{
LV2_Data upper = 0.0f;
LV2_Data lower = 0.0f;
diff --git a/src/libs/engine/LV2Plugin.h b/src/libs/engine/LV2Node.h
index 5e19b6c4..0956271c 100644
--- a/src/libs/engine/LV2Plugin.h
+++ b/src/libs/engine/LV2Node.h
@@ -14,8 +14,8 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef LV2PLUGIN_H
-#define LV2PLUGIN_H
+#ifndef LV2NODE_H
+#define LV2NODE_H
#include <string>
#include <slv2/slv2.h>
@@ -30,17 +30,17 @@ namespace Om {
*
* \ingroup engine
*/
-class LV2Plugin : public NodeBase
+class LV2Node : public NodeBase
{
public:
- LV2Plugin(const string& name,
- size_t poly,
- Patch* parent,
- const SLV2Plugin* plugin,
- samplerate srate,
- size_t buffer_size);
+ LV2Node(const Plugin* plugin,
+ const string& name,
+ size_t poly,
+ Patch* parent,
+ samplerate srate,
+ size_t buffer_size);
- virtual ~LV2Plugin();
+ virtual ~LV2Node();
virtual bool instantiate();
@@ -51,24 +51,19 @@ public:
void set_port_buffer(size_t voice, size_t port_num, void* buf);
- const Plugin* plugin() const { return _om_plugin; }
- void plugin(const Plugin* const p) { _om_plugin = p; }
-
protected:
// Prevent copies (undefined)
- LV2Plugin(const LV2Plugin& copy);
- LV2Plugin& operator=(const LV2Plugin&);
+ LV2Node(const LV2Node& copy);
+ LV2Node& operator=(const LV2Node&);
//void get_port_vals(ulong port_index, PortInfo* info);
const SLV2Plugin* _lv2_plugin;
SLV2Instance** _instances;
-
- const Plugin* _om_plugin;
};
} // namespace Om
-#endif // LV2PLUGIN_H
+#endif // LV2NODE_H
diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am
index 8a01b21e..0aae5647 100644
--- a/src/libs/engine/Makefile.am
+++ b/src/libs/engine/Makefile.am
@@ -180,14 +180,14 @@ endif
if WITH_LADSPA
libom_la_SOURCES += \
- LADSPAPlugin.h \
- LADSPAPlugin.cpp
+ LADSPANode.h \
+ LADSPANode.cpp
endif
if WITH_DSSI
libom_la_SOURCES += \
- DSSIPlugin.h \
- DSSIPlugin.cpp \
+ DSSINode.h \
+ DSSINode.cpp \
events/DSSIConfigureEvent.cpp \
events/DSSIConfigureEvent.h \
events/DSSIControlEvent.cpp \
@@ -200,8 +200,8 @@ endif
if WITH_LV2
libom_la_SOURCES += \
- LV2Plugin.h \
- LV2Plugin.cpp
+ LV2Node.h \
+ LV2Node.cpp
endif
if WITH_LASH
diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp
index 0ce45136..225c3753 100644
--- a/src/libs/engine/MidiControlNode.cpp
+++ b/src/libs/engine/MidiControlNode.cpp
@@ -31,11 +31,10 @@ namespace Om {
MidiControlNode::MidiControlNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size)
-: InternalNode(path, 1, parent, srate, buffer_size),
+: InternalNode(new Plugin(Plugin::Internal, "Om:ControlNode"), path, 1, parent, srate, buffer_size),
_learning(false)
{
- _num_ports = 7;
- _ports = new Array<Port*>(_num_ports);
+ _ports = new Array<Port*>(7);
_midi_in_port = new InputPort<MidiMessage>(this, "MIDI In", 0, 1, DataType::MIDI, _buffer_size);
_ports->at(0) = _midi_in_port;
@@ -58,7 +57,6 @@ MidiControlNode::MidiControlNode(const string& path, size_t poly, Patch* parent,
_control_port = new OutputPort<sample>(this, "Out (CR)", 6, 1, DataType::FLOAT, 1);
_ports->at(6) = _control_port;
- _plugin.type(Plugin::Internal);
_plugin.plug_label("midi_control_in");
_plugin.name("Om Control Node (MIDI)");
}
diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp
index 4c0280bd..a2a95039 100644
--- a/src/libs/engine/MidiNoteNode.cpp
+++ b/src/libs/engine/MidiNoteNode.cpp
@@ -35,12 +35,11 @@ namespace Om {
MidiNoteNode::MidiNoteNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size)
-: InternalNode(path, poly, parent, srate, buffer_size),
+: InternalNode(new Plugin(Plugin::Internal, "Om:NoteNode"), path, poly, parent, srate, buffer_size),
_voices(new Voice[poly]),
_sustain(false)
{
- _num_ports = 5;
- _ports = new Array<Port*>(_num_ports);
+ _ports = new Array<Port*>(5);
_midi_in_port = new InputPort<MidiMessage>(this, "DataType::MIDI In", 0, 1, DataType::MIDI, _buffer_size);
_ports->at(0) = _midi_in_port;
@@ -61,7 +60,6 @@ MidiNoteNode::MidiNoteNode(const string& path, size_t poly, Patch* parent, sampl
// new PortInfo("Trigger", AUDIO, OUTPUT, 0, 0, 1), _buffer_size);
_ports->at(4) = _trig_port;
- _plugin.type(Plugin::Internal);
_plugin.plug_label("note_in");
_plugin.name("Om Note Node (MIDI, OSC)");
}
diff --git a/src/libs/engine/MidiTriggerNode.cpp b/src/libs/engine/MidiTriggerNode.cpp
index d658ddc0..6a2e0a1c 100644
--- a/src/libs/engine/MidiTriggerNode.cpp
+++ b/src/libs/engine/MidiTriggerNode.cpp
@@ -26,9 +26,8 @@ namespace Om {
MidiTriggerNode::MidiTriggerNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size)
-: InternalNode(path, 1, parent, srate, buffer_size)
+: InternalNode(new Plugin(Plugin::Internal, "Om:TriggerNode"), path, 1, parent, srate, buffer_size)
{
- _num_ports = 5;
_ports = new Array<Port*>(5);
_midi_in_port = new InputPort<MidiMessage>(this, "DataType::MIDI In", 0, 1, DataType::MIDI, _buffer_size);
@@ -50,7 +49,6 @@ MidiTriggerNode::MidiTriggerNode(const string& path, size_t poly, Patch* parent,
// new PortInfo("Velocity", AUDIO, OUTPUT, 0, 0, 1), _buffer_size);
_ports->at(4) = _vel_port;
- _plugin.type(Plugin::Internal);
_plugin.plug_label("trigger_in");
_plugin.name("Om Trigger Node (MIDI, OSC)");
}
diff --git a/src/libs/engine/Node.h b/src/libs/engine/Node.h
index d169e772..f706dc64 100644
--- a/src/libs/engine/Node.h
+++ b/src/libs/engine/Node.h
@@ -99,7 +99,6 @@ public:
* Not the best name - not all nodes come from plugins (ie Patch)
*/
virtual const Plugin* plugin() const = 0;
- virtual void plugin(const Plugin* const pi) = 0;
/** Add self to a Patch.
*
diff --git a/src/libs/engine/NodeBase.cpp b/src/libs/engine/NodeBase.cpp
index 4eeada15..a5f23e84 100644
--- a/src/libs/engine/NodeBase.cpp
+++ b/src/libs/engine/NodeBase.cpp
@@ -34,18 +34,19 @@ using std::cout; using std::cerr; using std::endl;
namespace Om {
-NodeBase::NodeBase(const string& name, size_t poly, Patch* parent, samplerate srate, size_t buffer_size)
+NodeBase::NodeBase(const Plugin* plugin, const string& name, size_t poly, Patch* parent, samplerate srate, size_t buffer_size)
: Node(parent, name),
+ _plugin(plugin),
_poly(poly),
_srate(srate),
_buffer_size(buffer_size),
_activated(false),
- _num_ports(0),
_ports(NULL),
_traversed(false),
_providers(new List<Node*>()),
_dependants(new List<Node*>())
{
+ assert(_plugin);
assert(_poly > 0);
assert(_parent == NULL || (_poly == parent->internal_poly() || _poly == 1));
}
@@ -58,7 +59,7 @@ NodeBase::~NodeBase()
delete _providers;
delete _dependants;
- for (size_t i=0; i < _num_ports; ++i)
+ for (size_t i=0; i < num_ports(); ++i)
delete _ports->at(i);
}
@@ -108,7 +109,7 @@ NodeBase::remove_from_store()
}
// Remove ports
- for (size_t i=0; i < _num_ports; ++i) {
+ for (size_t i=0; i < num_ports(); ++i) {
node = om->object_store()->remove(_ports->at(i)->path());
if (node != NULL) {
assert(om->object_store()->find(_ports->at(i)->path()) == NULL);
@@ -125,11 +126,8 @@ NodeBase::run(size_t nframes)
{
assert(_activated);
// Mix down any ports with multiple inputs
- Port* p;
- for (size_t i=0; i < _ports->size(); ++i) {
- p = _ports->at(i);
- p->prepare_buffers(nframes);
- }
+ for (size_t i=0; i < _ports->size(); ++i)
+ _ports->at(i)->prepare_buffers(nframes);
}
@@ -147,7 +145,7 @@ NodeBase::set_path(const Path& new_path)
TreeNode<OmObject*>* treenode = NULL;
// Reinsert ports
- for (size_t i=0; i < _num_ports; ++i) {
+ for (size_t i=0; i < num_ports(); ++i) {
treenode = om->object_store()->remove(old_path +"/"+ _ports->at(i)->name());
assert(treenode != NULL);
assert(treenode->node() == _ports->at(i));
diff --git a/src/libs/engine/NodeBase.h b/src/libs/engine/NodeBase.h
index c114aa96..d7748543 100644
--- a/src/libs/engine/NodeBase.h
+++ b/src/libs/engine/NodeBase.h
@@ -40,7 +40,7 @@ namespace Shared {
class NodeBase : public Node
{
public:
- NodeBase(const string& name, size_t poly, Patch* parent, samplerate srate, size_t buffer_size);
+ NodeBase(const Plugin* plugin, const string& name, size_t poly, Patch* parent, samplerate srate, size_t buffer_size);
virtual ~NodeBase();
@@ -60,7 +60,7 @@ public:
//void send_creation_messages(ClientInterface* client) const;
- size_t num_ports() const { return _num_ports; }
+ size_t num_ports() const { return _ports ? _ports->size() : 0; }
size_t poly() const { return _poly; }
bool traversed() const { return _traversed; }
void traversed(bool b) { _traversed = b; }
@@ -75,8 +75,7 @@ public:
Patch* parent_patch() const { return (_parent == NULL) ? NULL : _parent->as_patch(); }
- virtual const Plugin* plugin() const { exit(EXIT_FAILURE); }
- virtual void plugin(const Plugin* const pi) { exit(EXIT_FAILURE); }
+ virtual const Plugin* plugin() const { return _plugin; }
void set_path(const Path& new_path);
@@ -85,13 +84,14 @@ protected:
NodeBase(const NodeBase&);
NodeBase& operator=(const NodeBase&);
+ const Plugin* _plugin;
+
size_t _poly;
samplerate _srate;
size_t _buffer_size;
bool _activated;
- size_t _num_ports; ///< number of ports PER VOICE
Array<Port*>* _ports; ///< Access in audio thread only
bool _traversed; ///< Flag for process order algorithm
diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp
index 9e7128b6..a26744d2 100644
--- a/src/libs/engine/NodeFactory.cpp
+++ b/src/libs/engine/NodeFactory.cpp
@@ -41,14 +41,14 @@
#include "Om.h"
#include "OmApp.h"
#ifdef HAVE_SLV2
-#include "LV2Plugin.h"
+#include "LV2Node.h"
#include <slv2/slv2.h>
#endif
#ifdef HAVE_LADSPA
-#include "LADSPAPlugin.h"
+#include "LADSPANode.h"
#endif
#ifdef HAVE_DSSI
-#include "DSSIPlugin.h"
+#include "DSSINode.h"
#endif
using std::string;
@@ -352,14 +352,13 @@ NodeFactory::load_lv2_plugin(const string& plug_uri,
Node* n = NULL;
if (plugin) {
- n = new Om::LV2Plugin(node_name, poly, parent, plugin->slv2_plugin(),
+ n = new Om::LV2Node(plugin, node_name, poly, parent,
om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size());
- bool success = ((LV2Plugin*)n)->instantiate();
+ bool success = ((LV2Node*)n)->instantiate();
if (!success) {
delete n;
n = NULL;
}
- n->plugin(plugin);
}
return n;
@@ -528,15 +527,13 @@ NodeFactory::load_dssi_plugin(const string& uri,
return NULL;
}
- n = new DSSIPlugin(name, poly, parent, descriptor,
+ n = new DSSINode(plugin, name, poly, parent, descriptor,
om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size());
- bool success = ((DSSIPlugin*)n)->instantiate();
+ bool success = ((DSSINode*)n)->instantiate();
if (!success) {
delete n;
n = NULL;
}
-
- n->plugin(plugin);
return n;
}
@@ -693,16 +690,14 @@ NodeFactory::load_ladspa_plugin(const string& uri,
return NULL;
}
- n = new LADSPAPlugin(name, poly, parent, descriptor,
+ n = new LADSPANode(plugin, name, poly, parent, descriptor,
om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size());
- bool success = ((LADSPAPlugin*)n)->instantiate();
+ bool success = ((LADSPANode*)n)->instantiate();
if (!success) {
delete n;
n = NULL;
}
- n->plugin(plugin);
-
return n;
}
diff --git a/src/libs/engine/NodeFactory.h b/src/libs/engine/NodeFactory.h
index bec300bf..f6a8dbd1 100644
--- a/src/libs/engine/NodeFactory.h
+++ b/src/libs/engine/NodeFactory.h
@@ -39,7 +39,7 @@ class Plugin;
* NodeFactory's responsibility is to get enough information to allow the
* loading of a plugin possible (ie finding/opening shared libraries etc)
*
- * The constructor of various Node types (ie LADSPAPlugin) are responsible
+ * The constructor of various Node types (ie LADSPANode) are responsible
* for actually creating a Node instance of the plugin.
*
* \ingroup engine
diff --git a/src/libs/engine/Patch.cpp b/src/libs/engine/Patch.cpp
index 9e9ca173..1e9aa566 100644
--- a/src/libs/engine/Patch.cpp
+++ b/src/libs/engine/Patch.cpp
@@ -38,17 +38,15 @@ namespace Om {
Patch::Patch(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size, size_t internal_poly)
-: NodeBase(path, poly, parent, srate, buffer_size),
+: NodeBase(new Plugin(Plugin::Patch, "Om:Patch"), path, poly, parent, srate, buffer_size),
_internal_poly(internal_poly),
_process_order(NULL),
_process(false)
{
assert(internal_poly >= 1);
- _plugin.type(Plugin::Patch);
- _plugin.uri("http://codeson.net/grauph/patch");
_plugin.plug_label("om_patch");
- _plugin.name("Om patch");
+ _plugin.name("Om Patch");
//std::cerr << "Creating patch " << _name << ", poly = " << poly
// << ", internal poly = " << internal_poly << std::endl;
@@ -153,18 +151,6 @@ Patch::run(size_t nframes)
}
-/** Returns the number of ports.
- *
- * Needs to override the NodeBase implementation since a Patch's ports are really
- * just it's input and output nodes' ports.
- */
-size_t
-Patch::num_ports() const
-{
- return _patch_ports.size();
-}
-
-
#if 0
void
Patch::send_creation_messages(ClientInterface* client) const
diff --git a/src/libs/engine/Patch.h b/src/libs/engine/Patch.h
index 5f2782d5..201912b5 100644
--- a/src/libs/engine/Patch.h
+++ b/src/libs/engine/Patch.h
@@ -58,8 +58,6 @@ public:
void run(size_t nframes);
- size_t num_ports() const;
-
//void send_creation_messages(ClientInterface* client) const;
void add_to_store();
@@ -94,21 +92,21 @@ public:
void external_ports(Array<Port*>* pa) { _ports = pa; }
Array<Node*>* build_process_order() const;
- inline void build_process_order_recursive(Node* n, Array<Node*>* order) const;
- /** Whether to run this patch's DSP in the audio thread */
+ /** Whether to run this patch's DSP bits in the audio thread */
bool process() const { return _process; }
void process(bool p);
size_t internal_poly() const { return _internal_poly; }
const Plugin* plugin() const { return &_plugin; }
- void plugin(const Plugin* const) { exit(EXIT_FAILURE); }
private:
// Prevent copies (undefined)
Patch(const Patch&);
Patch& operator=(const Patch&);
+
+ inline void build_process_order_recursive(Node* n, Array<Node*>* order) const;
size_t _internal_poly;
Array<Node*>* _process_order; ///< Accessed in audio thread only
diff --git a/src/libs/engine/Plugin.h b/src/libs/engine/Plugin.h
index d350b1e8..fc7ed7c4 100644
--- a/src/libs/engine/Plugin.h
+++ b/src/libs/engine/Plugin.h
@@ -46,6 +46,12 @@ class Plugin
public:
enum Type { LV2, LADSPA, DSSI, Internal, Patch };
+ Plugin(Type type, const string& uri)
+ : m_type(type)
+ , m_uri(uri)
+ {}
+
+ // FIXME: remove
Plugin() : m_type(Internal), m_lib_path("/Om"),
m_id(0), m_library(NULL)
{
@@ -119,7 +125,7 @@ public:
// FIXME: ew
#ifdef HAVE_SLV2
- SLV2Plugin* slv2_plugin() { return m_slv2_plugin; }
+ SLV2Plugin* slv2_plugin() const { return m_slv2_plugin; }
void slv2_plugin(const SLV2Plugin* p) { m_slv2_plugin = p; }
#endif
diff --git a/src/libs/engine/TransportNode.cpp b/src/libs/engine/TransportNode.cpp
index 2a67a49a..faa647a2 100644
--- a/src/libs/engine/TransportNode.cpp
+++ b/src/libs/engine/TransportNode.cpp
@@ -29,9 +29,8 @@ namespace Om {
TransportNode::TransportNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size)
-: InternalNode(path, 1, parent, srate, buffer_size)
+: InternalNode(new Plugin(Plugin::Internal, "Om:TransportNode"), path, 1, parent, srate, buffer_size)
{
- _num_ports = 0;
#if 0
_num_ports = 10;
_ports.alloc(_num_ports);
@@ -76,7 +75,6 @@ TransportNode::TransportNode(const string& path, size_t poly, Patch* parent, sam
// new PortInfo("Bar Tick", AUDIO, OUTPUT, 0, 0, 1), buffer_size);
_ports.at(9) = bar_trig_port;
#endif
- _plugin.type(Plugin::Internal);
_plugin.plug_label("transport");
_plugin.name("Om Transport Node (BROKEN)");
}
diff --git a/src/libs/engine/events/DSSIConfigureEvent.cpp b/src/libs/engine/events/DSSIConfigureEvent.cpp
index 2ade4671..c7bfdb61 100644
--- a/src/libs/engine/events/DSSIConfigureEvent.cpp
+++ b/src/libs/engine/events/DSSIConfigureEvent.cpp
@@ -41,7 +41,7 @@ DSSIConfigureEvent::pre_process()
Node* node = om->object_store()->find_node(m_node_path);
if (node != NULL && node->plugin()->type() == Plugin::DSSI) {
- m_node = (DSSIPlugin*)node;
+ m_node = (DSSINode*)node;
m_node->configure(m_key, m_val);
}
diff --git a/src/libs/engine/events/DSSIConfigureEvent.h b/src/libs/engine/events/DSSIConfigureEvent.h
index 00b4a134..0e77e217 100644
--- a/src/libs/engine/events/DSSIConfigureEvent.h
+++ b/src/libs/engine/events/DSSIConfigureEvent.h
@@ -18,7 +18,7 @@
#define DSSICONFIGUREEVENT_H
#include "QueuedEvent.h"
-#include "DSSIPlugin.h"
+#include "DSSINode.h"
namespace Om {
@@ -37,10 +37,10 @@ public:
void post_process();
private:
- string m_node_path;
- string m_key;
- string m_val;
- DSSIPlugin* m_node;
+ string m_node_path;
+ string m_key;
+ string m_val;
+ DSSINode* m_node;
};
diff --git a/src/libs/engine/events/DSSIControlEvent.cpp b/src/libs/engine/events/DSSIControlEvent.cpp
index ea3e70ac..986fa33c 100644
--- a/src/libs/engine/events/DSSIControlEvent.cpp
+++ b/src/libs/engine/events/DSSIControlEvent.cpp
@@ -42,7 +42,7 @@ DSSIControlEvent::pre_process()
if (node->plugin()->type() != Plugin::DSSI)
m_node = NULL;
else
- m_node = (DSSIPlugin*)node;
+ m_node = (DSSINode*)node;
QueuedEvent::pre_process();
}
diff --git a/src/libs/engine/events/DSSIControlEvent.h b/src/libs/engine/events/DSSIControlEvent.h
index 30a5279e..33d9ec5e 100644
--- a/src/libs/engine/events/DSSIControlEvent.h
+++ b/src/libs/engine/events/DSSIControlEvent.h
@@ -18,7 +18,7 @@
#define DSSICONTROLEVENT_H
#include "QueuedEvent.h"
-#include "DSSIPlugin.h"
+#include "DSSINode.h"
namespace Om {
@@ -39,10 +39,10 @@ public:
void post_process();
private:
- string m_node_path;
- int m_port_num;
- float m_val;
- DSSIPlugin* m_node;
+ string m_node_path;
+ int m_port_num;
+ float m_val;
+ DSSINode* m_node;
};
diff --git a/src/libs/engine/events/DSSIProgramEvent.cpp b/src/libs/engine/events/DSSIProgramEvent.cpp
index eb68ef77..970daef6 100644
--- a/src/libs/engine/events/DSSIProgramEvent.cpp
+++ b/src/libs/engine/events/DSSIProgramEvent.cpp
@@ -45,7 +45,7 @@ DSSIProgramEvent::pre_process()
Node* node = om->object_store()->find_node(m_node_path);
if (node != NULL && node->plugin()->type() == Plugin::DSSI)
- m_node = (DSSIPlugin*)node;
+ m_node = (DSSINode*)node;
QueuedEvent::pre_process();
}
diff --git a/src/libs/engine/events/DSSIProgramEvent.h b/src/libs/engine/events/DSSIProgramEvent.h
index 152f3cb1..27f70e41 100644
--- a/src/libs/engine/events/DSSIProgramEvent.h
+++ b/src/libs/engine/events/DSSIProgramEvent.h
@@ -18,7 +18,7 @@
#define DSSIPROGRAMEVENT_H
#include "QueuedEvent.h"
-#include "DSSIPlugin.h"
+#include "DSSINode.h"
namespace Om {
@@ -37,10 +37,10 @@ public:
void post_process();
private:
- string m_node_path;
- int m_bank;
- int m_program;
- DSSIPlugin* m_node;
+ string m_node_path;
+ int m_bank;
+ int m_program;
+ DSSINode* m_node;
};
diff --git a/src/libs/engine/events/DSSIUpdateEvent.cpp b/src/libs/engine/events/DSSIUpdateEvent.cpp
index 5650dd63..fb441e67 100644
--- a/src/libs/engine/events/DSSIUpdateEvent.cpp
+++ b/src/libs/engine/events/DSSIUpdateEvent.cpp
@@ -20,7 +20,7 @@
#include "ObjectStore.h"
#include "Om.h"
#include "OmApp.h"
-#include "DSSIPlugin.h"
+#include "DSSINode.h"
#include "Plugin.h"
using std::cerr; using std::endl;
@@ -47,7 +47,7 @@ DSSIUpdateEvent::pre_process()
QueuedEvent::pre_process();
return;
} else {
- m_node = (DSSIPlugin*)node;
+ m_node = (DSSINode*)node;
}
QueuedEvent::pre_process();
diff --git a/src/libs/engine/events/DSSIUpdateEvent.h b/src/libs/engine/events/DSSIUpdateEvent.h
index cdd8851e..3cee300f 100644
--- a/src/libs/engine/events/DSSIUpdateEvent.h
+++ b/src/libs/engine/events/DSSIUpdateEvent.h
@@ -24,7 +24,7 @@ using std::string;
namespace Om {
-class DSSIPlugin;
+class DSSINode;
/** A DSSI "update" responder for a DSSI plugin/node.
@@ -43,9 +43,9 @@ public:
void post_process();
private:
- string m_path;
- string m_url;
- DSSIPlugin* m_node;
+ string m_path;
+ string m_url;
+ DSSINode* m_node;
};