summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/engine/BridgeNode.cpp159
-rw-r--r--src/libs/engine/BridgeNode.h90
-rw-r--r--src/libs/engine/Makefile.am2
-rw-r--r--src/libs/engine/Node.h4
-rw-r--r--src/libs/engine/NodeBase.h5
-rw-r--r--src/libs/engine/ObjectSender.cpp11
-rw-r--r--src/libs/engine/ObjectStore.cpp6
-rw-r--r--src/libs/engine/OmApp.cpp5
-rw-r--r--src/libs/engine/OmObject.h5
-rw-r--r--src/libs/engine/Patch.h2
-rw-r--r--src/libs/engine/Port.h6
-rw-r--r--src/libs/engine/events/CreatePatchEvent.cpp2
-rw-r--r--src/libs/engine/events/DestroyEvent.cpp13
-rw-r--r--src/libs/engine/events/RenameEvent.cpp4
-rw-r--r--src/libs/engine/events/SetPortValueEvent.cpp4
-rw-r--r--src/libs/engine/events/SetPortValueQueuedEvent.cpp4
16 files changed, 33 insertions, 289 deletions
diff --git a/src/libs/engine/BridgeNode.cpp b/src/libs/engine/BridgeNode.cpp
deleted file mode 100644
index 776bcc92..00000000
--- a/src/libs/engine/BridgeNode.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/* This file is part of Om. Copyright (C) 2006 Dave Robillard.
- *
- * Om 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.
- *
- * Om 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.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "BridgeNode.h"
-//#include "ClientBroadcaster.h"
-#include "Plugin.h"
-#include "Patch.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "Maid.h"
-#include "Driver.h"
-#include "PortInfo.h"
-#include <cassert>
-
-namespace Om {
-
-template <typename T>
-BridgeNode<T>::BridgeNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size)
-: InternalNode(path,
- (parent->parent_patch() == NULL || poly != parent->parent_patch()->poly()) ? 1 : poly,
- //poly,
- parent, srate, buffer_size),
- m_driver_port(NULL),
- m_listnode(NULL),
- m_external_port(NULL)
-{
- //cerr << "Creating bridge node " << path << " - polyphony: " << m_poly << endl;
- m_listnode = new ListNode<InternalNode*>(this);
-}
-template
-BridgeNode<sample>::BridgeNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size);
-template
-BridgeNode<MidiMessage>::BridgeNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size);
-
-
-template <typename T>
-BridgeNode<T>::~BridgeNode()
-{
- delete m_driver_port;
-}
-template BridgeNode<sample>::~BridgeNode();
-template BridgeNode<MidiMessage>::~BridgeNode();
-
-
-template <typename T>
-void
-BridgeNode<T>::activate()
-{
- assert(om->template driver<T>() != NULL);
- assert(m_external_port != NULL); // Derived classes must create this
- assert(parent_patch() != NULL);
-
- if (parent_patch()->parent() == NULL && om != NULL)
- m_driver_port = om->template driver<T>()->create_port(m_external_port);
-
- InternalNode::activate();
-}
-
-
-template <typename T>
-void
-BridgeNode<T>::deactivate()
-{
- if (m_is_added)
- remove_from_patch();
-
- InternalNode::deactivate();
-
- if (m_driver_port != NULL) {
- delete m_driver_port;
- m_driver_port = NULL;
- }
-}
-
-
-template <typename T>
-void
-BridgeNode<T>::add_to_patch()
-{
- assert(parent_patch() != NULL);
-
- parent_patch()->add_bridge_node(m_listnode);
-
- InternalNode::add_to_patch();
-
- // Activate driver port now in the audio thread (not before when created, to avoid race issues)
- if (m_driver_port != NULL)
- m_driver_port->add_to_driver();
-}
-
-
-template <typename T>
-void
-BridgeNode<T>::remove_from_patch()
-{
- assert(parent_patch() != NULL);
-
- if (m_is_added) {
- if (m_driver_port != NULL)
- m_driver_port->remove_from_driver();
- ListNode<InternalNode*>* ln = NULL;
- ln = parent_patch()->remove_bridge_node(this);
-
- om->maid()->push(ln);
- m_listnode = NULL;
-
- }
- InternalNode::remove_from_patch();
-}
-
-
-template <typename T>
-void
-BridgeNode<T>::set_path(const Path& new_path)
-{
- InternalNode::set_path(new_path);
-
- m_external_port->set_path(new_path);
-
- if (m_driver_port != NULL)
- m_driver_port->set_name(path().c_str());
-}
-
-
-#if 0
-template <typename T>
-void
-BridgeNode<T>::send_creation_messages(ClientInterface* client) const
-{
- InternalNode::send_creation_messages(client);
- om->client_broadcaster()->send_new_port_to(client, m_external_port);
-
- // Send metadata
- for (map<string, string>::const_iterator i = metadata().begin(); i != metadata().end(); ++i)
- om->client_broadcaster()->send_metadata_update_to(client, path(), (*i).first, (*i).second);
-
- // Send control value (if necessary)
- //if (m_external_port->port_info()->is_control())
- // om->client_broadcaster()->send_control_change_to(client, path(),
- // ((PortBase<sample>*)m_external_port)->buffer(0)->value_at(0));
-}
-#endif
-
-
-} // namespace Om
-
diff --git a/src/libs/engine/BridgeNode.h b/src/libs/engine/BridgeNode.h
deleted file mode 100644
index 99fad912..00000000
--- a/src/libs/engine/BridgeNode.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* This file is part of Om. Copyright (C) 2006 Dave Robillard.
- *
- * Om 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.
- *
- * Om 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.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef BRIDGENODE_H
-#define BRIDGENODE_H
-
-#include <string>
-#include "InternalNode.h"
-#include "PortBase.h"
-using std::string;
-
-template <typename T> class ListNode;
-
-namespace Om {
-
-class DriverPort;
-namespace Shared {
- class ClientInterface;
-} using Shared::ClientInterface;
-
-
-/** A Node to represent input/output Ports on a Patch.
- *
- * This node acts as both a Node and a Port (it is the only Node type that
- * returns non-null for as_port()). The node is a normal Node in a Patch,
- * the Port is a Port on that Patch (port->parent == node->parent).
- *
- * This class handles all DriverPort functionality as well (if this Node
- * is on a top level Patch).
- *
- * Both input and output nodes are handled in this class.
- *
- * This node will force itself to monophonic (regardless of the poly parameter
- * passed to constructor) if the parent of the patch it's representing a port
- * on has a different polyphony than the patch (since connecting mismatched
- * polyphonies is impossible).
- *
- * \ingroup engine
- */
-template <typename T>
-class BridgeNode : public InternalNode
-{
-public:
- virtual ~BridgeNode();
-
- Port* as_port() { return m_external_port; }
-
- void activate();
- void deactivate();
- void add_to_patch();
- void remove_from_patch();
- //void send_creation_messages(ClientInterface* client) const;
-
- void set_path(const Path& new_path);
-
-protected:
- // Disallow copies (undefined)
- BridgeNode(const BridgeNode&);
- BridgeNode& operator=(const BridgeNode&);
-
- BridgeNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size);
-
- /** Driver port, used if this is on a top level Patch */
- DriverPort* m_driver_port;
-
- ListNode<InternalNode*>* m_listnode;
-
- PortBase<T>* m_external_port;
-};
-
-
-template class BridgeNode<sample>;
-template class BridgeNode<MidiMessage>;
-
-} // namespace Om
-
-#endif // BRIDGENODE_H
diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am
index 0aae5647..e0c43e3e 100644
--- a/src/libs/engine/Makefile.am
+++ b/src/libs/engine/Makefile.am
@@ -1,7 +1,7 @@
SUBDIRS = tests
DIST_SUBDIRS = events
-AM_CXXFLAGS = @JACK_CFLAGS@ @LOSC_CFLAGS@ @ALSA_CFLAGS@ @LASH_CFLAGS@ @SLV2_CFLAGS@ -I$(top_srcdir)/src/common -I$(top_srcdir)/src/libs/engine/events -fno-exceptions -fno-rtti
+AM_CXXFLAGS = @JACK_CFLAGS@ @LOSC_CFLAGS@ @ALSA_CFLAGS@ @LASH_CFLAGS@ @SLV2_CFLAGS@ -I$(top_srcdir)/src/common -I$(top_srcdir)/src/libs/engine/events -fno-exceptions
MAINTAINERCLEANFILES = Makefile.in
diff --git a/src/libs/engine/Node.h b/src/libs/engine/Node.h
index 07dc5d89..27d59e32 100644
--- a/src/libs/engine/Node.h
+++ b/src/libs/engine/Node.h
@@ -54,8 +54,6 @@ public:
Node(OmObject* parent, const string& name) : OmObject(parent, name) {}
virtual ~Node() {}
- Node* as_node() { return static_cast<Node*>(this); }
-
/** Activate this Node.
*
* This function will be called in a non-realtime thread before it is
@@ -93,7 +91,7 @@ public:
virtual void dependants(List<Node*>* l) = 0;
/** The Patch this Node belongs to. */
- virtual Patch* parent_patch() const = 0;
+ virtual Patch* parent_patch() const = 0;
/** Information about what 'plugin' this Node is an instance of.
* Not the best name - not all nodes come from plugins (ie Patch)
diff --git a/src/libs/engine/NodeBase.h b/src/libs/engine/NodeBase.h
index d7748543..7dffc0c9 100644
--- a/src/libs/engine/NodeBase.h
+++ b/src/libs/engine/NodeBase.h
@@ -73,12 +73,13 @@ public:
virtual List<Node*>* dependants() { return _dependants; }
virtual void dependants(List<Node*>* l) { _dependants = l; }
- Patch* parent_patch() const { return (_parent == NULL) ? NULL : _parent->as_patch(); }
-
virtual const Plugin* plugin() const { return _plugin; }
void set_path(const Path& new_path);
+ /** A node's parent is always a patch, so static cast should be safe */
+ Patch* parent_patch() const { return (Patch*)_parent; }
+
protected:
// Disallow copies (undefined)
NodeBase(const NodeBase&);
diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp
index aec86e53..3bd725e0 100644
--- a/src/libs/engine/ObjectSender.cpp
+++ b/src/libs/engine/ObjectSender.cpp
@@ -33,10 +33,13 @@ namespace Om {
void
ObjectSender::send_all(ClientInterface* client)
{
- for (Tree<OmObject*>::iterator i = om->object_store()->objects().begin();
+ Patch* root = om->object_store()->find_patch("/");
+ assert(root);
+ send_patch(client, root);
+ /*for (Tree<OmObject*>::iterator i = om->object_store()->objects().begin();
i != om->object_store()->objects().end(); ++i)
if ((*i)->as_patch() != NULL && (*i)->parent() == NULL)
- send_patch(client, (*i)->as_patch());
+ send_patch(client, (*i)->as_patch());*/
//(*i)->as_node()->send_creation_messages(client);
}
@@ -88,12 +91,12 @@ ObjectSender::send_node(ClientInterface* client, const Node* node)
// perspective they don't even exist (just the ports they represent)
// FIXME: hack, these nodes probably shouldn't even exist in the
// engine anymore
- if (const_cast<Node*>(node)->as_port()) { // bridge node if as_port() returns non-NULL
+ /*if (const_cast<Node*>(node)->as_port()) { // bridge node if as_port() returns non-NULL
// FIXME: remove this whole thing. shouldn't be any bridge nodes anymore
assert(false);
send_port(client, const_cast<Node*>(node)->as_port());
return;
- }
+ }*/
const Plugin* const plugin = node->plugin();
diff --git a/src/libs/engine/ObjectStore.cpp b/src/libs/engine/ObjectStore.cpp
index a1cf1287..b35737b0 100644
--- a/src/libs/engine/ObjectStore.cpp
+++ b/src/libs/engine/ObjectStore.cpp
@@ -33,7 +33,7 @@ Patch*
ObjectStore::find_patch(const Path& path)
{
OmObject* const object = find(path);
- return (object == NULL) ? NULL : object->as_patch();
+ return dynamic_cast<Patch*>(object);
}
@@ -43,7 +43,7 @@ Node*
ObjectStore::find_node(const Path& path)
{
OmObject* const object = find(path);
- return (object == NULL) ? NULL : object->as_node();
+ return dynamic_cast<Node*>(object);
}
@@ -53,7 +53,7 @@ Port*
ObjectStore::find_port(const Path& path)
{
OmObject* const object = find(path);
- return (object == NULL) ? NULL : object->as_port();
+ return dynamic_cast<Port*>(object);
}
diff --git a/src/libs/engine/OmApp.cpp b/src/libs/engine/OmApp.cpp
index ea7df1df..e3529127 100644
--- a/src/libs/engine/OmApp.cpp
+++ b/src/libs/engine/OmApp.cpp
@@ -212,11 +212,12 @@ OmApp::deactivate()
return;
m_audio_driver->root_patch()->process(false);
+ m_audio_driver->root_patch()->deactivate();
- for (Tree<OmObject*>::iterator i = m_object_store->objects().begin();
+ /*for (Tree<OmObject*>::iterator i = m_object_store->objects().begin();
i != m_object_store->objects().end(); ++i)
if ((*i)->as_node() != NULL && (*i)->as_node()->parent() == NULL)
- (*i)->as_node()->deactivate();
+ (*i)->as_node()->deactivate();*/
if (m_midi_driver != NULL)
m_midi_driver->deactivate();
diff --git a/src/libs/engine/OmObject.h b/src/libs/engine/OmObject.h
index d2360eed..2f873ff5 100644
--- a/src/libs/engine/OmObject.h
+++ b/src/libs/engine/OmObject.h
@@ -54,11 +54,6 @@ public:
virtual ~OmObject() {}
- // Ghetto home-brew RTTI
- virtual Patch* as_patch() { return NULL; }
- virtual Node* as_node() { return NULL; }
- virtual Port* as_port() { return NULL; }
-
OmObject* parent() const { return _parent; }
inline const string& name() const { return _name; }
diff --git a/src/libs/engine/Patch.h b/src/libs/engine/Patch.h
index 201912b5..edde636e 100644
--- a/src/libs/engine/Patch.h
+++ b/src/libs/engine/Patch.h
@@ -51,8 +51,6 @@ public:
Patch(const string& name, size_t poly, Patch* parent, samplerate srate, size_t buffer_size, size_t local_poly);
virtual ~Patch();
- Patch* as_patch() { return static_cast<Patch*>(this); }
-
void activate();
void deactivate();
diff --git a/src/libs/engine/Port.h b/src/libs/engine/Port.h
index e96b8ea9..37603fcb 100644
--- a/src/libs/engine/Port.h
+++ b/src/libs/engine/Port.h
@@ -43,10 +43,11 @@ class Port : public OmObject
public:
virtual ~Port() {}
- Port* as_port() { return this; }
-
void add_to_store();
void remove_from_store();
+
+ /** A port's parent is always a node, so static cast should be safe */
+ Node* parent_node() const { return (Node*)_parent; }
/** Called once per process cycle */
virtual void prepare_buffers(size_t nframes) = 0;
@@ -57,7 +58,6 @@ public:
virtual bool is_input() const = 0;
virtual bool is_output() const = 0;
- Node* parent_node() const { return _parent->as_node(); }
bool is_sample() const { return false; }
size_t num() const { return _index; }
size_t poly() const { return _poly; }
diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp
index 9f0ae7f2..2d8cce99 100644
--- a/src/libs/engine/events/CreatePatchEvent.cpp
+++ b/src/libs/engine/events/CreatePatchEvent.cpp
@@ -74,7 +74,7 @@ CreatePatchEvent::pre_process()
m_patch = new Patch(m_path.name(), poly, m_parent, om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size(), m_poly);
if (m_parent != NULL) {
- m_parent->add_node(new ListNode<Node*>(m_patch->as_node()));
+ m_parent->add_node(new ListNode<Node*>(m_patch));
if (m_parent->process())
m_process_order = m_parent->build_process_order();
diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp
index 85ec0011..f851c9b5 100644
--- a/src/libs/engine/events/DestroyEvent.cpp
+++ b/src/libs/engine/events/DestroyEvent.cpp
@@ -71,12 +71,8 @@ DestroyEvent::~DestroyEvent()
void
DestroyEvent::pre_process()
{
- if (m_node == NULL) {
- OmObject* const obj = om->object_store()->find_node(m_path);
-
- if (obj != NULL && obj->as_node() != NULL)
- m_node = obj->as_node();
- }
+ if (m_node == NULL)
+ m_node = om->object_store()->find_node(m_path);
if (m_node != NULL && m_path != "/") {
assert(m_node->parent_patch() != NULL);
@@ -92,11 +88,12 @@ DestroyEvent::pre_process()
}
// Create a recursive disconnect event for the parent port, if a bridge node
- Port* parent_port = m_patch_listnode->elem()->as_port();
+ cerr << "FIXME: Destroy bridge\n";
+ /*Port* parent_port = m_patch_listnode->elem()->as_port();
if (parent_port != NULL) { // Bridge node
m_parent_disconnect_event = new DisconnectPortEvent(parent_port);
m_parent_disconnect_event->pre_process();
- }
+ }*/
if (m_node->parent_patch()->process()) {
m_process_order = m_node->parent_patch()->build_process_order();
diff --git a/src/libs/engine/events/RenameEvent.cpp b/src/libs/engine/events/RenameEvent.cpp
index e2e98dd0..f1b74c59 100644
--- a/src/libs/engine/events/RenameEvent.cpp
+++ b/src/libs/engine/events/RenameEvent.cpp
@@ -74,11 +74,11 @@ RenameEvent::pre_process()
}
// Renaming only works for Nodes and Patches (which are Nodes)
- if (obj->as_node() == NULL) {
+ /*if (obj->as_node() == NULL) {
m_error = OBJECT_NOT_RENAMABLE;
QueuedEvent::pre_process();
return;
- }
+ }*/
if (obj != NULL) {
obj->set_path(m_new_path);
diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp
index 6ca227e0..046e935f 100644
--- a/src/libs/engine/events/SetPortValueEvent.cpp
+++ b/src/libs/engine/events/SetPortValueEvent.cpp
@@ -80,11 +80,11 @@ SetPortValueEvent::post_process()
om->client_broadcaster()->send_control_change(m_port_path, m_val);
// Send patch port control change, if this is a bridge port
- Port* parent_port = m_port->parent_node()->as_port();
+ /*Port* parent_port = m_port->parent_node()->as_port();
if (parent_port != NULL) {
assert(parent_port->type() == DataType::FLOAT);
om->client_broadcaster()->send_control_change(parent_port->path(), m_val);
- }
+ }*/
} else if (m_error == PORT_NOT_FOUND) {
string msg = "Unable to find port ";
diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.cpp b/src/libs/engine/events/SetPortValueQueuedEvent.cpp
index b935beb9..c7750064 100644
--- a/src/libs/engine/events/SetPortValueQueuedEvent.cpp
+++ b/src/libs/engine/events/SetPortValueQueuedEvent.cpp
@@ -92,11 +92,11 @@ SetPortValueQueuedEvent::post_process()
om->client_broadcaster()->send_control_change(m_port_path, m_val);
// Send patch port control change, if this is a bridge port
- Port* parent_port = m_port->parent_node()->as_port();
+ /*Port* parent_port = m_port->parent_node()->as_port();
if (parent_port != NULL) {
assert(parent_port->type() == DataType::FLOAT);
om->client_broadcaster()->send_control_change(parent_port->path(), m_val);
- }
+ }*/
} else if (m_error == PORT_NOT_FOUND) {
string msg = "Unable to find port ";