From 6f78a755b0f8c59f85cdc02e9eeca8db860a2ed2 Mon Sep 17 00:00:00 2001
From: David Robillard
Date: Sat, 10 Jun 2006 01:02:08 +0000
Subject: Juggling things around...
git-svn-id: http://svn.drobilla.net/lad/grauph@13 a436a847-0d15-0410-975c-d299462d15a1
---
src/engine/ActivateEvent.cpp | 52 --
src/engine/ActivateEvent.h | 41 --
src/engine/AddNodeEvent.cpp | 128 -----
src/engine/AddNodeEvent.h | 63 ---
src/engine/AllNotesOffEvent.cpp | 67 ---
src/engine/AllNotesOffEvent.h | 50 --
src/engine/ClearPatchEvent.cpp | 114 ----
src/engine/ClearPatchEvent.h | 54 --
src/engine/ConnectionEvent.cpp | 240 ---------
src/engine/ConnectionEvent.h | 107 ----
src/engine/CreatePatchEvent.cpp | 150 ------
src/engine/CreatePatchEvent.h | 64 ---
src/engine/DSSIConfigureEvent.cpp | 73 ---
src/engine/DSSIConfigureEvent.h | 49 --
src/engine/DSSIControlEvent.cpp | 68 ---
src/engine/DSSIControlEvent.h | 51 --
src/engine/DSSIProgramEvent.cpp | 77 ---
src/engine/DSSIProgramEvent.h | 49 --
src/engine/DSSIUpdateEvent.cpp | 80 ---
src/engine/DSSIUpdateEvent.h | 54 --
src/engine/DeactivateEvent.cpp | 54 --
src/engine/DeactivateEvent.h | 42 --
src/engine/DestroyEvent.cpp | 168 ------
src/engine/DestroyEvent.h | 68 ---
src/engine/DisablePatchEvent.cpp | 70 ---
src/engine/DisablePatchEvent.h | 52 --
src/engine/DisconnectNodeEvent.cpp | 140 -----
src/engine/DisconnectNodeEvent.h | 68 ---
src/engine/DisconnectPortEvent.cpp | 145 -----
src/engine/DisconnectPortEvent.h | 70 ---
src/engine/DisconnectionEvent.cpp | 295 -----------
src/engine/DisconnectionEvent.h | 106 ----
src/engine/EnablePatchEvent.cpp | 82 ---
src/engine/EnablePatchEvent.h | 56 --
src/engine/Event.cpp | 48 --
src/engine/Event.h | 71 ---
src/engine/LV2Plugin.h | 12 +-
src/engine/LashRestoreDoneEvent.h | 54 --
src/engine/LoadPluginsEvent.cpp | 44 --
src/engine/LoadPluginsEvent.h | 40 --
src/engine/Makefile.am | 153 +++---
src/engine/MidiLearnEvent.cpp | 88 ---
src/engine/MidiLearnEvent.h | 84 ---
src/engine/NoteOffEvent.cpp | 78 ---
src/engine/NoteOffEvent.h | 52 --
src/engine/NoteOnEvent.cpp | 89 ----
src/engine/NoteOnEvent.h | 54 --
src/engine/OSCClient.cpp | 2 +-
src/engine/OSCClient.h | 2 +-
src/engine/PingQueuedEvent.h | 44 --
src/engine/QueuedEvent.h | 86 ---
src/engine/RegisterClientEvent.cpp | 53 --
src/engine/RegisterClientEvent.h | 53 --
src/engine/RenameEvent.cpp | 123 -----
src/engine/RenameEvent.h | 66 ---
src/engine/RequestAllObjectsEvent.cpp | 55 --
src/engine/RequestAllObjectsEvent.h | 50 --
src/engine/RequestMetadataEvent.cpp | 80 ---
src/engine/RequestMetadataEvent.h | 56 --
src/engine/RequestPluginsEvent.cpp | 55 --
src/engine/RequestPluginsEvent.h | 51 --
src/engine/RequestPortValueEvent.cpp | 81 ---
src/engine/RequestPortValueEvent.h | 56 --
src/engine/SetMetadataEvent.cpp | 79 ---
src/engine/SetMetadataEvent.h | 53 --
src/engine/SetPortValueEvent.cpp | 104 ----
src/engine/SetPortValueEvent.h | 56 --
src/engine/SetPortValueQueuedEvent.cpp | 116 ----
src/engine/SetPortValueQueuedEvent.h | 57 --
src/engine/UnregisterClientEvent.cpp | 45 --
src/engine/UnregisterClientEvent.h | 53 --
src/engine/bak/OSCSender.cpp | 736 --------------------------
src/engine/bak/OSCSender.h | 105 ----
src/engine/bak/Responder.cpp | 60 ---
src/engine/events/ActivateEvent.cpp | 52 ++
src/engine/events/ActivateEvent.h | 41 ++
src/engine/events/AddNodeEvent.cpp | 128 +++++
src/engine/events/AddNodeEvent.h | 63 +++
src/engine/events/AllNotesOffEvent.cpp | 67 +++
src/engine/events/AllNotesOffEvent.h | 50 ++
src/engine/events/ClearPatchEvent.cpp | 114 ++++
src/engine/events/ClearPatchEvent.h | 54 ++
src/engine/events/ConnectionEvent.cpp | 240 +++++++++
src/engine/events/ConnectionEvent.h | 107 ++++
src/engine/events/CreatePatchEvent.cpp | 150 ++++++
src/engine/events/CreatePatchEvent.h | 64 +++
src/engine/events/DSSIConfigureEvent.cpp | 73 +++
src/engine/events/DSSIConfigureEvent.h | 49 ++
src/engine/events/DSSIControlEvent.cpp | 68 +++
src/engine/events/DSSIControlEvent.h | 51 ++
src/engine/events/DSSIProgramEvent.cpp | 77 +++
src/engine/events/DSSIProgramEvent.h | 49 ++
src/engine/events/DSSIUpdateEvent.cpp | 80 +++
src/engine/events/DSSIUpdateEvent.h | 54 ++
src/engine/events/DeactivateEvent.cpp | 54 ++
src/engine/events/DeactivateEvent.h | 42 ++
src/engine/events/DestroyEvent.cpp | 168 ++++++
src/engine/events/DestroyEvent.h | 68 +++
src/engine/events/DisablePatchEvent.cpp | 70 +++
src/engine/events/DisablePatchEvent.h | 52 ++
src/engine/events/DisconnectNodeEvent.cpp | 140 +++++
src/engine/events/DisconnectNodeEvent.h | 68 +++
src/engine/events/DisconnectPortEvent.cpp | 145 +++++
src/engine/events/DisconnectPortEvent.h | 70 +++
src/engine/events/DisconnectionEvent.cpp | 295 +++++++++++
src/engine/events/DisconnectionEvent.h | 106 ++++
src/engine/events/EnablePatchEvent.cpp | 82 +++
src/engine/events/EnablePatchEvent.h | 56 ++
src/engine/events/Event.cpp | 48 ++
src/engine/events/Event.h | 71 +++
src/engine/events/LashRestoreDoneEvent.h | 54 ++
src/engine/events/LoadPluginsEvent.cpp | 44 ++
src/engine/events/LoadPluginsEvent.h | 40 ++
src/engine/events/Makefile.am | 65 +++
src/engine/events/MidiLearnEvent.cpp | 88 +++
src/engine/events/MidiLearnEvent.h | 84 +++
src/engine/events/NoteOffEvent.cpp | 78 +++
src/engine/events/NoteOffEvent.h | 52 ++
src/engine/events/NoteOnEvent.cpp | 89 ++++
src/engine/events/NoteOnEvent.h | 54 ++
src/engine/events/PingQueuedEvent.h | 44 ++
src/engine/events/QueuedEvent.h | 86 +++
src/engine/events/RegisterClientEvent.cpp | 53 ++
src/engine/events/RegisterClientEvent.h | 53 ++
src/engine/events/RenameEvent.cpp | 123 +++++
src/engine/events/RenameEvent.h | 66 +++
src/engine/events/RequestAllObjectsEvent.cpp | 55 ++
src/engine/events/RequestAllObjectsEvent.h | 50 ++
src/engine/events/RequestMetadataEvent.cpp | 80 +++
src/engine/events/RequestMetadataEvent.h | 56 ++
src/engine/events/RequestPluginsEvent.cpp | 55 ++
src/engine/events/RequestPluginsEvent.h | 51 ++
src/engine/events/RequestPortValueEvent.cpp | 81 +++
src/engine/events/RequestPortValueEvent.h | 56 ++
src/engine/events/SetMetadataEvent.cpp | 79 +++
src/engine/events/SetMetadataEvent.h | 53 ++
src/engine/events/SetPortValueEvent.cpp | 104 ++++
src/engine/events/SetPortValueEvent.h | 56 ++
src/engine/events/SetPortValueQueuedEvent.cpp | 116 ++++
src/engine/events/SetPortValueQueuedEvent.h | 57 ++
src/engine/events/UnregisterClientEvent.cpp | 45 ++
src/engine/events/UnregisterClientEvent.h | 53 ++
142 files changed, 5375 insertions(+), 6202 deletions(-)
delete mode 100644 src/engine/ActivateEvent.cpp
delete mode 100644 src/engine/ActivateEvent.h
delete mode 100644 src/engine/AddNodeEvent.cpp
delete mode 100644 src/engine/AddNodeEvent.h
delete mode 100644 src/engine/AllNotesOffEvent.cpp
delete mode 100644 src/engine/AllNotesOffEvent.h
delete mode 100644 src/engine/ClearPatchEvent.cpp
delete mode 100644 src/engine/ClearPatchEvent.h
delete mode 100644 src/engine/ConnectionEvent.cpp
delete mode 100644 src/engine/ConnectionEvent.h
delete mode 100644 src/engine/CreatePatchEvent.cpp
delete mode 100644 src/engine/CreatePatchEvent.h
delete mode 100644 src/engine/DSSIConfigureEvent.cpp
delete mode 100644 src/engine/DSSIConfigureEvent.h
delete mode 100644 src/engine/DSSIControlEvent.cpp
delete mode 100644 src/engine/DSSIControlEvent.h
delete mode 100644 src/engine/DSSIProgramEvent.cpp
delete mode 100644 src/engine/DSSIProgramEvent.h
delete mode 100644 src/engine/DSSIUpdateEvent.cpp
delete mode 100644 src/engine/DSSIUpdateEvent.h
delete mode 100644 src/engine/DeactivateEvent.cpp
delete mode 100644 src/engine/DeactivateEvent.h
delete mode 100644 src/engine/DestroyEvent.cpp
delete mode 100644 src/engine/DestroyEvent.h
delete mode 100644 src/engine/DisablePatchEvent.cpp
delete mode 100644 src/engine/DisablePatchEvent.h
delete mode 100644 src/engine/DisconnectNodeEvent.cpp
delete mode 100644 src/engine/DisconnectNodeEvent.h
delete mode 100644 src/engine/DisconnectPortEvent.cpp
delete mode 100644 src/engine/DisconnectPortEvent.h
delete mode 100644 src/engine/DisconnectionEvent.cpp
delete mode 100644 src/engine/DisconnectionEvent.h
delete mode 100644 src/engine/EnablePatchEvent.cpp
delete mode 100644 src/engine/EnablePatchEvent.h
delete mode 100644 src/engine/Event.cpp
delete mode 100644 src/engine/Event.h
delete mode 100644 src/engine/LashRestoreDoneEvent.h
delete mode 100644 src/engine/LoadPluginsEvent.cpp
delete mode 100644 src/engine/LoadPluginsEvent.h
delete mode 100644 src/engine/MidiLearnEvent.cpp
delete mode 100644 src/engine/MidiLearnEvent.h
delete mode 100644 src/engine/NoteOffEvent.cpp
delete mode 100644 src/engine/NoteOffEvent.h
delete mode 100644 src/engine/NoteOnEvent.cpp
delete mode 100644 src/engine/NoteOnEvent.h
delete mode 100644 src/engine/PingQueuedEvent.h
delete mode 100644 src/engine/QueuedEvent.h
delete mode 100644 src/engine/RegisterClientEvent.cpp
delete mode 100644 src/engine/RegisterClientEvent.h
delete mode 100644 src/engine/RenameEvent.cpp
delete mode 100644 src/engine/RenameEvent.h
delete mode 100644 src/engine/RequestAllObjectsEvent.cpp
delete mode 100644 src/engine/RequestAllObjectsEvent.h
delete mode 100644 src/engine/RequestMetadataEvent.cpp
delete mode 100644 src/engine/RequestMetadataEvent.h
delete mode 100644 src/engine/RequestPluginsEvent.cpp
delete mode 100644 src/engine/RequestPluginsEvent.h
delete mode 100644 src/engine/RequestPortValueEvent.cpp
delete mode 100644 src/engine/RequestPortValueEvent.h
delete mode 100644 src/engine/SetMetadataEvent.cpp
delete mode 100644 src/engine/SetMetadataEvent.h
delete mode 100644 src/engine/SetPortValueEvent.cpp
delete mode 100644 src/engine/SetPortValueEvent.h
delete mode 100644 src/engine/SetPortValueQueuedEvent.cpp
delete mode 100644 src/engine/SetPortValueQueuedEvent.h
delete mode 100644 src/engine/UnregisterClientEvent.cpp
delete mode 100644 src/engine/UnregisterClientEvent.h
delete mode 100644 src/engine/bak/OSCSender.cpp
delete mode 100644 src/engine/bak/OSCSender.h
delete mode 100644 src/engine/bak/Responder.cpp
create mode 100644 src/engine/events/ActivateEvent.cpp
create mode 100644 src/engine/events/ActivateEvent.h
create mode 100644 src/engine/events/AddNodeEvent.cpp
create mode 100644 src/engine/events/AddNodeEvent.h
create mode 100644 src/engine/events/AllNotesOffEvent.cpp
create mode 100644 src/engine/events/AllNotesOffEvent.h
create mode 100644 src/engine/events/ClearPatchEvent.cpp
create mode 100644 src/engine/events/ClearPatchEvent.h
create mode 100644 src/engine/events/ConnectionEvent.cpp
create mode 100644 src/engine/events/ConnectionEvent.h
create mode 100644 src/engine/events/CreatePatchEvent.cpp
create mode 100644 src/engine/events/CreatePatchEvent.h
create mode 100644 src/engine/events/DSSIConfigureEvent.cpp
create mode 100644 src/engine/events/DSSIConfigureEvent.h
create mode 100644 src/engine/events/DSSIControlEvent.cpp
create mode 100644 src/engine/events/DSSIControlEvent.h
create mode 100644 src/engine/events/DSSIProgramEvent.cpp
create mode 100644 src/engine/events/DSSIProgramEvent.h
create mode 100644 src/engine/events/DSSIUpdateEvent.cpp
create mode 100644 src/engine/events/DSSIUpdateEvent.h
create mode 100644 src/engine/events/DeactivateEvent.cpp
create mode 100644 src/engine/events/DeactivateEvent.h
create mode 100644 src/engine/events/DestroyEvent.cpp
create mode 100644 src/engine/events/DestroyEvent.h
create mode 100644 src/engine/events/DisablePatchEvent.cpp
create mode 100644 src/engine/events/DisablePatchEvent.h
create mode 100644 src/engine/events/DisconnectNodeEvent.cpp
create mode 100644 src/engine/events/DisconnectNodeEvent.h
create mode 100644 src/engine/events/DisconnectPortEvent.cpp
create mode 100644 src/engine/events/DisconnectPortEvent.h
create mode 100644 src/engine/events/DisconnectionEvent.cpp
create mode 100644 src/engine/events/DisconnectionEvent.h
create mode 100644 src/engine/events/EnablePatchEvent.cpp
create mode 100644 src/engine/events/EnablePatchEvent.h
create mode 100644 src/engine/events/Event.cpp
create mode 100644 src/engine/events/Event.h
create mode 100644 src/engine/events/LashRestoreDoneEvent.h
create mode 100644 src/engine/events/LoadPluginsEvent.cpp
create mode 100644 src/engine/events/LoadPluginsEvent.h
create mode 100644 src/engine/events/Makefile.am
create mode 100644 src/engine/events/MidiLearnEvent.cpp
create mode 100644 src/engine/events/MidiLearnEvent.h
create mode 100644 src/engine/events/NoteOffEvent.cpp
create mode 100644 src/engine/events/NoteOffEvent.h
create mode 100644 src/engine/events/NoteOnEvent.cpp
create mode 100644 src/engine/events/NoteOnEvent.h
create mode 100644 src/engine/events/PingQueuedEvent.h
create mode 100644 src/engine/events/QueuedEvent.h
create mode 100644 src/engine/events/RegisterClientEvent.cpp
create mode 100644 src/engine/events/RegisterClientEvent.h
create mode 100644 src/engine/events/RenameEvent.cpp
create mode 100644 src/engine/events/RenameEvent.h
create mode 100644 src/engine/events/RequestAllObjectsEvent.cpp
create mode 100644 src/engine/events/RequestAllObjectsEvent.h
create mode 100644 src/engine/events/RequestMetadataEvent.cpp
create mode 100644 src/engine/events/RequestMetadataEvent.h
create mode 100644 src/engine/events/RequestPluginsEvent.cpp
create mode 100644 src/engine/events/RequestPluginsEvent.h
create mode 100644 src/engine/events/RequestPortValueEvent.cpp
create mode 100644 src/engine/events/RequestPortValueEvent.h
create mode 100644 src/engine/events/SetMetadataEvent.cpp
create mode 100644 src/engine/events/SetMetadataEvent.h
create mode 100644 src/engine/events/SetPortValueEvent.cpp
create mode 100644 src/engine/events/SetPortValueEvent.h
create mode 100644 src/engine/events/SetPortValueQueuedEvent.cpp
create mode 100644 src/engine/events/SetPortValueQueuedEvent.h
create mode 100644 src/engine/events/UnregisterClientEvent.cpp
create mode 100644 src/engine/events/UnregisterClientEvent.h
diff --git a/src/engine/ActivateEvent.cpp b/src/engine/ActivateEvent.cpp
deleted file mode 100644
index 671b26d5..00000000
--- a/src/engine/ActivateEvent.cpp
+++ /dev/null
@@ -1,52 +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 "ActivateEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-
-namespace Om {
-
-
-ActivateEvent::ActivateEvent(CountedPtr responder)
-: QueuedEvent(responder)
-{
-}
-
-
-void
-ActivateEvent::pre_process()
-{
- QueuedEvent::pre_process();
-
- if (om != NULL)
- om->activate();
-}
-
-
-void
-ActivateEvent::post_process()
-{
- if (om != NULL)
- m_responder->respond_ok();
- else
- m_responder->respond_error("Not ready to activate yet.");
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/ActivateEvent.h b/src/engine/ActivateEvent.h
deleted file mode 100644
index 280b5523..00000000
--- a/src/engine/ActivateEvent.h
+++ /dev/null
@@ -1,41 +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 ACTIVATEEVENT_H
-#define ACTIVATEEVENT_H
-
-#include "QueuedEvent.h"
-
-namespace Om {
-
-
-/** Activates the engine.
- *
- * \ingroup engine
- */
-class ActivateEvent : public QueuedEvent
-{
-public:
- ActivateEvent(CountedPtr responder);
-
- void pre_process();
- void post_process();
-};
-
-
-} // namespace Om
-
-#endif // ACTIVATEEVENT_H
diff --git a/src/engine/AddNodeEvent.cpp b/src/engine/AddNodeEvent.cpp
deleted file mode 100644
index 2b31ef4a..00000000
--- a/src/engine/AddNodeEvent.cpp
+++ /dev/null
@@ -1,128 +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 "AddNodeEvent.h"
-#include "Responder.h"
-#include "Patch.h"
-#include "Node.h"
-#include "Tree.h"
-#include "Plugin.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "Patch.h"
-#include "NodeFactory.h"
-#include "ClientBroadcaster.h"
-#include "Maid.h"
-#include "util/Path.h"
-#include "ObjectStore.h"
-#include "util/Path.h"
-#include "Port.h"
-
-namespace Om {
-
-
-AddNodeEvent::AddNodeEvent(CountedPtr responder, const string& path, Plugin* plugin, bool poly)
-: QueuedEvent(responder),
- m_path(path),
- m_plugin(plugin),
- m_poly(poly),
- m_patch(NULL),
- m_node(NULL),
- m_process_order(NULL),
- m_node_already_exists(false)
-{
-}
-
-
-AddNodeEvent::~AddNodeEvent()
-{
- delete m_plugin;
-}
-
-
-void
-AddNodeEvent::pre_process()
-{
- if (om->object_store()->find(m_path) != NULL) {
- m_node_already_exists = true;
- QueuedEvent::pre_process();
- return;
- }
-
- m_patch = om->object_store()->find_patch(m_path.parent());
-
- if (m_patch != NULL) {
- if (m_poly)
- m_node = om->node_factory()->load_plugin(m_plugin, m_path.name(), m_patch->internal_poly(), m_patch);
- else
- m_node = om->node_factory()->load_plugin(m_plugin, m_path.name(), 1, m_patch);
-
- if (m_node != NULL) {
- m_node->activate();
-
- // This can be done here because the audio thread doesn't touch the
- // node tree - just the process order array
- m_patch->add_node(new ListNode(m_node));
- m_node->add_to_store();
-
- if (m_patch->process())
- m_process_order = m_patch->build_process_order();
- }
- }
- QueuedEvent::pre_process();
-}
-
-
-void
-AddNodeEvent::execute(samplecount offset)
-{
- QueuedEvent::execute(offset);
-
- if (m_node != NULL) {
- m_node->add_to_patch();
-
- if (m_patch->process_order() != NULL)
- om->maid()->push(m_patch->process_order());
- m_patch->process_order(m_process_order);
- }
-}
-
-
-void
-AddNodeEvent::post_process()
-{
- string msg;
- if (m_node_already_exists) {
- msg = string("Could not create node - ").append(m_path);// + " already exists.";
- m_responder->respond_error(msg);
- } else if (m_patch == NULL) {
- msg = "Could not find patch '" + m_path.parent() +"' for add_node.";
- m_responder->respond_error(msg);
- } else if (m_node == NULL) {
- msg = "Unable to load node ";
- msg.append(m_path).append(" (you're missing the plugin \"").append(
- m_plugin->lib_name()).append(":").append(m_plugin->plug_label()).append("\")");;
- m_responder->respond_error(msg);
- } else {
- m_responder->respond_ok();
- //om->client_broadcaster()->send_node_creation_messages(m_node);
- om->client_broadcaster()->send_node(m_node);
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/AddNodeEvent.h b/src/engine/AddNodeEvent.h
deleted file mode 100644
index fe0236ba..00000000
--- a/src/engine/AddNodeEvent.h
+++ /dev/null
@@ -1,63 +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 ADDNODEEVENT_H
-#define ADDNODEEVENT_H
-
-#include "QueuedEvent.h"
-#include "util/Path.h"
-#include
-using std::string;
-
-template class Array;
-template class TreeNode;
-
-namespace Om {
-
-class Patch;
-class Node;
-class Plugin;
-
-
-/** An event to load a Node and insert it into a Patch.
- *
- * \ingroup engine
- */
-class AddNodeEvent : public QueuedEvent
-{
-public:
- AddNodeEvent(CountedPtr responder, const string& path, Plugin* plugin, bool poly);
- ~AddNodeEvent();
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- string m_patch_name;
- Path m_path;
- Plugin* m_plugin;
- bool m_poly;
- Patch* m_patch;
- Node* m_node;
- Array* m_process_order; // Patch's new process order
- bool m_node_already_exists;
-};
-
-
-} // namespace Om
-
-#endif // ADDNODEEVENT_H
diff --git a/src/engine/AllNotesOffEvent.cpp b/src/engine/AllNotesOffEvent.cpp
deleted file mode 100644
index aa3a00f1..00000000
--- a/src/engine/AllNotesOffEvent.cpp
+++ /dev/null
@@ -1,67 +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 "AllNotesOffEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "ObjectStore.h"
-
-namespace Om {
-
-
-/** Note off with patch explicitly passed - triggered by MIDI.
- */
-AllNotesOffEvent::AllNotesOffEvent(CountedPtr responder, Patch* patch)
-: Event(responder),
- m_patch(patch)
-{
-}
-
-
-/** Note off event with lookup - triggered by OSC.
- */
-AllNotesOffEvent::AllNotesOffEvent(CountedPtr responder, const string& patch_path)
-: Event(responder),
- m_patch(NULL),
- m_patch_path(patch_path)
-{
-}
-
-
-void
-AllNotesOffEvent::execute(samplecount offset)
-{
- if (m_patch == NULL && m_patch_path != "")
- m_patch = om->object_store()->find_patch(m_patch_path);
-
- //if (m_patch != NULL)
- // for (List::iterator j = m_patch->midi_in_nodes().begin(); j != m_patch->midi_in_nodes().end(); ++j)
- // (*j)->all_notes_off(offset);
-}
-
-
-void
-AllNotesOffEvent::post_process()
-{
- if (m_patch != NULL)
- m_responder->respond_ok();
-}
-
-
-} // namespace Om
-
-
diff --git a/src/engine/AllNotesOffEvent.h b/src/engine/AllNotesOffEvent.h
deleted file mode 100644
index ea23301b..00000000
--- a/src/engine/AllNotesOffEvent.h
+++ /dev/null
@@ -1,50 +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 ALLNOTESOFFEVENT_H
-#define ALLNOTESOFFEVENT_H
-
-#include "Event.h"
-#include
-using std::string;
-
-namespace Om {
-
-class Patch;
-
-
-/** A note off event for all active voices.
- *
- * \ingroup engine
- */
-class AllNotesOffEvent : public Event
-{
-public:
- AllNotesOffEvent(CountedPtr responder, Patch* patch);
- AllNotesOffEvent(CountedPtr responder, const string& patch_path);
-
- void execute(samplecount offset);
- void post_process();
-
-private:
- Patch* m_patch;
- string m_patch_path;
-};
-
-
-} // namespace Om
-
-#endif // ALLNOTESOFFEVENT_H
diff --git a/src/engine/ClearPatchEvent.cpp b/src/engine/ClearPatchEvent.cpp
deleted file mode 100644
index 8b8fc223..00000000
--- a/src/engine/ClearPatchEvent.cpp
+++ /dev/null
@@ -1,114 +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 "ClearPatchEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "Patch.h"
-#include "ClientBroadcaster.h"
-#include "util.h"
-#include "ObjectStore.h"
-#include "Port.h"
-#include "Maid.h"
-#include "Node.h"
-#include "Connection.h"
-#include "QueuedEventSource.h"
-
-namespace Om {
-
-
-ClearPatchEvent::ClearPatchEvent(CountedPtr responder, const string& patch_path)
-: QueuedEvent(responder, true),
- m_patch_path(patch_path),
- m_patch(NULL),
- m_process(false)
-{
-}
-
-
-void
-ClearPatchEvent::pre_process()
-{
- m_patch = om->object_store()->find_patch(m_patch_path);
-
- if (m_patch != NULL) {
-
- m_process = m_patch->process();
-
- for (List::const_iterator i = m_patch->nodes().begin(); i != m_patch->nodes().end(); ++i)
- (*i)->remove_from_store();
- }
-
- QueuedEvent::pre_process();
-}
-
-
-void
-ClearPatchEvent::execute(samplecount offset)
-{
- if (m_patch != NULL) {
- m_patch->process(false);
-
- for (List::const_iterator i = m_patch->nodes().begin(); i != m_patch->nodes().end(); ++i)
- (*i)->remove_from_patch();
-
- if (m_patch->process_order() != NULL) {
- om->maid()->push(m_patch->process_order());
- m_patch->process_order(NULL);
- }
- }
-
- QueuedEvent::execute(offset);
-}
-
-
-void
-ClearPatchEvent::post_process()
-{
- if (m_patch != NULL) {
- // Delete all nodes
- for (List::iterator i = m_patch->nodes().begin(); i != m_patch->nodes().end(); ++i) {
- (*i)->deactivate();
- delete *i;
- }
- m_patch->nodes().clear();
-
- // Delete all connections
- for (List::iterator i = m_patch->connections().begin(); i != m_patch->connections().end(); ++i)
- delete *i;
- m_patch->connections().clear();
-
- // Restore patch's run state
- m_patch->process(m_process);
-
- // Make sure everything's sane
- assert(m_patch->nodes().size() == 0);
- assert(m_patch->connections().size() == 0);
-
- // Reply
- m_responder->respond_ok();
- om->client_broadcaster()->send_patch_cleared(m_patch_path);
- } else {
- m_responder->respond_error(string("Patch ") + m_patch_path + " not found");
- }
-
- m_source->unblock();
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/ClearPatchEvent.h b/src/engine/ClearPatchEvent.h
deleted file mode 100644
index c6e531a8..00000000
--- a/src/engine/ClearPatchEvent.h
+++ /dev/null
@@ -1,54 +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 CLEARPATCHEVENT_H
-#define CLEARPATCHEVENT_H
-
-#include
-#include "QueuedEvent.h"
-#include "Array.h"
-
-using std::string;
-
-namespace Om {
-
-class Patch;
-
-
-/** Delete all nodes from a patch.
- *
- * \ingroup engine
- */
-class ClearPatchEvent : public QueuedEvent
-{
-public:
- ClearPatchEvent(CountedPtr responder, const string& patch_path);
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- string m_patch_path;
- Patch* m_patch;
- bool m_process;
-};
-
-
-} // namespace Om
-
-
-#endif // CLEARPATCHEVENT_H
diff --git a/src/engine/ConnectionEvent.cpp b/src/engine/ConnectionEvent.cpp
deleted file mode 100644
index fe3b991e..00000000
--- a/src/engine/ConnectionEvent.cpp
+++ /dev/null
@@ -1,240 +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 "ConnectionEvent.h"
-#include
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "ConnectionBase.h"
-#include "InputPort.h"
-#include "OutputPort.h"
-#include "Patch.h"
-#include "ClientBroadcaster.h"
-#include "Port.h"
-#include "PortInfo.h"
-#include "Maid.h"
-#include "ObjectStore.h"
-#include "util/Path.h"
-
-using std::string;
-namespace Om {
-
-
-//// ConnectionEvent ////
-
-
-ConnectionEvent::ConnectionEvent(CountedPtr responder, const string& src_port_path, const string& dst_port_path)
-: QueuedEvent(responder),
- m_src_port_path(src_port_path),
- m_dst_port_path(dst_port_path),
- m_patch(NULL),
- m_src_port(NULL),
- m_dst_port(NULL),
- m_typed_event(NULL),
- m_error(NO_ERROR)
-{
-}
-
-
-ConnectionEvent::~ConnectionEvent()
-{
- delete m_typed_event;
-}
-
-
-void
-ConnectionEvent::pre_process()
-{
- if (m_src_port_path.parent().parent() != m_dst_port_path.parent().parent()) {
- m_error = PARENT_PATCH_DIFFERENT;
- QueuedEvent::pre_process();
- return;
- }
-
- /*m_patch = om->object_store()->find_patch(m_src_port_path.parent().parent());
-
- if (m_patch == NULL) {
- m_error = PORT_NOT_FOUND;
- QueuedEvent::pre_process();
- return;
- }*/
-
- Port* port1 = om->object_store()->find_port(m_src_port_path);
- Port* port2 = om->object_store()->find_port(m_dst_port_path);
-
- if (port1 == NULL || port2 == NULL) {
- m_error = PORT_NOT_FOUND;
- QueuedEvent::pre_process();
- return;
- }
-
- if (port1->port_info()->type() != port2->port_info()->type()) {
- m_error = TYPE_MISMATCH;
- QueuedEvent::pre_process();
- return;
- }
-
- if (port1->port_info()->is_output() && port2->port_info()->is_input()) {
- m_src_port = port1;
- m_dst_port = port2;
- } else if (port2->port_info()->is_output() && port1->port_info()->is_input()) {
- m_src_port = port2;
- m_dst_port = port1;
- } else {
- m_error = TYPE_MISMATCH;
- QueuedEvent::pre_process();
- return;
- }
-
- // Create the typed event to actually do the work
- const PortType type = port1->port_info()->type();
- if (type == AUDIO || type == CONTROL) {
- m_typed_event = new TypedConnectionEvent(m_responder,
- (OutputPort*)m_src_port, (InputPort*)m_dst_port);
- } else if (type == MIDI) {
- m_typed_event = new TypedConnectionEvent(m_responder,
- (OutputPort*)m_src_port, (InputPort*)m_dst_port);
- } else {
- m_error = TYPE_MISMATCH;
- QueuedEvent::pre_process();
- return;
- }
-
- m_typed_event->pre_process();
-
- QueuedEvent::pre_process();
-}
-
-
-void
-ConnectionEvent::execute(samplecount offset)
-{
- QueuedEvent::execute(offset);
-
- if (m_error == NO_ERROR)
- m_typed_event->execute(offset);
-}
-
-
-void
-ConnectionEvent::post_process()
-{
- if (m_error == NO_ERROR) {
- m_typed_event->post_process();
- } else {
- // FIXME: better error messages
- string msg = "Unable to make connection ";
- msg.append(m_src_port_path + " -> " + m_dst_port_path);
- m_responder->respond_error(msg);
- }
-}
-
-
-
-//// TypedConnectionEvent ////
-
-
-template
-TypedConnectionEvent::TypedConnectionEvent(CountedPtr responder, OutputPort* src_port, InputPort* dst_port)
-: QueuedEvent(responder),
- m_src_port(src_port),
- m_dst_port(dst_port),
- m_patch(NULL),
- m_process_order(NULL),
- m_connection(NULL),
- m_port_listnode(NULL),
- m_succeeded(true)
-{
- assert(src_port != NULL);
- assert(dst_port != NULL);
-}
-
-template
-TypedConnectionEvent::~TypedConnectionEvent()
-{
- // FIXME: haaaack, prevent a double delete
- // this class is unusable by anything other than ConnectionEvent because of this
- //m_responder = NULL;
-}
-
-
-template
-void
-TypedConnectionEvent::pre_process()
-{
- Node* const src_node = m_src_port->parent_node();
- Node* const dst_node = m_dst_port->parent_node();
-
- m_patch = src_node->parent_patch();
-
- if (src_node == NULL || dst_node == NULL) {
- m_succeeded = false;
- QueuedEvent::pre_process();
- return;
- }
-
- if (src_node->parent() != m_patch || dst_node->parent() != m_patch) {
- m_succeeded = false;
- QueuedEvent::pre_process();
- return;
- }
-
- m_connection = new ConnectionBase(m_src_port, m_dst_port);
- m_port_listnode = new ListNode*>(m_connection);
- m_patch_listnode = new ListNode(m_connection);
-
- dst_node->providers()->push_back(new ListNode(src_node));
- src_node->dependants()->push_back(new ListNode(dst_node));
-
- if (m_patch->process())
- m_process_order = m_patch->build_process_order();
-}
-
-
-template
-void
-TypedConnectionEvent::execute(samplecount offset)
-{
- if (m_succeeded) {
- // These must be inserted here, since they're actually used by the audio thread
- m_dst_port->add_connection(m_port_listnode);
- m_patch->add_connection(m_patch_listnode);
- if (m_patch->process_order() != NULL)
- om->maid()->push(m_patch->process_order());
- m_patch->process_order(m_process_order);
- }
-}
-
-
-template
-void
-TypedConnectionEvent::post_process()
-{
- if (m_succeeded) {
- assert(m_connection != NULL);
-
- m_responder->respond_ok();
-
- om->client_broadcaster()->send_connection(m_connection);
- } else {
- m_responder->respond_error("Unable to make connection.");
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/ConnectionEvent.h b/src/engine/ConnectionEvent.h
deleted file mode 100644
index 8aaf2292..00000000
--- a/src/engine/ConnectionEvent.h
+++ /dev/null
@@ -1,107 +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 CONNECTIONEVENT_H
-#define CONNECTIONEVENT_H
-
-#include
-#include "QueuedEvent.h"
-#include "util/Path.h"
-#include "util/types.h"
-using std::string;
-
-template class ListNode;
-template class Array;
-
-namespace Om {
-
-class Patch;
-class Node;
-class Connection;
-class MidiMessage;
-class Port;
-template class ConnectionBase;
-template class InputPort;
-template class OutputPort;
-template class TypedConnectionEvent; // helper, defined below
-
-
-/** Make a Connection between two Ports.
- *
- * \ingroup engine
- */
-class ConnectionEvent : public QueuedEvent
-{
-public:
- ConnectionEvent(CountedPtr responder, const string& src_port_path, const string& dst_port_path);
- ~ConnectionEvent();
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
-
- enum ErrorType { NO_ERROR, PARENT_PATCH_DIFFERENT, PORT_NOT_FOUND, TYPE_MISMATCH };
-
- Path m_src_port_path;
- Path m_dst_port_path;
-
- Patch* m_patch;
- Port* m_src_port;
- Port* m_dst_port;
-
- QueuedEvent* m_typed_event;
-
- ErrorType m_error;
-};
-
-
-/** Templated ConnectionEvent.
- *
- * Intended to be called from ConnectionEvent so callers (ie OSCReceiver)
- * can use ConnectionEvent without knowing anything about types (which
- * they can't, since all they have is Port paths).
- */
-template
-class TypedConnectionEvent : public QueuedEvent
-{
-public:
- TypedConnectionEvent(CountedPtr responder, OutputPort* src_port, InputPort* dst_port);
- ~TypedConnectionEvent();
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- OutputPort* m_src_port;
- InputPort* m_dst_port;
-
- Patch* m_patch;
- Array* m_process_order; ///< New process order for Patch
- ConnectionBase* m_connection;
- ListNode* m_patch_listnode;
- ListNode*>* m_port_listnode;
-
- bool m_succeeded;
-};
-
-
-
-} // namespace Om
-
-#endif // CONNECTIONEVENT_H
diff --git a/src/engine/CreatePatchEvent.cpp b/src/engine/CreatePatchEvent.cpp
deleted file mode 100644
index 9f0ae7f2..00000000
--- a/src/engine/CreatePatchEvent.cpp
+++ /dev/null
@@ -1,150 +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 "CreatePatchEvent.h"
-#include "Responder.h"
-#include "Patch.h"
-#include "Node.h"
-#include "Tree.h"
-#include "Plugin.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "Maid.h"
-#include "ClientBroadcaster.h"
-#include "AudioDriver.h"
-#include "util/Path.h"
-#include "ObjectStore.h"
-
-namespace Om {
-
-
-CreatePatchEvent::CreatePatchEvent(CountedPtr responder, const string& path, int poly)
-: QueuedEvent(responder),
- m_path(path),
- m_patch(NULL),
- m_parent(NULL),
- m_process_order(NULL),
- m_poly(poly),
- m_error(NO_ERROR)
-{
-}
-
-
-void
-CreatePatchEvent::pre_process()
-{
- if (om->object_store()->find(m_path) != NULL) {
- m_error = OBJECT_EXISTS;
- QueuedEvent::pre_process();
- return;
- }
-
- if (m_poly < 1) {
- m_error = INVALID_POLY;
- QueuedEvent::pre_process();
- return;
- }
-
- if (m_path != "/") {
- m_parent = om->object_store()->find_patch(m_path.parent());
- if (m_parent == NULL) {
- m_error = PARENT_NOT_FOUND;
- QueuedEvent::pre_process();
- return;
- }
- }
-
- size_t poly = 1;
- if (m_parent != NULL && m_poly > 1 && m_poly == static_cast(m_parent->internal_poly()))
- poly = m_poly;
-
- 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(m_patch->as_node()));
-
- if (m_parent->process())
- m_process_order = m_parent->build_process_order();
- }
-
- m_patch->activate();
-
- // Insert into ObjectStore
- m_patch->add_to_store();
-
- QueuedEvent::pre_process();
-}
-
-
-void
-CreatePatchEvent::execute(samplecount offset)
-{
- QueuedEvent::execute(offset);
-
- if (m_patch != NULL) {
- if (m_parent == NULL) {
- assert(m_path == "/");
- assert(m_patch->parent_patch() == NULL);
- om->audio_driver()->set_root_patch(m_patch);
- } else {
- assert(m_parent != NULL);
- assert(m_path != "/");
-
- m_patch->add_to_patch();
-
- if (m_parent->process_order() != NULL)
- om->maid()->push(m_parent->process_order());
- m_parent->process_order(m_process_order);
- }
- }
-}
-
-
-void
-CreatePatchEvent::post_process()
-{
- if (m_responder.get()) {
- if (m_error == NO_ERROR) {
-
- m_responder->respond_ok();
-
- // Don't want to send nodes that have been added since prepare()
- //om->client_broadcaster()->send_node_creation_messages(m_patch);
-
- // Patches are always empty on creation, so this is fine
- om->client_broadcaster()->send_patch(m_patch);
-
- } else if (m_error == OBJECT_EXISTS) {
- string msg = "Unable to create patch: ";
- msg += m_path += " already exists.";
- m_responder->respond_error(msg);
- } else if (m_error == PARENT_NOT_FOUND) {
- string msg = "Unable to create patch: Parent ";
- msg += m_path.parent() += " not found.";
- m_responder->respond_error(msg);
- } else if (m_error == INVALID_POLY) {
- string msg = "Unable to create patch ";
- msg.append(m_path).append(": ").append("Invalid polyphony respondered.");
- m_responder->respond_error(msg);
- } else {
- m_responder->respond_error("Unable to load patch.");
- }
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/CreatePatchEvent.h b/src/engine/CreatePatchEvent.h
deleted file mode 100644
index 507d03c7..00000000
--- a/src/engine/CreatePatchEvent.h
+++ /dev/null
@@ -1,64 +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 CREATEPATCHEVENT_H
-#define CREATEPATCHEVENT_H
-
-#include "util/Path.h"
-#include "QueuedEvent.h"
-#include
-using std::string;
-
-template class Array;
-template class TreeNode;
-
-namespace Om {
-
-class Patch;
-class Node;
-class Plugin;
-
-
-/** Creates a new Patch.
- *
- * \ingroup engine
- */
-class CreatePatchEvent : public QueuedEvent
-{
-public:
- CreatePatchEvent(CountedPtr responder, const string& path, int poly);
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- enum ErrorType { NO_ERROR, OBJECT_EXISTS, PARENT_NOT_FOUND, INVALID_POLY };
-
- Path m_path;
- Patch* m_patch;
- Patch* m_parent;
- Array* m_process_order;
- TreeNode* m_patch_treenode;
- int m_poly;
- ErrorType m_error;
-};
-
-
-} // namespace Om
-
-
-#endif // CREATEPATCHEVENT_H
diff --git a/src/engine/DSSIConfigureEvent.cpp b/src/engine/DSSIConfigureEvent.cpp
deleted file mode 100644
index 2ade4671..00000000
--- a/src/engine/DSSIConfigureEvent.cpp
+++ /dev/null
@@ -1,73 +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 "DSSIConfigureEvent.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "Node.h"
-#include "ClientBroadcaster.h"
-#include "Plugin.h"
-#include "ObjectStore.h"
-
-namespace Om {
-
-
-DSSIConfigureEvent::DSSIConfigureEvent(CountedPtr responder, const string& node_path, const string& key, const string& val)
-: QueuedEvent(responder),
- m_node_path(node_path),
- m_key(key),
- m_val(val),
- m_node(NULL)
-{
-}
-
-
-void
-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->configure(m_key, m_val);
- }
-
- QueuedEvent::pre_process();
-}
-
-
-void
-DSSIConfigureEvent::execute(samplecount offset)
-{
- // Nothing.
-}
-
-
-void
-DSSIConfigureEvent::post_process()
-{
- if (m_node == NULL) {
- cerr << "Unable to find DSSI node " << m_node_path << endl;
- } else {
- string key = "dssi-configure--";
- key += m_key;
- om->client_broadcaster()->send_metadata_update(m_node_path, key, m_val);
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/DSSIConfigureEvent.h b/src/engine/DSSIConfigureEvent.h
deleted file mode 100644
index 00b4a134..00000000
--- a/src/engine/DSSIConfigureEvent.h
+++ /dev/null
@@ -1,49 +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 DSSICONFIGUREEVENT_H
-#define DSSICONFIGUREEVENT_H
-
-#include "QueuedEvent.h"
-#include "DSSIPlugin.h"
-
-namespace Om {
-
-
-/** Change of a 'configure' key/value pair for a DSSI plugin.
- *
- * \ingroup engine
- */
-class DSSIConfigureEvent : public QueuedEvent
-{
-public:
- DSSIConfigureEvent(CountedPtr responder, const string& node_path, const string& key, const string& val);
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- string m_node_path;
- string m_key;
- string m_val;
- DSSIPlugin* m_node;
-};
-
-
-} // namespace Om
-
-#endif // DSSICONFIGUREEVENT_H
diff --git a/src/engine/DSSIControlEvent.cpp b/src/engine/DSSIControlEvent.cpp
deleted file mode 100644
index ea3e70ac..00000000
--- a/src/engine/DSSIControlEvent.cpp
+++ /dev/null
@@ -1,68 +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 "DSSIControlEvent.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "Node.h"
-#include "Plugin.h"
-#include "ObjectStore.h"
-
-namespace Om {
-
-
-DSSIControlEvent::DSSIControlEvent(CountedPtr responder, const string& node_path, int port_num, sample val)
-: QueuedEvent(responder),
- m_node_path(node_path),
- m_port_num(port_num),
- m_val(val),
- m_node(NULL)
-{
-}
-
-
-void
-DSSIControlEvent::pre_process()
-{
- Node* node = om->object_store()->find_node(m_node_path);
-
- if (node->plugin()->type() != Plugin::DSSI)
- m_node = NULL;
- else
- m_node = (DSSIPlugin*)node;
-
- QueuedEvent::pre_process();
-}
-
-
-void
-DSSIControlEvent::execute(samplecount offset)
-{
- if (m_node != NULL)
- m_node->set_control(m_port_num, m_val);
-}
-
-
-void
-DSSIControlEvent::post_process()
-{
- if (m_node == NULL)
- std::cerr << "Unable to find DSSI node " << m_node_path << std::endl;
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/DSSIControlEvent.h b/src/engine/DSSIControlEvent.h
deleted file mode 100644
index 30a5279e..00000000
--- a/src/engine/DSSIControlEvent.h
+++ /dev/null
@@ -1,51 +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 DSSICONTROLEVENT_H
-#define DSSICONTROLEVENT_H
-
-#include "QueuedEvent.h"
-#include "DSSIPlugin.h"
-
-namespace Om {
-
-
-/** A control change event for a DSSI plugin.
- *
- * This does essentially the same thing as a SetPortValueEvent.
- *
- * \ingroup engine
- */
-class DSSIControlEvent : public QueuedEvent
-{
-public:
- DSSIControlEvent(CountedPtr responder, const string& node_path, int port_num, sample val);
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- string m_node_path;
- int m_port_num;
- float m_val;
- DSSIPlugin* m_node;
-};
-
-
-} // namespace Om
-
-#endif // DSSICONTROLEVENT_H
diff --git a/src/engine/DSSIProgramEvent.cpp b/src/engine/DSSIProgramEvent.cpp
deleted file mode 100644
index eb68ef77..00000000
--- a/src/engine/DSSIProgramEvent.cpp
+++ /dev/null
@@ -1,77 +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 "DSSIProgramEvent.h"
-#include
-#include
-#include "Om.h"
-#include "OmApp.h"
-#include "Node.h"
-#include "ClientBroadcaster.h"
-#include "Plugin.h"
-#include "ObjectStore.h"
-using std::cout; using std::cerr; using std::endl;
-
-
-namespace Om {
-
-
-DSSIProgramEvent::DSSIProgramEvent(CountedPtr responder, const string& node_path, int bank, int program)
-: QueuedEvent(responder),
- m_node_path(node_path),
- m_bank(bank),
- m_program(program),
- m_node(NULL)
-{
-}
-
-
-void
-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;
-
- QueuedEvent::pre_process();
-}
-
-
-void
-DSSIProgramEvent::execute(samplecount offset)
-{
- if (m_node != NULL)
- m_node->program(m_bank, m_program);
-}
-
-
-void
-DSSIProgramEvent::post_process()
-{
- if (m_node == NULL) {
- cerr << "Unable to find DSSI node " << m_node_path << endl;
- } else {
- // sends program as metadata in the form bank/program
- char* temp_buf = new char[16];
- snprintf(temp_buf, 16, "%d/%d", m_bank, m_program);
- om->client_broadcaster()->send_metadata_update(m_node_path, "dssi-program", temp_buf);
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/DSSIProgramEvent.h b/src/engine/DSSIProgramEvent.h
deleted file mode 100644
index 152f3cb1..00000000
--- a/src/engine/DSSIProgramEvent.h
+++ /dev/null
@@ -1,49 +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 DSSIPROGRAMEVENT_H
-#define DSSIPROGRAMEVENT_H
-
-#include "QueuedEvent.h"
-#include "DSSIPlugin.h"
-
-namespace Om {
-
-
-/** A program change for a DSSI plugin.
- *
- * \ingroup engine
- */
-class DSSIProgramEvent : public QueuedEvent
-{
-public:
- DSSIProgramEvent(CountedPtr responder, const string& node_path, int bank, int program);
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- string m_node_path;
- int m_bank;
- int m_program;
- DSSIPlugin* m_node;
-};
-
-
-} // namespace Om
-
-#endif // DSSIPROGRAMEVENT_H
diff --git a/src/engine/DSSIUpdateEvent.cpp b/src/engine/DSSIUpdateEvent.cpp
deleted file mode 100644
index 5650dd63..00000000
--- a/src/engine/DSSIUpdateEvent.cpp
+++ /dev/null
@@ -1,80 +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 "DSSIUpdateEvent.h"
-#include
-#include "Node.h"
-#include "ObjectStore.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "DSSIPlugin.h"
-#include "Plugin.h"
-
-using std::cerr; using std::endl;
-
-namespace Om {
-
-
-DSSIUpdateEvent::DSSIUpdateEvent(CountedPtr responder, const string& path, const string& url)
-: QueuedEvent(responder),
- m_path(path),
- m_url(url),
- m_node(NULL)
-{
-}
-
-
-void
-DSSIUpdateEvent::pre_process()
-{
- Node* node = om->object_store()->find_node(m_path);
-
- if (node == NULL || node->plugin()->type() != Plugin::DSSI) {
- m_node = NULL;
- QueuedEvent::pre_process();
- return;
- } else {
- m_node = (DSSIPlugin*)node;
- }
-
- QueuedEvent::pre_process();
-}
-
-
-void
-DSSIUpdateEvent::execute(samplecount offset)
-{
- if (m_node != NULL) {
- m_node->set_ui_url(m_url);
- }
-
- QueuedEvent::execute(offset);
-}
-
-
-void
-DSSIUpdateEvent::post_process()
-{
- cerr << "DSSI update event: " << m_url << endl;
-
- if (m_node != NULL) {
- m_node->send_update();
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/DSSIUpdateEvent.h b/src/engine/DSSIUpdateEvent.h
deleted file mode 100644
index cdd8851e..00000000
--- a/src/engine/DSSIUpdateEvent.h
+++ /dev/null
@@ -1,54 +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 DSSIUPDATEEVENT_H
-#define DSSIUPDATEEVENT_H
-
-#include "QueuedEvent.h"
-#include
-
-using std::string;
-
-namespace Om {
-
-class DSSIPlugin;
-
-
-/** A DSSI "update" responder for a DSSI plugin/node.
- *
- * This sends all information about the plugin to the UI (over OSC).
- *
- * \ingroup engine
- */
-class DSSIUpdateEvent : public QueuedEvent
-{
-public:
- DSSIUpdateEvent(CountedPtr responder, const string& path, const string& url);
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- string m_path;
- string m_url;
- DSSIPlugin* m_node;
-};
-
-
-} // namespace Om
-
-#endif // DSSIUPDATEEVENT_H
diff --git a/src/engine/DeactivateEvent.cpp b/src/engine/DeactivateEvent.cpp
deleted file mode 100644
index 48bff55a..00000000
--- a/src/engine/DeactivateEvent.cpp
+++ /dev/null
@@ -1,54 +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 "DeactivateEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-
-namespace Om {
-
-
-DeactivateEvent::DeactivateEvent(CountedPtr responder)
-: QueuedEvent(responder)
-{
-}
-
-
-void
-DeactivateEvent::pre_process()
-{
- QueuedEvent::pre_process();
-}
-
-
-void
-DeactivateEvent::execute(samplecount offset)
-{
- QueuedEvent::execute(offset);
-}
-
-
-void
-DeactivateEvent::post_process()
-{
- m_responder->respond_ok();
- om->deactivate();
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/DeactivateEvent.h b/src/engine/DeactivateEvent.h
deleted file mode 100644
index 8401f332..00000000
--- a/src/engine/DeactivateEvent.h
+++ /dev/null
@@ -1,42 +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 DEACTIVATEEVENT_H
-#define DEACTIVATEEVENT_H
-
-#include "QueuedEvent.h"
-
-namespace Om {
-
-
-/** Deactivates the engine.
- *
- * \ingroup engine
- */
-class DeactivateEvent : public QueuedEvent
-{
-public:
- DeactivateEvent(CountedPtr responder);
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-};
-
-
-} // namespace Om
-
-#endif // DEACTIVATEEVENT_H
diff --git a/src/engine/DestroyEvent.cpp b/src/engine/DestroyEvent.cpp
deleted file mode 100644
index 3988195a..00000000
--- a/src/engine/DestroyEvent.cpp
+++ /dev/null
@@ -1,168 +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 "DestroyEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "Patch.h"
-#include "Tree.h"
-#include "Node.h"
-#include "Plugin.h"
-#include "InternalNode.h"
-#include "DisconnectNodeEvent.h"
-#include "DisconnectPortEvent.h"
-#include "ClientBroadcaster.h"
-#include "Maid.h"
-#include "ObjectStore.h"
-#include "util/Path.h"
-#include "QueuedEventSource.h"
-#include "Port.h"
-
-namespace Om {
-
-
-DestroyEvent::DestroyEvent(CountedPtr responder, const string& path, bool lock_mutex)
-: QueuedEvent(responder, true),
- m_path(path),
- m_node(NULL),
- m_patch_listnode(NULL),
- m_store_treenode(NULL),
- m_process_order(NULL),
- m_disconnect_event(NULL),
- m_parent_disconnect_event(NULL)
-{
-}
-
-
-DestroyEvent::DestroyEvent(CountedPtr responder, Node* node, bool lock_mutex)
-: QueuedEvent(responder, true),
- m_path(node->path()),
- m_node(node),
- m_patch_listnode(NULL),
- m_store_treenode(NULL),
- m_process_order(NULL),
- m_disconnect_event(NULL),
- m_parent_disconnect_event(NULL)
-{
-}
-
-
-DestroyEvent::~DestroyEvent()
-{
- delete m_disconnect_event;
- delete m_parent_disconnect_event;
-}
-
-
-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_path != "/") {
- assert(m_node->parent_patch() != NULL);
- m_patch_listnode = m_node->parent_patch()->remove_node(m_path.name());
- if (m_patch_listnode != NULL) {
- assert(m_patch_listnode->elem() == m_node);
-
- m_node->remove_from_store();
-
- if (m_node->providers()->size() != 0 || m_node->dependants()->size() != 0) {
- m_disconnect_event = new DisconnectNodeEvent(m_node);
- m_disconnect_event->pre_process();
- }
-
- // Create a recursive disconnect event for the parent port, if a bridge node
- 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();
- // Remove node to be removed from the process order so it isn't executed by
- // Patch::run and can safely be destroyed
- //for (size_t i=0; i < m_process_order->size(); ++i)
- // if (m_process_order->at(i) == m_node)
- // m_process_order->at(i) = NULL; // ew, gap
-
-#ifdef DEBUG
- // Be sure node is removed from process order, so it can be destroyed
- for (size_t i=0; i < m_process_order->size(); ++i)
- assert(m_process_order->at(i) != m_node);
-#endif
- }
- }
- }
-
- QueuedEvent::pre_process();
-}
-
-
-void
-DestroyEvent::execute(samplecount offset)
-{
- QueuedEvent::execute(offset);
-
- if (m_patch_listnode != NULL) {
- m_node->remove_from_patch();
-
- if (m_disconnect_event != NULL)
- m_disconnect_event->execute(offset);
- if (m_parent_disconnect_event != NULL)
- m_parent_disconnect_event->execute(offset);
-
- if (m_node->parent_patch()->process_order() != NULL)
- om->maid()->push(m_node->parent_patch()->process_order());
- m_node->parent_patch()->process_order(m_process_order);
- }
-}
-
-
-void
-DestroyEvent::post_process()
-{
- m_source->unblock();
-
- if (m_node == NULL) {
- if (m_path == "/")
- m_responder->respond_error("You can not destroy the root patch (/)");
- else
- m_responder->respond_error("Could not find node to destroy");
- } else if (m_patch_listnode != NULL) {
- m_node->deactivate();
- m_responder->respond_ok();
- if (m_disconnect_event != NULL)
- m_disconnect_event->post_process();
- if (m_parent_disconnect_event != NULL)
- m_parent_disconnect_event->post_process();
- om->client_broadcaster()->send_destroyed(m_path);
- om->maid()->push(m_patch_listnode);
- om->maid()->push(m_node);
- } else {
- m_responder->respond_error("Unable to destroy object");
- }
-}
-
-
-} // namespace Om
diff --git a/src/engine/DestroyEvent.h b/src/engine/DestroyEvent.h
deleted file mode 100644
index fc579bf4..00000000
--- a/src/engine/DestroyEvent.h
+++ /dev/null
@@ -1,68 +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 DESTROYEVENT_H
-#define DESTROYEVENT_H
-
-#include "util/Path.h"
-#include "QueuedEvent.h"
-#include
-
-using std::string;
-
-template class Array;
-template class ListNode;
-template class TreeNode;
-
-namespace Om {
-
-class OmObject;
-class Patch;
-class Node;
-class Plugin;
-class DisconnectNodeEvent;
-class DisconnectPortEvent;
-
-
-/** An event to remove and delete a Node.
- *
- * \ingroup engine
- */
-class DestroyEvent : public QueuedEvent
-{
-public:
- DestroyEvent(CountedPtr responder, const string& path, bool lock_mutex = true);
- DestroyEvent(CountedPtr responder, Node* node, bool lock_mutex = true);
- ~DestroyEvent();
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- Path m_path;
- Node* m_node;
- ListNode* m_patch_listnode;
- TreeNode* m_store_treenode;
- Array* m_process_order; // Patch's new process order
- DisconnectNodeEvent* m_disconnect_event;
- DisconnectPortEvent* m_parent_disconnect_event; // used for input/output nodes
-};
-
-
-} // namespace Om
-
-#endif // DESTROYEVENT_H
diff --git a/src/engine/DisablePatchEvent.cpp b/src/engine/DisablePatchEvent.cpp
deleted file mode 100644
index a772e6e9..00000000
--- a/src/engine/DisablePatchEvent.cpp
+++ /dev/null
@@ -1,70 +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 "DisablePatchEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "Patch.h"
-#include "ClientBroadcaster.h"
-#include "util.h"
-#include "ObjectStore.h"
-#include "Port.h"
-
-namespace Om {
-
-
-DisablePatchEvent::DisablePatchEvent(CountedPtr responder, const string& patch_path)
-: QueuedEvent(responder),
- m_patch_path(patch_path),
- m_patch(NULL)
-{
-}
-
-
-void
-DisablePatchEvent::pre_process()
-{
- m_patch = om->object_store()->find_patch(m_patch_path);
-
- QueuedEvent::pre_process();
-}
-
-
-void
-DisablePatchEvent::execute(samplecount offset)
-{
- if (m_patch != NULL)
- m_patch->process(false);
-
- QueuedEvent::execute(offset);
-}
-
-
-void
-DisablePatchEvent::post_process()
-{
- if (m_patch != NULL) {
- m_responder->respond_ok();
- om->client_broadcaster()->send_patch_disable(m_patch_path);
- } else {
- m_responder->respond_error(string("Patch ") + m_patch_path + " not found");
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/DisablePatchEvent.h b/src/engine/DisablePatchEvent.h
deleted file mode 100644
index f38f14af..00000000
--- a/src/engine/DisablePatchEvent.h
+++ /dev/null
@@ -1,52 +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 DISABLEPATCHEVENT_H
-#define DISABLEPATCHEVENT_H
-
-#include
-#include "QueuedEvent.h"
-
-using std::string;
-
-namespace Om {
-
-class Patch;
-
-
-/** Disables a Patch's DSP processing.
- *
- * \ingroup engine
- */
-class DisablePatchEvent : public QueuedEvent
-{
-public:
- DisablePatchEvent(CountedPtr responder, const string& patch_path);
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- string m_patch_path;
- Patch* m_patch;
-};
-
-
-} // namespace Om
-
-
-#endif // DISABLEPATCHEVENT_H
diff --git a/src/engine/DisconnectNodeEvent.cpp b/src/engine/DisconnectNodeEvent.cpp
deleted file mode 100644
index 17367dd4..00000000
--- a/src/engine/DisconnectNodeEvent.cpp
+++ /dev/null
@@ -1,140 +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 "DisconnectNodeEvent.h"
-#include
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "Maid.h"
-#include "List.h"
-#include "Node.h"
-#include "ConnectionBase.h"
-#include "DisconnectionEvent.h"
-#include "Port.h"
-#include "Array.h"
-#include "InputPort.h"
-#include "OutputPort.h"
-#include "Patch.h"
-#include "ClientBroadcaster.h"
-#include "util.h"
-#include "ObjectStore.h"
-#include "util/Path.h"
-
-using std::cerr; using std::endl;
-
-namespace Om {
-
-
-DisconnectNodeEvent::DisconnectNodeEvent(CountedPtr responder, const string& node_path)
-: QueuedEvent(responder),
- m_node_path(node_path),
- m_patch(NULL),
- m_node(NULL),
- m_succeeded(true),
- m_lookup(true)
-{
-}
-
-
-/** Internal version, disconnects parent port as well (in the case of InputNode, etc).
- */
-DisconnectNodeEvent::DisconnectNodeEvent(Node* node)
-: QueuedEvent(),
- m_node_path(""),
- m_patch(node->parent_patch()),
- m_node(node),
- m_succeeded(true),
- m_lookup(false)
-{
-}
-
-
-DisconnectNodeEvent::~DisconnectNodeEvent()
-{
- for (List::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
- delete (*i);
-}
-
-
-void
-DisconnectNodeEvent::pre_process()
-{
- typedef List::const_iterator ConnectionListIterator;
-
- // cerr << "Preparing disconnection event...\n";
-
- if (m_lookup) {
- m_patch = om->object_store()->find_patch(m_node_path.parent());
-
- if (m_patch == NULL) {
- m_succeeded = false;
- QueuedEvent::pre_process();
- return;
- }
-
- m_node = om->object_store()->find_node(m_node_path);
-
- if (m_node == NULL) {
- m_succeeded = false;
- QueuedEvent::pre_process();
- return;
- }
- }
-
- Connection* c = NULL;
- for (ConnectionListIterator i = m_patch->connections().begin(); i != m_patch->connections().end(); ++i) {
- c = (*i);
- if ((c->src_port()->parent_node() == m_node || c->dst_port()->parent_node() == m_node) && !c->pending_disconnection()) {
- DisconnectionEvent* ev = new DisconnectionEvent(CountedPtr(new Responder()), c->src_port(), c->dst_port());
- ev->pre_process();
- m_disconnection_events.push_back(new ListNode(ev));
- c->pending_disconnection(true);
- }
- }
-
- m_succeeded = true;
- QueuedEvent::pre_process();
-}
-
-
-void
-DisconnectNodeEvent::execute(samplecount offset)
-{
- if (m_succeeded) {
- for (List::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
- (*i)->execute(offset);
- }
-
- QueuedEvent::execute(offset);
-}
-
-
-void
-DisconnectNodeEvent::post_process()
-{
- if (m_succeeded) {
- m_responder->respond_ok();
- for (List::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
- (*i)->post_process();
- } else {
- m_responder->respond_error("Unable to disconnect all ports.");
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/DisconnectNodeEvent.h b/src/engine/DisconnectNodeEvent.h
deleted file mode 100644
index a82fbaec..00000000
--- a/src/engine/DisconnectNodeEvent.h
+++ /dev/null
@@ -1,68 +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 DISCONNECTNODEEVENT_H
-#define DISCONNECTNODEEVENT_H
-
-#include
-#include "util/Path.h"
-#include "QueuedEvent.h"
-#include "List.h"
-using std::string;
-
-namespace Om {
-
-class DisconnectionEvent;
-class Patch;
-class Node;
-class Connection;
-template class ConnectionBase;
-class Port;
-template class InputPort;
-template class OutputPort;
-
-
-/** An event to disconnect all connections to a Node.
- *
- * \ingroup engine
- */
-class DisconnectNodeEvent : public QueuedEvent
-{
-public:
- DisconnectNodeEvent(CountedPtr responder, const string& node_path);
- DisconnectNodeEvent(Node* node);
- ~DisconnectNodeEvent();
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- Path m_node_path;
- Patch* m_patch;
- Node* m_node;
- List m_disconnection_events;
-
- bool m_succeeded;
- bool m_lookup;
- bool m_disconnect_parent;
-};
-
-
-} // namespace Om
-
-
-#endif // DISCONNECTNODEEVENT_H
diff --git a/src/engine/DisconnectPortEvent.cpp b/src/engine/DisconnectPortEvent.cpp
deleted file mode 100644
index a4c213d5..00000000
--- a/src/engine/DisconnectPortEvent.cpp
+++ /dev/null
@@ -1,145 +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 "DisconnectPortEvent.h"
-#include
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "Maid.h"
-#include "List.h"
-#include "Node.h"
-#include "Connection.h"
-#include "DisconnectionEvent.h"
-#include "Port.h"
-#include "Array.h"
-#include "InputPort.h"
-#include "OutputPort.h"
-#include "Patch.h"
-#include "ClientBroadcaster.h"
-#include "util.h"
-#include "ObjectStore.h"
-#include "util/Path.h"
-
-using std::cerr; using std::endl;
-
-namespace Om {
-
-
-DisconnectPortEvent::DisconnectPortEvent(CountedPtr responder, const string& port_path)
-: QueuedEvent(responder),
- m_port_path(port_path),
- m_patch(NULL),
- m_port(NULL),
- m_process_order(NULL),
- m_succeeded(true),
- m_lookup(true)
-{
-}
-
-
-DisconnectPortEvent::DisconnectPortEvent(Port* port)
-: QueuedEvent(),
- m_port_path(""),
- m_patch((port->parent_node() == NULL) ? NULL : port->parent_node()->parent_patch()),
- m_port(port),
- m_process_order(NULL),
- m_succeeded(true),
- m_lookup(false)
-{
- //cerr << "DisconnectPortEvent()\n";
-}
-
-
-DisconnectPortEvent::~DisconnectPortEvent()
-{
- for (List::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
- delete (*i);
-}
-
-
-void
-DisconnectPortEvent::pre_process()
-{
- // cerr << "Preparing disconnection event...\n";
-
- if (m_lookup) {
- m_patch = om->object_store()->find_patch(m_port_path.parent().parent());
-
- if (m_patch == NULL) {
- m_succeeded = false;
- QueuedEvent::pre_process();
- return;
- }
-
- m_port = om->object_store()->find_port(m_port_path);
-
- if (m_port == NULL) {
- m_succeeded = false;
- QueuedEvent::pre_process();
- return;
- }
- }
-
- if (m_patch == NULL) {
- m_succeeded = false;
- QueuedEvent::pre_process();
- return;
- }
-
- Connection* c = NULL;
- for (List::const_iterator i = m_patch->connections().begin(); i != m_patch->connections().end(); ++i) {
- c = (*i);
- if ((c->src_port() == m_port || c->dst_port() == m_port) && !c->pending_disconnection()) {
- DisconnectionEvent* ev = new DisconnectionEvent(CountedPtr(new Responder()), c->src_port(), c->dst_port());
- ev->pre_process();
- m_disconnection_events.push_back(new ListNode(ev));
- c->pending_disconnection(true);
- }
- }
-
- m_succeeded = true;
- QueuedEvent::pre_process();
-}
-
-
-void
-DisconnectPortEvent::execute(samplecount offset)
-{
- if (m_succeeded) {
- for (List::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
- (*i)->execute(offset);
- }
-
- QueuedEvent::execute(offset);
-}
-
-
-void
-DisconnectPortEvent::post_process()
-{
- if (m_succeeded) {
- m_responder->respond_ok();
- for (List::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
- (*i)->post_process();
- } else {
- m_responder->respond_error("Unable to disconnect port.");
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/DisconnectPortEvent.h b/src/engine/DisconnectPortEvent.h
deleted file mode 100644
index e8de4120..00000000
--- a/src/engine/DisconnectPortEvent.h
+++ /dev/null
@@ -1,70 +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 DISCONNECTPORTEVENT_H
-#define DISCONNECTPORTEVENT_H
-
-#include
-#include "util/Path.h"
-#include "QueuedEvent.h"
-#include "List.h"
-
-template class Array;
-
-namespace Om {
-
-
-class Patch;
-class Node;
-class Connection;
-class Port;
-class DisconnectionEvent;
-
-using std::string;
-
-
-/** An event to disconnect all connections to a Port.
- *
- * \ingroup engine
- */
-class DisconnectPortEvent : public QueuedEvent
-{
-public:
- DisconnectPortEvent(CountedPtr responder, const string& port_path);
- DisconnectPortEvent(Port* port);
- ~DisconnectPortEvent();
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- Path m_port_path;
- Patch* m_patch;
- Port* m_port;
- List m_disconnection_events;
-
- Array* m_process_order; // Patch's new process order
-
- bool m_succeeded;
- bool m_lookup;
-};
-
-
-} // namespace Om
-
-
-#endif // DISCONNECTPORTEVENT_H
diff --git a/src/engine/DisconnectionEvent.cpp b/src/engine/DisconnectionEvent.cpp
deleted file mode 100644
index e7d06eab..00000000
--- a/src/engine/DisconnectionEvent.cpp
+++ /dev/null
@@ -1,295 +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 "DisconnectionEvent.h"
-#include
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "ConnectionBase.h"
-#include "InputPort.h"
-#include "OutputPort.h"
-#include "Patch.h"
-#include "ClientBroadcaster.h"
-#include "Port.h"
-#include "PortInfo.h"
-#include "Maid.h"
-#include "ObjectStore.h"
-#include "util/Path.h"
-
-using std::string;
-namespace Om {
-
-
-//// DisconnectionEvent ////
-
-
-DisconnectionEvent::DisconnectionEvent(CountedPtr responder, const string& src_port_path, const string& dst_port_path)
-: QueuedEvent(responder),
- m_src_port_path(src_port_path),
- m_dst_port_path(dst_port_path),
- m_patch(NULL),
- m_src_port(NULL),
- m_dst_port(NULL),
- m_lookup(true),
- m_typed_event(NULL),
- m_error(NO_ERROR)
-{
-}
-
-
-DisconnectionEvent::DisconnectionEvent(CountedPtr responder, Port* const src_port, Port* const dst_port)
-: QueuedEvent(responder),
- m_src_port_path(src_port->path()),
- m_dst_port_path(dst_port->path()),
- m_patch(src_port->parent_node()->parent_patch()),
- m_src_port(src_port),
- m_dst_port(dst_port),
- m_lookup(false),
- m_typed_event(NULL),
- m_error(NO_ERROR)
-{
- assert(src_port->port_info()->is_output());
- assert(dst_port->port_info()->is_input());
- assert(src_port->port_info()->type() == dst_port->port_info()->type());
- assert(src_port->parent_node()->parent_patch()
- == dst_port->parent_node()->parent_patch());
-}
-
-DisconnectionEvent::~DisconnectionEvent()
-{
- delete m_typed_event;
-}
-
-
-void
-DisconnectionEvent::pre_process()
-{
- if (m_lookup) {
- if (m_src_port_path.parent().parent() != m_dst_port_path.parent().parent()) {
- m_error = PARENT_PATCH_DIFFERENT;
- QueuedEvent::pre_process();
- return;
- }
-
- /*m_patch = om->object_store()->find_patch(m_src_port_path.parent().parent());
-
- if (m_patch == NULL) {
- m_error = PORT_NOT_FOUND;
- QueuedEvent::pre_process();
- return;
- }*/
-
- Port* port1 = om->object_store()->find_port(m_src_port_path);
- Port* port2 = om->object_store()->find_port(m_dst_port_path);
-
- if (port1 == NULL || port2 == NULL) {
- m_error = PORT_NOT_FOUND;
- QueuedEvent::pre_process();
- return;
- }
-
- if (port1->port_info()->type() != port2->port_info()->type()) {
- m_error = TYPE_MISMATCH;
- QueuedEvent::pre_process();
- return;
- }
-
- if (port1->port_info()->is_output() && port2->port_info()->is_input()) {
- m_src_port = port1;
- m_dst_port = port2;
- } else if (port2->port_info()->is_output() && port1->port_info()->is_input()) {
- m_src_port = port2;
- m_dst_port = port1;
- } else {
- m_error = TYPE_MISMATCH;
- QueuedEvent::pre_process();
- return;
- }
- }
-
- // Create the typed event to actually do the work
- const PortType type = m_src_port->port_info()->type();
- if (type == AUDIO || type == CONTROL) {
- m_typed_event = new TypedDisconnectionEvent(m_responder,
- (OutputPort*)m_src_port, (InputPort*)m_dst_port);
- } else if (type == MIDI) {
- m_typed_event = new TypedDisconnectionEvent(m_responder,
- (OutputPort*)m_src_port, (InputPort*)m_dst_port);
- } else {
- m_error = TYPE_MISMATCH;
- QueuedEvent::pre_process();
- return;
- }
-
- m_typed_event->pre_process();
-
- QueuedEvent::pre_process();
-}
-
-
-void
-DisconnectionEvent::execute(samplecount offset)
-{
- QueuedEvent::execute(offset);
-
- if (m_error == NO_ERROR)
- m_typed_event->execute(offset);
-}
-
-
-void
-DisconnectionEvent::post_process()
-{
- if (m_error == NO_ERROR) {
- m_typed_event->post_process();
- } else {
- // FIXME: better error messages
- string msg = "Unable to make connection ";
- msg.append(m_src_port_path + " -> " + m_dst_port_path);
- m_responder->respond_error(msg);
- }
-}
-
-
-
-//// TypedDisconnectionEvent ////
-
-
-template
-TypedDisconnectionEvent::TypedDisconnectionEvent(CountedPtr responder, OutputPort* src_port, InputPort* dst_port)
-: QueuedEvent(responder),
- m_src_port(src_port),
- m_dst_port(dst_port),
- m_patch(NULL),
- m_process_order(NULL),
- m_succeeded(true)
-{
- assert(src_port != NULL);
- assert(dst_port != NULL);
-}
-
-template
-TypedDisconnectionEvent::~TypedDisconnectionEvent()
-{
- // FIXME: haaaack, prevent a double delete
- // this class is unusable by anything other than DisconnectionEvent because of this
- //m_responder = NULL;
-}
-
-
-template
-void
-TypedDisconnectionEvent::pre_process()
-{
- if (!m_dst_port->is_connected_to(m_src_port)) {
- m_succeeded = false;
- QueuedEvent::pre_process();
- return;
- }
-
- Node* const src_node = m_src_port->parent_node();
- Node* const dst_node = m_dst_port->parent_node();
-
- m_patch = src_node->parent_patch();
-
- if (src_node == NULL || dst_node == NULL) {
- m_succeeded = false;
- QueuedEvent::pre_process();
- return;
- }
-
- if (src_node->parent() != m_patch || dst_node->parent() != m_patch) {
- m_succeeded = false;
- QueuedEvent::pre_process();
- return;
- }
-
- bool removed = false;
-
- for (List::iterator i = dst_node->providers()->begin(); i != dst_node->providers()->end(); ++i)
- if ((*i) == src_node) {
- delete dst_node->providers()->remove(i);
- removed = true;
- break;
- }
- assert(removed);
- removed = false;
-
- for (List::iterator i = src_node->dependants()->begin(); i != src_node->dependants()->end(); ++i)
- if ((*i) == dst_node) {
- delete src_node->dependants()->remove(i);
- removed = true;
- break;
- }
- assert(removed);
-
- if (m_patch->process())
- m_process_order = m_patch->build_process_order();
-
- m_succeeded = true;
- QueuedEvent::pre_process();
-}
-
-
-template
-void
-TypedDisconnectionEvent::execute(samplecount offset)
-{
- if (m_succeeded) {
-
- ListNode*>* const port_connection
- = m_dst_port->remove_connection(m_src_port);
-
- if (port_connection != NULL) {
- ListNode* const patch_connection
- = m_patch->remove_connection(m_src_port, m_dst_port);
-
- assert((Connection*)port_connection->elem() == patch_connection->elem());
-
- // Clean up both the list node and the connection itself...
- om->maid()->push(port_connection);
- om->maid()->push(patch_connection);
- om->maid()->push(port_connection->elem());
-
- if (m_patch->process_order() != NULL)
- om->maid()->push(m_patch->process_order());
- m_patch->process_order(m_process_order);
- } else {
- m_succeeded = false; // Ports weren't connected
- }
- }
- QueuedEvent::execute(offset);
-}
-
-
-template
-void
-TypedDisconnectionEvent::post_process()
-{
- if (m_succeeded) {
-
- m_responder->respond_ok();
-
- om->client_broadcaster()->send_disconnection(m_src_port->path(), m_dst_port->path());
- } else {
- m_responder->respond_error("Unable to disconnect ports.");
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/DisconnectionEvent.h b/src/engine/DisconnectionEvent.h
deleted file mode 100644
index bbb70f3c..00000000
--- a/src/engine/DisconnectionEvent.h
+++ /dev/null
@@ -1,106 +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 DISCONNECTIONEVENT_H
-#define DISCONNECTIONEVENT_H
-
-#include
-#include "util/Path.h"
-#include "QueuedEvent.h"
-#include "util/types.h"
-using std::string;
-
-template class ListNode;
-template class Array;
-
-namespace Om {
-
-class Patch;
-class Node;
-class Connection;
-class MidiMessage;
-class Port;
-template class ConnectionBase;
-template class InputPort;
-template class OutputPort;
-template class TypedDisconnectionEvent; // helper, defined below
-
-
-/** Make a Connection between two Ports.
- *
- * \ingroup engine
- */
-class DisconnectionEvent : public QueuedEvent
-{
-public:
- DisconnectionEvent(CountedPtr responder, const string& src_port_path, const string& dst_port_path);
- DisconnectionEvent(CountedPtr responder, Port* const src_port, Port* const dst_port);
- ~DisconnectionEvent();
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
-
- enum ErrorType { NO_ERROR, PARENT_PATCH_DIFFERENT, PORT_NOT_FOUND, TYPE_MISMATCH };
-
- Path m_src_port_path;
- Path m_dst_port_path;
-
- Patch* m_patch;
- Port* m_src_port;
- Port* m_dst_port;
-
- bool m_lookup;
- QueuedEvent* m_typed_event;
-
- ErrorType m_error;
-};
-
-
-/** Templated DisconnectionEvent.
- *
- * Intended to be called from DisconnectionEvent so callers (ie OSCReceiver)
- * can use DisconnectionEvent without knowing anything about types (which
- * they can't, since all they have is Port paths).
- */
-template
-class TypedDisconnectionEvent : public QueuedEvent
-{
-public:
- TypedDisconnectionEvent(CountedPtr responder, OutputPort* src_port, InputPort* dst_port);
- ~TypedDisconnectionEvent();
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- OutputPort* m_src_port;
- InputPort* m_dst_port;
-
- Patch* m_patch;
- Array* m_process_order; ///< New process order for Patch
-
- bool m_succeeded;
-};
-
-
-
-} // namespace Om
-
-#endif // DISCONNECTIONEVENT_H
diff --git a/src/engine/EnablePatchEvent.cpp b/src/engine/EnablePatchEvent.cpp
deleted file mode 100644
index 6af3b844..00000000
--- a/src/engine/EnablePatchEvent.cpp
+++ /dev/null
@@ -1,82 +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 "EnablePatchEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "Patch.h"
-#include "util.h"
-#include "ClientBroadcaster.h"
-#include "ObjectStore.h"
-
-namespace Om {
-
-
-EnablePatchEvent::EnablePatchEvent(CountedPtr responder, const string& patch_path)
-: QueuedEvent(responder),
- m_patch_path(patch_path),
- m_patch(NULL),
- m_process_order(NULL)
-{
-}
-
-
-void
-EnablePatchEvent::pre_process()
-{
- m_patch = om->object_store()->find_patch(m_patch_path);
-
- if (m_patch != NULL) {
- /* Any event that requires a new process order will set the patch's
- * process order to NULL if it is executed when the patch is not
- * active. So, if the PO is NULL, calculate it here */
- if (m_patch->process_order() == NULL)
- m_process_order = m_patch->build_process_order();
- }
-
- QueuedEvent::pre_process();
-}
-
-
-void
-EnablePatchEvent::execute(samplecount offset)
-{
- if (m_patch != NULL) {
- m_patch->process(true);
-
- if (m_patch->process_order() == NULL)
- m_patch->process_order(m_process_order);
- }
-
- QueuedEvent::execute(offset);
-}
-
-
-void
-EnablePatchEvent::post_process()
-{
- if (m_patch != NULL) {
- m_responder->respond_ok();
- om->client_broadcaster()->send_patch_enable(m_patch_path);
- } else {
- m_responder->respond_error(string("Patch ") + m_patch_path + " not found");
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/EnablePatchEvent.h b/src/engine/EnablePatchEvent.h
deleted file mode 100644
index f3d22e69..00000000
--- a/src/engine/EnablePatchEvent.h
+++ /dev/null
@@ -1,56 +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 ENABLEPATCHEVENT_H
-#define ENABLEPATCHEVENT_H
-
-#include
-#include "QueuedEvent.h"
-
-using std::string;
-
-template class Array;
-
-namespace Om {
-
-class Patch;
-class Node;
-
-
-/** Enables a patch's DSP processing.
- *
- * \ingroup engine
- */
-class EnablePatchEvent : public QueuedEvent
-{
-public:
- EnablePatchEvent(CountedPtr responder, const string& patch_path);
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- string m_patch_path;
- Patch* m_patch;
- Array* m_process_order; // Patch's new process order
-};
-
-
-} // namespace Om
-
-
-#endif // ENABLEPATCHEVENT_H
diff --git a/src/engine/Event.cpp b/src/engine/Event.cpp
deleted file mode 100644
index 7d590e76..00000000
--- a/src/engine/Event.cpp
+++ /dev/null
@@ -1,48 +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 "Event.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "AudioDriver.h"
-
-namespace Om {
-
-// It'd be nice if this was inlined..
-Event::Event(CountedPtr responder)
-: m_responder(responder),
- m_executed(false)
-{
- m_time_stamp = om->audio_driver()->time_stamp();
-}
-
-
-/** Construct an event with no responder.
- *
- * For internal events only, attempting to access the responder will
- * cause a NULL pointer dereference.
- */
-Event::Event()
-: m_responder(NULL),
- m_executed(false)
-{
- m_time_stamp = om->audio_driver()->time_stamp();
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/Event.h b/src/engine/Event.h
deleted file mode 100644
index a6d06f83..00000000
--- a/src/engine/Event.h
+++ /dev/null
@@ -1,71 +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 EVENT_H
-#define EVENT_H
-
-#include
-#include "util/CountedPtr.h"
-#include "util/types.h"
-#include "MaidObject.h"
-#include "Responder.h"
-
-namespace Om {
-
-
-
-/** Base class for all events (both realtime and QueuedEvent).
- *
- * This is for time-critical events like note ons. There is no non-realtime
- * pre-execute method as in QueuedEvent's, any lookups etc need to be done in the
- * realtime execute() method.
- *
- * QueuedEvent extends this class with a pre_process() method for any work that needs
- * to be done before processing in the realtime audio thread.
- *
- * \ingroup engine
- */
-class Event : public MaidObject
-{
-public:
- virtual ~Event() {}
-
- /** Execute event, MUST be realtime safe */
- virtual void execute(samplecount offset) { assert(!m_executed); m_executed = true; }
-
- /** Perform any actions after execution (ie send OSC response to client).
- * No realtime requirement. */
- virtual void post_process() {}
-
- inline samplecount time_stamp() { return m_time_stamp; }
-
-protected:
- Event(CountedPtr responder);
- Event();
-
- // Prevent copies
- Event(const Event&);
- Event& operator=(const Event&);
-
- CountedPtr m_responder;
- samplecount m_time_stamp;
- bool m_executed;
-};
-
-
-} // namespace Om
-
-#endif // EVENT_H
diff --git a/src/engine/LV2Plugin.h b/src/engine/LV2Plugin.h
index 0701270d..c3d3038a 100644
--- a/src/engine/LV2Plugin.h
+++ b/src/engine/LV2Plugin.h
@@ -35,12 +35,12 @@ class PortInfo;
class LV2Plugin : public NodeBase
{
public:
- LV2Plugin::LV2Plugin(const string& name,
- size_t poly,
- Patch* parent,
- const SLV2Plugin* plugin,
- samplerate srate,
- size_t buffer_size);
+ LV2Plugin(const string& name,
+ size_t poly,
+ Patch* parent,
+ const SLV2Plugin* plugin,
+ samplerate srate,
+ size_t buffer_size);
virtual ~LV2Plugin();
diff --git a/src/engine/LashRestoreDoneEvent.h b/src/engine/LashRestoreDoneEvent.h
deleted file mode 100644
index dfc5b120..00000000
--- a/src/engine/LashRestoreDoneEvent.h
+++ /dev/null
@@ -1,54 +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 LASHRESTOREDONEEVENT_H
-#define LASHRESTOREDONEEVENT_H
-
-#include "QueuedEvent.h"
-#include "LashDriver.h"
-#include "util/types.h"
-
-#include
-using std::cerr;
-
-namespace Om {
-
-class Port;
-
-
-/** Notification from a client that the LASH session is finished restoring.
- *
- * This is a bit of a hack, but needed to defer notifying LASH of our
- * existance until all ports are created.
- *
- * \ingroup engine
- */
-class LashRestoreDoneEvent : public QueuedEvent
-{
-public:
- LashRestoreDoneEvent(CountedPtr responder) : QueuedEvent(responder) {}
-
- void post_process()
- {
- m_responder->respond_ok();
- lash_driver->restore_finished();
- }
-};
-
-
-} // namespace Om
-
-#endif // LASHRESTOREDONEEVENT_H
diff --git a/src/engine/LoadPluginsEvent.cpp b/src/engine/LoadPluginsEvent.cpp
deleted file mode 100644
index 656e9010..00000000
--- a/src/engine/LoadPluginsEvent.cpp
+++ /dev/null
@@ -1,44 +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 "LoadPluginsEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "NodeFactory.h"
-
-namespace Om {
-
-
-LoadPluginsEvent::LoadPluginsEvent(CountedPtr responder)
-: QueuedEvent(responder)
-{
-}
-
-
-void
-LoadPluginsEvent::post_process()
-{
- // Why is this done here and not in pre_process()???
- om->node_factory()->load_plugins();
- m_responder->respond_ok();
-
- //cerr << "Load plugins post finished\n";
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/LoadPluginsEvent.h b/src/engine/LoadPluginsEvent.h
deleted file mode 100644
index b69dbb38..00000000
--- a/src/engine/LoadPluginsEvent.h
+++ /dev/null
@@ -1,40 +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 LOADPLUGINSEVENT_H
-#define LOADPLUGINSEVENT_H
-
-#include "QueuedEvent.h"
-
-namespace Om {
-
-
-/** Loads all plugins into the internal plugin database (in NodeFactory).
- *
- * \ingroup engine
- */
-class LoadPluginsEvent : public QueuedEvent
-{
-public:
- LoadPluginsEvent(CountedPtr responder);
-
- void post_process();
-};
-
-
-} // namespace Om
-
-#endif // LOADPLUGINSEVENT_H
diff --git a/src/engine/Makefile.am b/src/engine/Makefile.am
index e09b7368..4317674f 100644
--- a/src/engine/Makefile.am
+++ b/src/engine/Makefile.am
@@ -1,6 +1,7 @@
SUBDIRS = tests
+DIST_SUBDIRS = events
-AM_CXXFLAGS = @JACK_CFLAGS@ @LOSC_CFLAGS@ @ALSA_CFLAGS@ @LASH_CFLAGS@ @SLV2_CFLAGS@ -I$(top_srcdir)/src/common -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/engine/events -fno-exceptions -fno-rtti
common_SOURCES = \
util.h \
@@ -48,10 +49,6 @@ common_SOURCES = \
MidiTriggerNode.cpp \
MidiControlNode.h \
MidiControlNode.cpp \
- RegisterClientEvent.h \
- RegisterClientEvent.cpp \
- UnregisterClientEvent.h \
- UnregisterClientEvent.cpp \
BridgeNode.h \
BridgeNode.cpp \
ControlInputNode.h \
@@ -69,31 +66,6 @@ common_SOURCES = \
Event.h \
Event.cpp \
QueuedEvent.h \
- PingQueuedEvent.h \
- ActivateEvent.h \
- ActivateEvent.cpp \
- DeactivateEvent.h \
- DeactivateEvent.cpp \
- SetPortValueEvent.h \
- SetPortValueEvent.cpp \
- SetPortValueQueuedEvent.h \
- SetPortValueQueuedEvent.cpp \
- NoteOnEvent.h \
- NoteOnEvent.cpp \
- NoteOffEvent.h \
- NoteOffEvent.cpp \
- AllNotesOffEvent.h \
- AllNotesOffEvent.cpp \
- ConnectionEvent.h \
- ConnectionEvent.cpp \
- DisconnectionEvent.h \
- DisconnectionEvent.cpp \
- DisconnectNodeEvent.h \
- DisconnectNodeEvent.cpp \
- DisconnectPortEvent.h \
- DisconnectPortEvent.cpp \
- DestroyEvent.h \
- DestroyEvent.cpp \
EventSource.h \
QueuedEventSource.h \
QueuedEventSource.cpp \
@@ -104,20 +76,6 @@ common_SOURCES = \
Maid.cpp \
MaidObject.h \
Tree.h \
- AddNodeEvent.h \
- AddNodeEvent.cpp \
- SetMetadataEvent.h \
- SetMetadataEvent.cpp \
- RequestMetadataEvent.h \
- RequestMetadataEvent.cpp \
- RequestPortValueEvent.h \
- RequestPortValueEvent.cpp \
- RequestAllObjectsEvent.h \
- RequestAllObjectsEvent.cpp \
- RequestPluginsEvent.h \
- RequestPluginsEvent.cpp \
- CreatePatchEvent.h \
- CreatePatchEvent.cpp \
ClientRecord.h \
PortInfo.h \
PluginLibrary.h \
@@ -132,20 +90,8 @@ common_SOURCES = \
ConnectionBase.cpp \
ObjectStore.h \
ObjectStore.cpp \
- LoadPluginsEvent.h \
- LoadPluginsEvent.cpp \
- EnablePatchEvent.h \
- EnablePatchEvent.cpp \
- DisablePatchEvent.h \
- DisablePatchEvent.cpp \
- ClearPatchEvent.h \
- ClearPatchEvent.cpp \
TransportNode.h \
TransportNode.cpp \
- RenameEvent.h \
- RenameEvent.cpp \
- MidiLearnEvent.h \
- MidiLearnEvent.cpp \
Driver.h \
AudioDriver.h \
MidiDriver.h \
@@ -158,6 +104,64 @@ common_SOURCES = \
../common/interface/EngineInterface.h \
instantiations.cpp
+# Events
+common_SOURCES += \
+ events/RegisterClientEvent.h \
+ events/RegisterClientEvent.cpp \
+ events/UnregisterClientEvent.h \
+ events/UnregisterClientEvent.cpp \
+ events/PingQueuedEvent.h \
+ events/ActivateEvent.h \
+ events/ActivateEvent.cpp \
+ events/DeactivateEvent.h \
+ events/DeactivateEvent.cpp \
+ events/SetPortValueEvent.h \
+ events/SetPortValueEvent.cpp \
+ events/SetPortValueQueuedEvent.h \
+ events/SetPortValueQueuedEvent.cpp \
+ events/NoteOnEvent.h \
+ events/NoteOnEvent.cpp \
+ events/NoteOffEvent.h \
+ events/NoteOffEvent.cpp \
+ events/AllNotesOffEvent.h \
+ events/AllNotesOffEvent.cpp \
+ events/ConnectionEvent.h \
+ events/ConnectionEvent.cpp \
+ events/DisconnectionEvent.h \
+ events/DisconnectionEvent.cpp \
+ events/DisconnectNodeEvent.h \
+ events/DisconnectNodeEvent.cpp \
+ events/DisconnectPortEvent.h \
+ events/DisconnectPortEvent.cpp \
+ events/DestroyEvent.h \
+ events/DestroyEvent.cpp \
+ events/AddNodeEvent.h \
+ events/AddNodeEvent.cpp \
+ events/SetMetadataEvent.h \
+ events/SetMetadataEvent.cpp \
+ events/RequestMetadataEvent.h \
+ events/RequestMetadataEvent.cpp \
+ events/RequestPortValueEvent.h \
+ events/RequestPortValueEvent.cpp \
+ events/RequestAllObjectsEvent.h \
+ events/RequestAllObjectsEvent.cpp \
+ events/RequestPluginsEvent.h \
+ events/RequestPluginsEvent.cpp \
+ events/CreatePatchEvent.h \
+ events/CreatePatchEvent.cpp \
+ events/LoadPluginsEvent.h \
+ events/LoadPluginsEvent.cpp \
+ events/EnablePatchEvent.h \
+ events/EnablePatchEvent.cpp \
+ events/DisablePatchEvent.h \
+ events/DisablePatchEvent.cpp \
+ events/ClearPatchEvent.h \
+ events/ClearPatchEvent.cpp \
+ events/RenameEvent.h \
+ events/RenameEvent.cpp \
+ events/MidiLearnEvent.h \
+ events/MidiLearnEvent.cpp
+
if WITH_JACK_MIDI
common_SOURCES += \
JackMidiDriver.h \
@@ -180,14 +184,14 @@ if WITH_DSSI
common_SOURCES += \
DSSIPlugin.h \
DSSIPlugin.cpp \
- DSSIUpdateEvent.h \
- DSSIUpdateEvent.cpp \
- DSSIControlEvent.h \
- DSSIControlEvent.cpp \
- DSSIConfigureEvent.h \
- DSSIConfigureEvent.cpp \
- DSSIProgramEvent.h \
- DSSIProgramEvent.cpp
+ events/DSSIConfigureEvent.cpp \
+ events/DSSIConfigureEvent.h \
+ events/DSSIControlEvent.cpp \
+ events/DSSIControlEvent.h \
+ events/DSSIProgramEvent.cpp \
+ events/DSSIProgramEvent.h \
+ events/DSSIUpdateEvent.cpp \
+ events/DSSIUpdateEvent.h
endif
if WITH_LV2
@@ -197,7 +201,10 @@ common_SOURCES += \
endif
if WITH_LASH
-common_SOURCES += LashDriver.h LashDriver.cpp LashRestoreDoneEvent.h
+common_SOURCES += \
+ LashDriver.h \
+ LashDriver.cpp \
+ LashRestoreDoneEvent.h
endif
@@ -205,19 +212,19 @@ endif
# Non-installed library to link stand-alone and in-process build against
#
-noinst_LIBRARIES = libom.a
-libom_a_SOURCES = $(common_SOURCES)
+noinst_LTLIBRARIES = libom.la
+libom_la_SOURCES = $(common_SOURCES)
#
-# Stand-alone engine
+# Statically linked stand-alone engine
#
if BUILD_ENGINE
bin_PROGRAMS = om
-om_DEPENDENCIES = libom.a
-om_LDADD = @JACK_LIBS@ @LOSC_LIBS@ @ALSA_LIBS@ @LASH_LIBS@ @SLV2_LIBS@ -lrt libom.a
+om_DEPENDENCIES = libom.la
+om_LDADD = @JACK_LIBS@ @LOSC_LIBS@ @ALSA_LIBS@ @LASH_LIBS@ @SLV2_LIBS@ -lrt libom.la
om_SOURCES = \
main.cpp \
@@ -233,13 +240,15 @@ endif # BUILD_ENGINE
#
if BUILD_IN_PROCESS_ENGINE
+
+# FIXME: broken
+
+
# FIXME: Figure out how to get this properly
omdir = $(prefix)/lib/jack
om_la_CFLAGS = -fPIC
om_LTLIBRARIES = om.la
-om_la_DEPENDENCIES = libom.a
-om_la_LIBADD = libom.a
om_la_LDFLAGS = -module -avoid-version @JACK_LIBS@ @LOSC_LIBS@ @ALSA_LIBS@ @LASH_LIBS@ @SLV2_LIBS@
om_la_SOURCES = OmInProcess.cpp
diff --git a/src/engine/MidiLearnEvent.cpp b/src/engine/MidiLearnEvent.cpp
deleted file mode 100644
index 63ad82fc..00000000
--- a/src/engine/MidiLearnEvent.cpp
+++ /dev/null
@@ -1,88 +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 "MidiLearnEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "ObjectStore.h"
-#include "Node.h"
-#include "MidiControlNode.h"
-#include "ClientBroadcaster.h"
-
-namespace Om {
-
-
-// MidiLearnResponseEvent
-
-void
-MidiLearnResponseEvent::post_process()
-{
- om->client_broadcaster()->send_control_change(m_port_path, m_value);
-}
-
-
-
-// MidiLearnEvent
-
-MidiLearnEvent::MidiLearnEvent(CountedPtr responder, const string& node_path)
-: QueuedEvent(responder),
- m_node_path(node_path),
- m_node(NULL),
- m_response_event(NULL)
-{
-}
-
-
-void
-MidiLearnEvent::pre_process()
-{
- m_node = om->object_store()->find_node(m_node_path);
- m_response_event = new MidiLearnResponseEvent(m_node_path + "/Controller Number");
-
- QueuedEvent::pre_process();
-}
-
-
-void
-MidiLearnEvent::execute(samplecount offset)
-{
- QueuedEvent::execute(offset);
-
- // FIXME: this isn't very good at all.
- if (m_node != NULL && m_node->plugin()->type() == Plugin::Internal
- && m_node->plugin()->plug_label() == "midi_control_in") {
- ((MidiControlNode*)m_node)->learn(m_response_event);
- }
-}
-
-
-void
-MidiLearnEvent::post_process()
-{
- if (m_node != NULL) {
- m_responder->respond_ok();
- } else {
- string msg = "Did not find node '";
- msg.append(m_node_path).append("' for MIDI learn.");
- m_responder->respond_error(msg);
- }
-}
-
-
-} // namespace Om
-
-
diff --git a/src/engine/MidiLearnEvent.h b/src/engine/MidiLearnEvent.h
deleted file mode 100644
index 793e675a..00000000
--- a/src/engine/MidiLearnEvent.h
+++ /dev/null
@@ -1,84 +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 MIDILEARNEVENT_H
-#define MIDILEARNEVENT_H
-
-#include "QueuedEvent.h"
-#include "MidiControlNode.h"
-#include "util/types.h"
-#include
-using std::string;
-
-namespace Om {
-
-class Node;
-class ControlChangeEvent;
-
-
-/** Response event for a MIDI learn.
- *
- * This is a trivial event that sends a control change in it's post_process
- * method (used by MidiLearnEvent to notify clients when the learn happens)
- */
-class MidiLearnResponseEvent : public Event
-{
-public:
- MidiLearnResponseEvent(const string& port_path)
- : Event(CountedPtr(NULL)),
- m_port_path(port_path),
- m_value(0.0f)
- {}
-
- void set_value(sample val) { m_value = val; }
- void post_process();
-
-private:
- string m_port_path;
- sample m_value;
-};
-
-
-
-/** A MIDI learn event.
- *
- * This creates a MidiLearnResponseEvent and passes it to the learning node, which
- * will push it to the post-processor once the learn happens in order to reply
- * to the client with the new port (learned controller) value.
- *
- * \ingroup engine
- */
-class MidiLearnEvent : public QueuedEvent
-{
-public:
- MidiLearnEvent(CountedPtr responder, const string& node_path);
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- string m_node_path;
- Node* m_node;
-
- /// Event to respond with when learned
- MidiLearnResponseEvent* m_response_event;
-};
-
-
-} // namespace Om
-
-#endif // MIDILEARNEVENT_H
diff --git a/src/engine/NoteOffEvent.cpp b/src/engine/NoteOffEvent.cpp
deleted file mode 100644
index fde2e520..00000000
--- a/src/engine/NoteOffEvent.cpp
+++ /dev/null
@@ -1,78 +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 "NoteOffEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "ObjectStore.h"
-#include "Node.h"
-#include "MidiNoteNode.h"
-#include "MidiTriggerNode.h"
-
-namespace Om {
-
-
-/** Note off with patch explicitly passed - triggered by MIDI.
- */
-NoteOffEvent::NoteOffEvent(CountedPtr responder, Node* node, uchar note_num)
-: Event(responder),
- m_node(node),
- m_note_num(note_num)
-{
-}
-
-
-/** Note off event with lookup - triggered by OSC.
- */
-NoteOffEvent::NoteOffEvent(CountedPtr responder, const string& node_path, uchar note_num)
-: Event(responder),
- m_node(NULL),
- m_node_path(node_path),
- m_note_num(note_num)
-{
-}
-
-
-void
-NoteOffEvent::execute(samplecount offset)
-{
- if (m_node == NULL && m_node_path != "")
- m_node = om->object_store()->find_node(m_node_path);
-
- // FIXME: this isn't very good at all.
- if (m_node != NULL && m_node->plugin()->type() == Plugin::Internal) {
- if (m_node->plugin()->plug_label() == "note_in")
- ((MidiNoteNode*)m_node)->note_off(m_note_num, offset);
- else if (m_node->plugin()->plug_label() == "trigger_in")
- ((MidiTriggerNode*)m_node)->note_off(m_note_num, offset);
- }
-}
-
-
-void
-NoteOffEvent::post_process()
-{
- if (m_node != NULL)
- m_responder->respond_ok();
- else
- m_responder->respond_error("Did not find node for note_off");
-}
-
-
-} // namespace Om
-
-
diff --git a/src/engine/NoteOffEvent.h b/src/engine/NoteOffEvent.h
deleted file mode 100644
index edd0b373..00000000
--- a/src/engine/NoteOffEvent.h
+++ /dev/null
@@ -1,52 +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 NOTEOFFEVENT_H
-#define NOTEOFFEVENT_H
-
-#include "Event.h"
-#include "util/types.h"
-#include
-using std::string;
-
-namespace Om {
-
-class Node;
-
-
-/** A note off event.
- *
- * \ingroup engine
- */
-class NoteOffEvent : public Event
-{
-public:
- NoteOffEvent(CountedPtr responder, Node* node, uchar note_num);
- NoteOffEvent(CountedPtr responder, const string& node_path, uchar note_num);
-
- void execute(samplecount offset);
- void post_process();
-
-private:
- Node* m_node;
- string m_node_path;
- uchar m_note_num;
-};
-
-
-} // namespace Om
-
-#endif // NOTEOFFEVENT_H
diff --git a/src/engine/NoteOnEvent.cpp b/src/engine/NoteOnEvent.cpp
deleted file mode 100644
index 9688af79..00000000
--- a/src/engine/NoteOnEvent.cpp
+++ /dev/null
@@ -1,89 +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 "NoteOnEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "ObjectStore.h"
-#include "Node.h"
-#include "MidiNoteNode.h"
-#include "MidiTriggerNode.h"
-#include "Plugin.h"
-
-namespace Om {
-
-
-/** Note on with Patch explicitly passed.
- *
- * Used to be triggered by MIDI. Not used anymore.
- */
-NoteOnEvent::NoteOnEvent(CountedPtr responder, Node* patch, uchar note_num, uchar velocity)
-: Event(responder),
- m_node(patch),
- m_note_num(note_num),
- m_velocity(velocity),
- m_is_osc_triggered(false)
-{
-}
-
-
-/** Note on with Node lookup.
- *
- * Triggered by OSC.
- */
-NoteOnEvent::NoteOnEvent(CountedPtr responder, const string& node_path, uchar note_num, uchar velocity)
-: Event(responder),
- m_node(NULL),
- m_node_path(node_path),
- m_note_num(note_num),
- m_velocity(velocity),
- m_is_osc_triggered(true)
-{
-}
-
-
-void
-NoteOnEvent::execute(samplecount offset)
-{
- // Lookup if neccessary
- if (m_is_osc_triggered)
- m_node = om->object_store()->find_node(m_node_path);
-
- // FIXME: this isn't very good at all.
- if (m_node != NULL && m_node->plugin()->type() == Plugin::Internal) {
- if (m_node->plugin()->plug_label() == "note_in")
- ((MidiNoteNode*)m_node)->note_on(m_note_num, m_velocity, offset);
- else if (m_node->plugin()->plug_label() == "trigger_in")
- ((MidiTriggerNode*)m_node)->note_on(m_note_num, m_velocity, offset);
- }
-}
-
-
-void
-NoteOnEvent::post_process()
-{
- if (m_is_osc_triggered) {
- if (m_node != NULL)
- m_responder->respond_ok();
- else
- m_responder->respond_error("Did not find node for note_on");
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/NoteOnEvent.h b/src/engine/NoteOnEvent.h
deleted file mode 100644
index 1e09e450..00000000
--- a/src/engine/NoteOnEvent.h
+++ /dev/null
@@ -1,54 +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 NOTEONEVENT_H
-#define NOTEONEVENT_H
-
-#include "Event.h"
-#include "util/types.h"
-#include
-using std::string;
-
-namespace Om {
-
-class Node;
-
-
-/** A note on event.
- *
- * \ingroup engine
- */
-class NoteOnEvent : public Event
-{
-public:
- NoteOnEvent(CountedPtr responder, Node* patch, uchar note_num, uchar velocity);
- NoteOnEvent(CountedPtr responder, const string& node_path, uchar note_num, uchar velocity);
-
- void execute(samplecount offset);
- void post_process();
-
-private:
- Node* m_node;
- string m_node_path;
- uchar m_note_num;
- uchar m_velocity;
- bool m_is_osc_triggered;
-};
-
-
-} // namespace Om
-
-#endif // NOTEONEVENT_H
diff --git a/src/engine/OSCClient.cpp b/src/engine/OSCClient.cpp
index 7b1580d2..332a2144 100644
--- a/src/engine/OSCClient.cpp
+++ b/src/engine/OSCClient.cpp
@@ -440,7 +440,7 @@ OSCClient::new_plugin(const string& type, const string& uri, const string& name)
* \arg \b poly (int) - Polyphony of new patch (\em not a boolean like new_node)
\n \n
*/
void
-OSCClient::new_patch(const string& path, size_t poly)
+OSCClient::new_patch(const string& path, uint32_t poly)
{
lo_send(_address, "/om/new_patch", "si", path.c_str(), poly);
diff --git a/src/engine/OSCClient.h b/src/engine/OSCClient.h
index fea2fdc6..db14c696 100644
--- a/src/engine/OSCClient.h
+++ b/src/engine/OSCClient.h
@@ -70,7 +70,7 @@ public:
const string& uri,
const string& name);
- virtual void new_patch(const string& path, size_t poly);
+ virtual void new_patch(const string& path, uint32_t poly);
virtual void new_node(const string& plugin_type,
const string& plugin_uri,
diff --git a/src/engine/PingQueuedEvent.h b/src/engine/PingQueuedEvent.h
deleted file mode 100644
index cfba7058..00000000
--- a/src/engine/PingQueuedEvent.h
+++ /dev/null
@@ -1,44 +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 PINGQUEUEDEVENT_H
-#define PINGQUEUEDEVENT_H
-
-#include "QueuedEvent.h"
-#include "util/types.h"
-#include "Responder.h"
-
-namespace Om {
-
-class Port;
-
-
-/** A "blocking" ping that travels through the event queue before responding.
- *
- * \ingroup engine
- */
-class PingQueuedEvent : public QueuedEvent
-{
-public:
- PingQueuedEvent(CountedPtr responder) : QueuedEvent(responder) {}
-
- void post_process() { m_responder->respond_ok(); }
-};
-
-
-} // namespace Om
-
-#endif // PINGQUEUEDEVENT_H
diff --git a/src/engine/QueuedEvent.h b/src/engine/QueuedEvent.h
deleted file mode 100644
index 16560aaa..00000000
--- a/src/engine/QueuedEvent.h
+++ /dev/null
@@ -1,86 +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 QUEUEDEVENT_H
-#define QUEUEDEVENT_H
-
-#include "Event.h"
-
-namespace Om {
-
-class Responder;
-class QueuedEventSource;
-
-
-/** An Event with a not-time-critical preprocessing stage.
- *
- * These events are events that aren't able to be executed immediately by the
- * Jack thread (because they allocate memory or whatever). They are pushed
- * on to the QueuedEventQueue where they are preprocessed then pushed on
- * to the realtime Event Queue when they are ready.
- *
- * Lookups for these events should go in the pre_process() method, since they are
- * not time critical and shouldn't waste time in the audio thread doing
- * lookups they can do beforehand. (This applies for any expensive operation that
- * could be done before the execute() method).
- *
- * \ingroup engine
- */
-class QueuedEvent : public Event
-{
-public:
- /** Process this event into a realtime-suitable event.
- */
- virtual void pre_process() {
- assert(m_pre_processed == false);
- m_pre_processed = true;
- }
-
- virtual void execute(samplecount offset) {
- assert(m_pre_processed);
- Event::execute(offset);
- }
-
- virtual void post_process() {}
-
- /** If this event blocks the prepare phase of other slow events */
- bool is_blocking() { return m_blocking; }
-
- bool is_prepared() { return m_pre_processed; }
-
-protected:
- // Prevent copies
- QueuedEvent(const QueuedEvent& copy);
- QueuedEvent& operator=(const QueuedEvent&);
-
- QueuedEvent(CountedPtr responder, bool blocking = false, QueuedEventSource* source=NULL)
- : Event(responder), m_pre_processed(false), m_blocking(blocking), m_source(source)
- {}
-
- // NULL event base (for internal events)
- QueuedEvent()
- : Event(), m_pre_processed(false), m_blocking(false), m_source(NULL)
- {}
-
- bool m_pre_processed;
- bool m_blocking;
- QueuedEventSource* m_source;
-};
-
-
-} // namespace Om
-
-#endif // QUEUEDEVENT_H
diff --git a/src/engine/RegisterClientEvent.cpp b/src/engine/RegisterClientEvent.cpp
deleted file mode 100644
index ca7dd1f6..00000000
--- a/src/engine/RegisterClientEvent.cpp
+++ /dev/null
@@ -1,53 +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 "RegisterClientEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "ClientBroadcaster.h"
-
-namespace Om {
-
-
-RegisterClientEvent::RegisterClientEvent(CountedPtr responder,
- ClientKey key,
- CountedPtr client)
-: QueuedEvent(responder)
-, _key(key)
-, _client(client)
-{
-}
-
-
-void
-RegisterClientEvent::pre_process()
-{
- om->client_broadcaster()->register_client(_key, _client);
-
- QueuedEvent::pre_process();
-}
-
-
-void
-RegisterClientEvent::post_process()
-{
- m_responder->respond_ok();
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/RegisterClientEvent.h b/src/engine/RegisterClientEvent.h
deleted file mode 100644
index f4b6b60f..00000000
--- a/src/engine/RegisterClientEvent.h
+++ /dev/null
@@ -1,53 +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 REGISTERCLIENTEVENT_H
-#define REGISTERCLIENTEVENT_H
-
-#include "QueuedEvent.h"
-#include "interface/ClientKey.h"
-#include "interface/ClientInterface.h"
-#include
-using std::string;
-using Om::Shared::ClientInterface;
-using Om::Shared::ClientKey;
-
-namespace Om {
-
-
-/** Registers a new client with the OSC system, so it can receive updates.
- *
- * \ingroup engine
- */
-class RegisterClientEvent : public QueuedEvent
-{
-public:
- RegisterClientEvent(CountedPtr responder,
- ClientKey key,
- CountedPtr client);
-
- void pre_process();
- void post_process();
-
-private:
- ClientKey _key;
- CountedPtr _client;
-};
-
-
-} // namespace Om
-
-#endif // REGISTERCLIENTEVENT_H
diff --git a/src/engine/RenameEvent.cpp b/src/engine/RenameEvent.cpp
deleted file mode 100644
index e2e98dd0..00000000
--- a/src/engine/RenameEvent.cpp
+++ /dev/null
@@ -1,123 +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 "RenameEvent.h"
-#include "Responder.h"
-#include "Patch.h"
-#include "Node.h"
-#include "Tree.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "ClientBroadcaster.h"
-#include "util/Path.h"
-#include "ObjectStore.h"
-
-namespace Om {
-
-
-RenameEvent::RenameEvent(CountedPtr responder, const string& path, const string& name)
-: QueuedEvent(responder),
- m_old_path(path),
- m_name(name),
- m_new_path(m_old_path.parent().base_path() + name),
- m_parent_patch(NULL),
- m_store_treenode(NULL),
- m_error(NO_ERROR)
-{
- /*
- if (m_old_path.parent() == "/")
- m_new_path = string("/") + m_name;
- else
- m_new_path = m_old_path.parent() +"/"+ m_name;*/
-}
-
-
-RenameEvent::~RenameEvent()
-{
-}
-
-
-void
-RenameEvent::pre_process()
-{
- if (m_name.find("/") != string::npos) {
- m_error = INVALID_NAME;
- QueuedEvent::pre_process();
- return;
- }
-
- if (om->object_store()->find(m_new_path)) {
- m_error = OBJECT_EXISTS;
- QueuedEvent::pre_process();
- return;
- }
-
- OmObject* obj = om->object_store()->find(m_old_path);
-
- if (obj == NULL) {
- m_error = OBJECT_NOT_FOUND;
- QueuedEvent::pre_process();
- return;
- }
-
- // Renaming only works for Nodes and Patches (which are Nodes)
- if (obj->as_node() == NULL) {
- m_error = OBJECT_NOT_RENAMABLE;
- QueuedEvent::pre_process();
- return;
- }
-
- if (obj != NULL) {
- obj->set_path(m_new_path);
- assert(obj->path() == m_new_path);
- }
-
- QueuedEvent::pre_process();
-}
-
-
-void
-RenameEvent::execute(samplecount offset)
-{
- //cout << "Executing rename event...";
- QueuedEvent::execute(offset);
-}
-
-
-void
-RenameEvent::post_process()
-{
- string msg = "Unable to rename object - ";
-
- if (m_error == NO_ERROR) {
- m_responder->respond_ok();
- om->client_broadcaster()->send_rename(m_old_path, m_new_path);
- } else {
- if (m_error == OBJECT_EXISTS)
- msg.append("Object already exists at ").append(m_new_path);
- else if (m_error == OBJECT_NOT_FOUND)
- msg.append("Could not find object ").append(m_old_path);
- else if (m_error == OBJECT_NOT_RENAMABLE)
- msg.append(m_old_path).append(" is not renamable");
- else if (m_error == INVALID_NAME)
- msg.append(m_name).append(" is not a valid name");
-
- m_responder->respond_error(msg);
- }
-}
-
-
-} // namespace Om
diff --git a/src/engine/RenameEvent.h b/src/engine/RenameEvent.h
deleted file mode 100644
index c1c9fe91..00000000
--- a/src/engine/RenameEvent.h
+++ /dev/null
@@ -1,66 +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 RENAMEEVENT_H
-#define RENAMEEVENT_H
-
-#include "QueuedEvent.h"
-#include "util/Path.h"
-#include
-using std::string;
-
-template class TreeNode;
-template class ListNode;
-
-namespace Om {
-
-class OmObject;
-class Patch;
-class Node;
-class Plugin;
-class DisconnectNodeEvent;
-class DisconnectPortEvent;
-
-
-/** An event to change the name of an OmObject.
- *
- * \ingroup engine
- */
-class RenameEvent : public QueuedEvent
-{
-public:
- RenameEvent(CountedPtr responder, const string& path, const string& name);
- ~RenameEvent();
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- enum ErrorType { NO_ERROR, OBJECT_NOT_FOUND, OBJECT_EXISTS, OBJECT_NOT_RENAMABLE, INVALID_NAME };
-
- Path m_old_path;
- string m_name;
- Path m_new_path;
- Patch* m_parent_patch;
- TreeNode* m_store_treenode;
- ErrorType m_error;
-};
-
-
-} // namespace Om
-
-#endif // RENAMEEVENT_H
diff --git a/src/engine/RequestAllObjectsEvent.cpp b/src/engine/RequestAllObjectsEvent.cpp
deleted file mode 100644
index ef40a0de..00000000
--- a/src/engine/RequestAllObjectsEvent.cpp
+++ /dev/null
@@ -1,55 +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 "RequestAllObjectsEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "ObjectSender.h"
-
-namespace Om {
-
-
-RequestAllObjectsEvent::RequestAllObjectsEvent(CountedPtr responder)
-: QueuedEvent(responder),
- m_client(CountedPtr(NULL))
-{
-}
-
-
-void
-RequestAllObjectsEvent::pre_process()
-{
- m_client = m_responder->find_client();
-
- QueuedEvent::pre_process();
-}
-
-
-void
-RequestAllObjectsEvent::post_process()
-{
- if (m_client) {
- m_responder->respond_ok();
- ObjectSender::send_all(m_client.get());
- } else {
- m_responder->respond_error("Invalid URL");
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/RequestAllObjectsEvent.h b/src/engine/RequestAllObjectsEvent.h
deleted file mode 100644
index df63a577..00000000
--- a/src/engine/RequestAllObjectsEvent.h
+++ /dev/null
@@ -1,50 +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 REQUESTALLOBJECTSEVENT_H
-#define REQUESTALLOBJECTSEVENT_H
-
-#include
-#include "QueuedEvent.h"
-using std::string;
-
-namespace Om {
-
-namespace Shared {
- class ClientInterface;
-} using Shared::ClientInterface;
-
-
-/** A request from a client to send notification of all objects (ie refresh).
- *
- * \ingroup engine
- */
-class RequestAllObjectsEvent : public QueuedEvent
-{
-public:
- RequestAllObjectsEvent(CountedPtr responder);
-
- void pre_process();
- void post_process();
-
-private:
- CountedPtr m_client;
-};
-
-
-} // namespace Om
-
-#endif // REQUESTALLOBJECTSEVENT_H
diff --git a/src/engine/RequestMetadataEvent.cpp b/src/engine/RequestMetadataEvent.cpp
deleted file mode 100644
index 10e1007c..00000000
--- a/src/engine/RequestMetadataEvent.cpp
+++ /dev/null
@@ -1,80 +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 "RequestMetadataEvent.h"
-#include
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "OmObject.h"
-#include "ObjectStore.h"
-#include "interface/ClientInterface.h"
-#include "ClientBroadcaster.h"
-using std::string;
-
-namespace Om {
-
-
-RequestMetadataEvent::RequestMetadataEvent(CountedPtr responder, const string& node_path, const string& key)
-: QueuedEvent(responder),
- m_path(node_path),
- m_key(key),
- m_value(""),
- m_object(NULL),
- m_client(CountedPtr(NULL))
-{
-}
-
-
-void
-RequestMetadataEvent::pre_process()
-{
- m_client = m_responder->find_client();
-
- if (m_client) {
- m_object = om->object_store()->find(m_path);
- if (m_object == NULL) {
- QueuedEvent::pre_process();
- return;
- }
- }
-
- m_value = m_object->get_metadata(m_key);
-
- QueuedEvent::pre_process();
-}
-
-
-void
-RequestMetadataEvent::post_process()
-{
- if (m_client) {
- if (m_value == "") {
- string msg = "Unable to find object ";
- msg += m_path;
- m_responder->respond_error(msg);
- } else {
- m_responder->respond_ok();
- m_client->metadata_update(m_path, m_key, m_value);
- }
- } else {
- m_responder->respond_error("Unknown client");
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/RequestMetadataEvent.h b/src/engine/RequestMetadataEvent.h
deleted file mode 100644
index e4243eb3..00000000
--- a/src/engine/RequestMetadataEvent.h
+++ /dev/null
@@ -1,56 +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 REQUESTMETADATAEVENT_H
-#define REQUESTMETADATAEVENT_H
-
-#include
-#include "QueuedEvent.h"
-
-using std::string;
-
-namespace Om {
-
-class OmObject;
-namespace Shared {
- class ClientInterface;
-} using Shared::ClientInterface;
-
-
-/** A request from a client for a piece of metadata.
- *
- * \ingroup engine
- */
-class RequestMetadataEvent : public QueuedEvent
-{
-public:
- RequestMetadataEvent(CountedPtr responder, const string& path, const string& key);
-
- void pre_process();
- void post_process();
-
-private:
- string m_path;
- string m_key;
- string m_value;
- OmObject* m_object;
- CountedPtr m_client;
-};
-
-
-} // namespace Om
-
-#endif // REQUESTMETADATAEVENT_H
diff --git a/src/engine/RequestPluginsEvent.cpp b/src/engine/RequestPluginsEvent.cpp
deleted file mode 100644
index 89dbefd5..00000000
--- a/src/engine/RequestPluginsEvent.cpp
+++ /dev/null
@@ -1,55 +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 "RequestPluginsEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "ClientBroadcaster.h"
-
-namespace Om {
-
-
-RequestPluginsEvent::RequestPluginsEvent(CountedPtr responder)
-: QueuedEvent(responder),
- m_client(CountedPtr(NULL))
-{
-}
-
-
-void
-RequestPluginsEvent::pre_process()
-{
- m_client = m_responder->find_client();
-
- QueuedEvent::pre_process();
-}
-
-
-void
-RequestPluginsEvent::post_process()
-{
- if (m_client) {
- om->client_broadcaster()->send_plugins_to(m_client.get());
- m_responder->respond_ok();
- } else {
- m_responder->respond_error("Invalid URL");
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/RequestPluginsEvent.h b/src/engine/RequestPluginsEvent.h
deleted file mode 100644
index 83447fb3..00000000
--- a/src/engine/RequestPluginsEvent.h
+++ /dev/null
@@ -1,51 +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 REQUESTPLUGINSEVENT_H
-#define REQUESTPLUGINSEVENT_H
-
-#include
-#include "QueuedEvent.h"
-using std::string;
-
-namespace Om {
-
-class Responder;
-namespace Shared {
- class ClientInterface;
-} using Shared::ClientInterface;
-
-
-/** A request from a client to send notification of all objects (ie refresh).
- *
- * \ingroup engine
- */
-class RequestPluginsEvent : public QueuedEvent
-{
-public:
- RequestPluginsEvent(CountedPtr responder);
-
- void pre_process();
- void post_process();
-
-private:
- CountedPtr m_client;
-};
-
-
-} // namespace Om
-
-#endif // REQUESTPLUGINSEVENT_H
diff --git a/src/engine/RequestPortValueEvent.cpp b/src/engine/RequestPortValueEvent.cpp
deleted file mode 100644
index e4d3985e..00000000
--- a/src/engine/RequestPortValueEvent.cpp
+++ /dev/null
@@ -1,81 +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 "RequestPortValueEvent.h"
-#include
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "interface/ClientInterface.h"
-#include "PortBase.h"
-#include "PortInfo.h"
-#include "ObjectStore.h"
-#include "ClientBroadcaster.h"
-
-using std::string;
-
-namespace Om {
-
-
-RequestPortValueEvent::RequestPortValueEvent(CountedPtr responder, const string& port_path)
-: QueuedEvent(responder),
- m_port_path(port_path),
- m_port(NULL),
- m_value(0.0),
- m_client(CountedPtr(NULL))
-{
-}
-
-
-void
-RequestPortValueEvent::pre_process()
-{
- m_client = m_responder->find_client();
- m_port = om->object_store()->find_port(m_port_path);
-
- QueuedEvent::pre_process();
-}
-
-
-void
-RequestPortValueEvent::execute(samplecount offset)
-{
- if (m_port != NULL && m_port->port_info()->is_audio() || m_port->port_info()->is_control())
- m_value = ((PortBase*)m_port)->buffer(0)->value_at(offset);
- else
- m_port = NULL; // triggers error response
-
- QueuedEvent::execute(offset);
-}
-
-
-void
-RequestPortValueEvent::post_process()
-{
- string msg;
- if (m_port) {
- m_responder->respond_error("Unable to find port for get_value responder.");
- } else if (m_client) {
- m_responder->respond_ok();
- m_client->control_change(m_port_path, m_value);
- } else {
- m_responder->respond_error("Invalid URL");
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/RequestPortValueEvent.h b/src/engine/RequestPortValueEvent.h
deleted file mode 100644
index d970ee9c..00000000
--- a/src/engine/RequestPortValueEvent.h
+++ /dev/null
@@ -1,56 +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 REQUESTPORTVALUEEVENT_H
-#define REQUESTPORTVALUEEVENT_H
-
-#include
-#include "QueuedEvent.h"
-#include "util/types.h"
-
-using std::string;
-
-namespace Om {
-
-class Port;
-namespace Shared { class ClientInterface; }
-using Shared::ClientInterface;
-
-
-/** A request from a client to send the value of a port.
- *
- * \ingroup engine
- */
-class RequestPortValueEvent : public QueuedEvent
-{
-public:
- RequestPortValueEvent(CountedPtr responder, const string& port_path);
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- string m_port_path;
- Port* m_port;
- sample m_value;
- CountedPtr m_client;
-};
-
-
-} // namespace Om
-
-#endif // REQUESTPORTVALUEEVENT_H
diff --git a/src/engine/SetMetadataEvent.cpp b/src/engine/SetMetadataEvent.cpp
deleted file mode 100644
index 614f7ca9..00000000
--- a/src/engine/SetMetadataEvent.cpp
+++ /dev/null
@@ -1,79 +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 "SetMetadataEvent.h"
-#include
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "ClientBroadcaster.h"
-#include "OmObject.h"
-#include "ObjectStore.h"
-
-using std::string;
-
-namespace Om {
-
-
-SetMetadataEvent::SetMetadataEvent(CountedPtr responder, const string& path, const string& key, const string& value)
-: QueuedEvent(responder),
- m_path(path),
- m_key(key),
- m_value(value),
- m_object(NULL)
-{
-}
-
-
-void
-SetMetadataEvent::pre_process()
-{
- m_object = om->object_store()->find(m_path);
- if (m_object == NULL) {
- QueuedEvent::pre_process();
- return;
- }
-
- m_object->set_metadata(m_key, m_value);
-
- QueuedEvent::pre_process();
-}
-
-
-void
-SetMetadataEvent::execute(samplecount offset)
-{
- // Do nothing
-
- QueuedEvent::execute(offset);
-}
-
-
-void
-SetMetadataEvent::post_process()
-{
- if (m_object == NULL) {
- string msg = "Unable to find object ";
- msg += m_path;
- m_responder->respond_error(msg);
- } else {
- m_responder->respond_ok();
- om->client_broadcaster()->send_metadata_update(m_path, m_key, m_value);
- }
-}
-
-
-} // namespace Om
diff --git a/src/engine/SetMetadataEvent.h b/src/engine/SetMetadataEvent.h
deleted file mode 100644
index ef471033..00000000
--- a/src/engine/SetMetadataEvent.h
+++ /dev/null
@@ -1,53 +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 SETMETADATAEVENT_H
-#define SETMETADATAEVENT_H
-
-#include
-#include "QueuedEvent.h"
-
-using std::string;
-
-namespace Om {
-
-class OmObject;
-
-
-/** An event to set a piece of metadata for an OmObject.
- *
- * \ingroup engine
- */
-class SetMetadataEvent : public QueuedEvent
-{
-public:
- SetMetadataEvent(CountedPtr responder, const string& path, const string& key, const string& value);
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- string m_path;
- string m_key;
- string m_value;
- OmObject* m_object;
-};
-
-
-} // namespace Om
-
-#endif // SETMETADATAEVENT_H
diff --git a/src/engine/SetPortValueEvent.cpp b/src/engine/SetPortValueEvent.cpp
deleted file mode 100644
index 964cd9ca..00000000
--- a/src/engine/SetPortValueEvent.cpp
+++ /dev/null
@@ -1,104 +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 "SetPortValueEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "PortBase.h"
-#include "PortInfo.h"
-#include "ClientBroadcaster.h"
-#include "Node.h"
-#include "ObjectStore.h"
-
-namespace Om {
-
-
-/** Voice-specific control setting
- */
-SetPortValueEvent::SetPortValueEvent(CountedPtr responder, size_t voice_num, const string& port_path, sample val)
-: Event(responder),
- m_voice_num(voice_num),
- m_port_path(port_path),
- m_val(val),
- m_port(NULL),
- m_error(NO_ERROR)
-{
-}
-
-
-SetPortValueEvent::SetPortValueEvent(CountedPtr responder, const string& port_path, sample val)
-: Event(responder),
- m_voice_num(-1),
- m_port_path(port_path),
- m_val(val),
- m_port(NULL),
- m_error(NO_ERROR)
-{
-}
-
-
-void
-SetPortValueEvent::execute(samplecount offset)
-{
- if (m_port == NULL)
- m_port = om->object_store()->find_port(m_port_path);
-
- if (m_port == NULL) {
- m_error = PORT_NOT_FOUND;
- } else if (!m_port->port_info()->is_audio() && !m_port->port_info()->is_control()) {
- m_error = TYPE_MISMATCH;
- } else {
- if (m_voice_num == -1)
- ((PortBase*)m_port)->set_value(m_val, offset);
- else
- ((PortBase*)m_port)->set_value(m_voice_num, m_val, offset);
- //((PortBase*)m_port)->buffer(m_voice_num)->set(m_val, offset); // FIXME: check range
- }
-}
-
-
-void
-SetPortValueEvent::post_process()
-{
- if (m_error == NO_ERROR) {
- assert(m_port != NULL);
-
- m_responder->respond_ok();
- 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();
- if (parent_port != NULL) {
- assert(parent_port->port_info()->is_control() || parent_port->port_info()->is_audio());
- om->client_broadcaster()->send_control_change(parent_port->path(), m_val);
- }
-
- } else if (m_error == PORT_NOT_FOUND) {
- string msg = "Unable to find port ";
- msg.append(m_port_path).append(" for set_port_value");
- m_responder->respond_error(msg);
-
- } else if (m_error == TYPE_MISMATCH) {
- string msg = "Attempt to set ";
- msg.append(m_port_path).append(" to incompatible type");
- m_responder->respond_error(msg);
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/SetPortValueEvent.h b/src/engine/SetPortValueEvent.h
deleted file mode 100644
index 0a9614b9..00000000
--- a/src/engine/SetPortValueEvent.h
+++ /dev/null
@@ -1,56 +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 SETPORTVALUEEVENT_H
-#define SETPORTVALUEEVENT_H
-
-#include
-#include "Event.h"
-#include "util/types.h"
-using std::string;
-
-namespace Om {
-
-class Port;
-
-
-/** An event to change the value of a port.
- *
- * \ingroup engine
- */
-class SetPortValueEvent : public Event
-{
-public:
- SetPortValueEvent(CountedPtr responder, const string& port_path, sample val);
- SetPortValueEvent(CountedPtr responder, size_t voice_num, const string& port_path, sample val);
-
- void execute(samplecount offset);
- void post_process();
-
-private:
- enum ErrorType { NO_ERROR, PORT_NOT_FOUND, TYPE_MISMATCH };
-
- int m_voice_num;
- string m_port_path;
- float m_val;
- Port* m_port;
- ErrorType m_error;
-};
-
-
-} // namespace Om
-
-#endif // SETPORTVALUEEVENT_H
diff --git a/src/engine/SetPortValueQueuedEvent.cpp b/src/engine/SetPortValueQueuedEvent.cpp
deleted file mode 100644
index e73c0486..00000000
--- a/src/engine/SetPortValueQueuedEvent.cpp
+++ /dev/null
@@ -1,116 +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 "SetPortValueQueuedEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "PortBase.h"
-#include "PortInfo.h"
-#include "ClientBroadcaster.h"
-#include "Plugin.h"
-#include "Node.h"
-#include "ObjectStore.h"
-
-namespace Om {
-
-
-/** Voice-specific control setting
- */
-SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr responder, size_t voice_num, const string& port_path, sample val)
-: QueuedEvent(responder),
- m_voice_num(voice_num),
- m_port_path(port_path),
- m_val(val),
- m_port(NULL),
- m_error(NO_ERROR)
-{
-}
-
-
-SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr responder, const string& port_path, sample val)
-: QueuedEvent(responder),
- m_voice_num(-1),
- m_port_path(port_path),
- m_val(val),
- m_port(NULL),
- m_error(NO_ERROR)
-{
-}
-
-
-void
-SetPortValueQueuedEvent::pre_process()
-{
- if (m_port == NULL)
- m_port = om->object_store()->find_port(m_port_path);
-
- if (m_port == NULL) {
- m_error = PORT_NOT_FOUND;
- } else if (!m_port->port_info()->is_audio() && !m_port->port_info()->is_control()) {
- m_error = TYPE_MISMATCH;
- }
-
- QueuedEvent::pre_process();
-}
-
-
-void
-SetPortValueQueuedEvent::execute(samplecount offset)
-{
- QueuedEvent::execute(offset);
-
- if (m_error == NO_ERROR) {
- assert(m_port != NULL);
- if (m_voice_num == -1)
- ((PortBase*)m_port)->set_value(m_val, offset);
- else
- ((PortBase*)m_port)->buffer(m_voice_num)->set(m_val, offset); // FIXME: check range
- }
-}
-
-
-void
-SetPortValueQueuedEvent::post_process()
-{
- if (m_error == NO_ERROR) {
- assert(m_port != NULL);
-
- m_responder->respond_ok();
- 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();
- if (parent_port != NULL) {
- assert(parent_port->port_info()->is_control() || parent_port->port_info()->is_audio());
- om->client_broadcaster()->send_control_change(parent_port->path(), m_val);
- }
-
- } else if (m_error == PORT_NOT_FOUND) {
- string msg = "Unable to find port ";
- msg.append(m_port_path).append(" for set_port_value_slow");
- m_responder->respond_error(msg);
-
- } else if (m_error == TYPE_MISMATCH) {
- string msg = "Attempt to set ";
- msg.append(m_port_path).append(" to incompatible type");
- m_responder->respond_error(msg);
- }
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/SetPortValueQueuedEvent.h b/src/engine/SetPortValueQueuedEvent.h
deleted file mode 100644
index b92beacf..00000000
--- a/src/engine/SetPortValueQueuedEvent.h
+++ /dev/null
@@ -1,57 +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 SETPORTVALUEQUEUEDEVENT_H
-#define SETPORTVALUEQUEUEDEVENT_H
-
-#include "QueuedEvent.h"
-#include "util/types.h"
-#include
-using std::string;
-
-namespace Om {
-
-class Port;
-
-
-/** An event to change the value of a port.
- *
- * \ingroup engine
- */
-class SetPortValueQueuedEvent : public QueuedEvent
-{
-public:
- SetPortValueQueuedEvent(CountedPtr responder, const string& port_path, sample val);
- SetPortValueQueuedEvent(CountedPtr responder, size_t voice_num, const string& port_path, sample val);
-
- void pre_process();
- void execute(samplecount offset);
- void post_process();
-
-private:
- enum ErrorType { NO_ERROR, PORT_NOT_FOUND, TYPE_MISMATCH };
-
- int m_voice_num;
- string m_port_path;
- float m_val;
- Port* m_port;
- ErrorType m_error;
-};
-
-
-} // namespace Om
-
-#endif // SETPORTVALUEQUEUEDEVENT_H
diff --git a/src/engine/UnregisterClientEvent.cpp b/src/engine/UnregisterClientEvent.cpp
deleted file mode 100644
index ef5a9979..00000000
--- a/src/engine/UnregisterClientEvent.cpp
+++ /dev/null
@@ -1,45 +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 "UnregisterClientEvent.h"
-#include "Responder.h"
-#include "Om.h"
-#include "OmApp.h"
-#include "ClientBroadcaster.h"
-#include "interface/ClientInterface.h"
-
-namespace Om {
-
-
-UnregisterClientEvent::UnregisterClientEvent(CountedPtr responder, ClientKey key)
-: QueuedEvent(responder)
-, _key(key)
-{
-}
-
-
-void
-UnregisterClientEvent::post_process()
-{
- if (om->client_broadcaster()->unregister_client(_key))
- m_responder->respond_ok();
- else
- m_responder->respond_error("Unable to unregister client");
-}
-
-
-} // namespace Om
-
diff --git a/src/engine/UnregisterClientEvent.h b/src/engine/UnregisterClientEvent.h
deleted file mode 100644
index fdbdb314..00000000
--- a/src/engine/UnregisterClientEvent.h
+++ /dev/null
@@ -1,53 +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 UNREGISTERCLIENTEVENT_H
-#define UNREGISTERCLIENTEVENT_H
-
-#include "QueuedEvent.h"
-#include "interface/ClientKey.h"
-#include
-using std::string;
-
-namespace Om {
-
-namespace Shared {
- class ClientInterface;
- class ClientKey;
-}
-using Shared::ClientInterface;
-using Shared::ClientKey;
-
-
-/** Unregisters an OSC client so it no longer receives notifications.
- *
- * \ingroup engine
- */
-class UnregisterClientEvent : public QueuedEvent
-{
-public:
- UnregisterClientEvent(CountedPtr responder, ClientKey key);
-
- void post_process();
-
-private:
- ClientKey _key;
-};
-
-
-} // namespace Om
-
-#endif // UNREGISTERCLIENTEVENT_H
diff --git a/src/engine/bak/OSCSender.cpp b/src/engine/bak/OSCSender.cpp
deleted file mode 100644
index 8347a252..00000000
--- a/src/engine/bak/OSCSender.cpp
+++ /dev/null
@@ -1,736 +0,0 @@
-/* This file is part of Om. Copyright (C) 2005 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 "OSCSender.h"
-#include
-#include
-#include
-#include "Om.h"
-#include "OmApp.h"
-#include "ObjectStore.h"
-#include "NodeFactory.h"
-#include "util.h"
-#include "Patch.h"
-#include "Node.h"
-#include "PortInfo.h"
-#include "Plugin.h"
-#include "PortBase.h"
-#include "Connection.h"
-#include "AudioDriver.h"
-#include "ClientRecord.h"
-#include "OSCResponder.h"
-
-using std::cout; using std::cerr; using std::endl;
-
-namespace Om {
-
-
-/*! \page client_osc_namespace Client OSC Namespace Documentation
- *
- * These are all the messages sent from the engine to the client. Om
- * communication takes place over two distinct bands: control band and
- * notification band.
- * The control band is where clients send commands, and receive a simple
- * response, either OK or an error.
- * All notifications of engine state (ie new nodes) are sent over the
- * notification band which is seperate from the control band. The
- * reasoning behind this is that many clients may be connected at the same
- * time - a client may receive notifications that are not a direct consequence
- * of some message it sent.
- * The notification band can be thought of as a stream of events representing
- * the changing engine state. For example, It is possible for a client to send
- * commands and receive aknowledgements, and not listen to the notification band
- * at all; or (in the near future anyway) for a client to use UDP for the control
- * band (for speed), and TCP for the notification band (for reliability and
- * order guarantees).
- * \n\n
- */
-
-
-/* Documentation for namespace portion implemented in OSCResponder.cpp */
-
-/** \page client_osc_namespace
- * \n
- * Notification Band
- */
-
-/** \page client_osc_namespace
- * \b /om/response/ok - Respond successfully to a user command
- * \arg \b responder-id (int) - OSCResponder ID this is a response to
- *
\n \n
- */
-
-/** \page client_osc_namespace
- * \b /om/response/error - Respond negatively to a user command
- * \arg \b responder-id (int) - OSCResponder ID this is a response to
- * \arg \b message (string) - Error message (natural language text)
- *
\n \n
- */
-
-
-
-/** Register a client to receive messages over the notification band.
- */
-void
-OSCSender::register_client(const string& url)
-{
- bool found = false;
- for (list::iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- if ((*i)->url() == url)
- found = true;
-
- if (!found) {
- ClientRecord* cr = new ClientRecord(url);
- m_clients.push_back(cr);
- cout << "[OSC] Registered client " << url << " (" << m_clients.size() << " clients)" << endl;
- } else {
- cout << "[OSC] Client already registered." << endl;
- }
-}
-
-
-/** Remove a client from the list of registered clients.
- *
- * The removed client is returned (not deleted). It is the caller's
- * responsibility to delete the returned pointer, if it's not NULL.
- *
- * FIXME: Using a "Responder" as the key for client lookups is less than clear.
- */
-ClientRecord*
-OSCSender::unregister_client(const Responder* responder)
-{
- if (responder == NULL)
- return NULL;
-
- // FIXME: remove filthy cast
- const string url = lo_address_get_url(((OSCResponder*)responder)->source());
- ClientRecord* r = NULL;
-
- for (list::iterator i = m_clients.begin(); i != m_clients.end(); ++i) {
- if ((*i)->url() == url) {
- r = *i;
- m_clients.erase(i);
- break;
- }
- }
-
- if (r != NULL)
- cout << "[OSC] Unregistered client " << r->url() << " (" << m_clients.size() << " clients)" << endl;
- else
- cerr << "[OSC] ERROR: Unable to find client to unregister!" << endl;
-
- return r;
-}
-
-
-/** Looks up the client with the given @a source address (which is used as the
- * unique identifier for registered clients).
- *
- * (A responder is passed to remove the dependency on liblo addresses in request
- * events, in anticipation of libom and multiple ways of responding to clients).
- *
- * FIXME: Using a "Responder" as the key for client lookups is less than clear.
- */
-ClientRecord*
-OSCSender::client(const Responder* responder)
-{
- // FIXME: eliminate filthy cast
- const string url = lo_address_get_url(((OSCResponder*)responder)->source());
-
- for (list::iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- if ((*i)->url() == url)
- return (*i);
-
- return NULL;
-}
-
-/** \page client_osc_namespace
- * \n
- * Notification Band
- */
-
-/** \page client_osc_namespace
- * \b /om/client_registration - Notification that a new client has registered
- * \arg \b url (string) - URL notifications will be sent to
- * \arg \b client-id (int) - Client ID for new client
- *
- * \li This will be the first message received over the notification band by a newly
- * registered client.
\n \n
- */
-/*void
-OSCSender::send_client_registration(const string& url, int client_id)
-{
-// FIXME
-}*/
-
-
-/** \page client_osc_namespace
- * \b /om/error - Notification that an error has occurred
- * \arg \b message (string) - Error message (natural language text)
- *
- * \li This is for notification of errors that aren't a direct response to a
- * user command, ie "unexpected" errors.
\n \n
- */
-void
-OSCSender::send_error(const string& msg)
-{
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- lo_send((*i)->address(), "/om/error", "s", msg.c_str());
-}
-
-
-/** \page client_osc_namespace
- * \b /om/num_plugins
- * \arg \b num (int) - Number of plugins engine has loaded
- * \li This is sent before sending the list of plugins, so the client is aware
- * of how many plugins (/om/plugin messages) to expect.
\n \n
- */
-
-
-/** \page client_osc_namespace
- * \b /om/plugin - Notification of the existance of a plugin
- * FIXME: update docs
- * \arg \b lib-name (string) - Name of shared library plugin resides in (ie "cmt.so")
- * \arg \b plug-label (string) - Label of the plugin (ie "dahdsr_iaoa")
- * \arg \b name (string) - Descriptive human-readable name of plugin (ie "ADSR Envelope")
- * \arg \b type (string) - Type if plugin ("LADSPA", "DSSI", or "Internal")
\n \n
- */
-void
-OSCSender::send_plugins_to(ClientRecord* client)
-{
- om->node_factory()->lock_plugin_list();
-
- const list& plugs = om->node_factory()->plugins();
- const Plugin* plugin;
-
- lo_timetag tt;
- lo_timetag_now(&tt);
- lo_bundle b = lo_bundle_new(tt);
- lo_message m = lo_message_new();
- list msgs;
-
- lo_message_add_int32(m, plugs.size());
- lo_bundle_add_message(b, "/om/num_plugins", m);
- msgs.push_back(m);
-
- for (list::const_iterator j = plugs.begin(); j != plugs.end(); ++j) {
- plugin = (*j);
- m = lo_message_new();
-
- /*lo_message_add_string(m, plugin->lib_name().c_str());
- lo_message_add_string(m, plugin->plug_label().c_str());*/
- lo_message_add_string(m, plugin->type_string());
- lo_message_add_string(m, plugin->uri().c_str());
- lo_message_add_string(m, plugin->plug_label().c_str());
- lo_message_add_string(m, plugin->name().c_str());
- lo_bundle_add_message(b, "/om/plugin", m);
- msgs.push_back(m);
- if (lo_bundle_length(b) > 1024) {
- lo_send_bundle(client->address(), b);
- lo_bundle_free(b);
- b = lo_bundle_new(tt);
- //usleep(100); // plugins get lost in the ether without this :/ (?)
- }
- }
-
- if (lo_bundle_length(b) > 0) {
- lo_send_bundle(client->address(), b);
- lo_bundle_free(b);
- } else {
- lo_bundle_free(b);
- }
- for (list::const_iterator i = msgs.begin(); i != msgs.end(); ++i)
- lo_message_free(*i);
-
- om->node_factory()->unlock_plugin_list();
-}
-
-
-void
-OSCSender::send_node(const Node* const node)
-{
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- send_node_to((*i), node);
-}
-
-
-void
-OSCSender::send_new_port(const Port* port)
-{
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- send_new_port_to((*i), port);
-}
-
-
-void
-OSCSender::send_destroyed(const string& path)
-{
- assert(path != "/");
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- send_destroyed_to((*i), path);
-}
-
-void
-OSCSender::send_patch_cleared(const string& patch_path)
-{
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- send_patch_cleared_to((*i), patch_path);
-}
-
-void
-OSCSender::send_connection(const Connection* const c)
-{
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- send_connection_to((*i), c);
-}
-
-
-void
-OSCSender::send_disconnection(const string& src_port_path, const string& dst_port_path)
-{
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- send_disconnection_to((*i), src_port_path, dst_port_path);
-}
-
-
-void
-OSCSender::send_patch_enable(const string& patch_path)
-{
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- send_patch_enable_to((*i), patch_path);
-}
-
-
-void
-OSCSender::send_patch_disable(const string& patch_path)
-{
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- send_patch_disable_to((*i), patch_path);
-}
-
-
-/** Send notification of a metadata update.
- *
- * Like control changes, does not send update to client that set the metadata, if applicable.
- */
-void
-OSCSender::send_metadata_update(const string& node_path, const string& key, const string& value)
-{
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- send_metadata_update_to((*i), node_path, key, value);
-}
-
-
-/** Send notification of a control change.
- *
- * If responder is specified, the notification will not be send to the address of
- * that responder (to avoid sending redundant information back to clients and
- * forcing clients to ignore things to avoid feedback loops etc).
- */
-void
-OSCSender::send_control_change(const string& port_path, float value)
-{
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- send_control_change_to((*i), port_path, value);
-}
-
-
-void
-OSCSender::send_program_add(const string& node_path, int bank, int program, const string& name)
-{
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- send_program_add_to((*i), node_path, bank, program, name);
-}
-
-
-void
-OSCSender::send_program_remove(const string& node_path, int bank, int program)
-{
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- send_program_remove_to((*i), node_path, bank, program);
-}
-
-
-/** Send a patch.
- *
- * Sends all objects underneath Patch - contained Nodes, etc.
- */
-void
-OSCSender::send_patch(const Patch* const p)
-{
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- send_patch_to((*i), p);
-}
-
-
-/** Sends notification of an OmObject's renaming
- */
-void
-OSCSender::send_rename(const string& old_path, const string& new_path)
-{
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- send_rename_to((*i), old_path, new_path);
-}
-
-
-/** Sends all OmObjects known to the engine.
- */
-void
-OSCSender::send_all_objects()
-{
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- send_all_objects_to((*i));
-}
-
-
-void
-OSCSender::send_node_creation_messages(const Node* const node)
-{
- // This is pretty stupid :/ in and out and back again!
- for (list::const_iterator i = m_clients.begin(); i != m_clients.end(); ++i)
- node->send_creation_messages((*i));
-}
-
-
-//
-// SINGLE DESTINATION VERSIONS
-//
-
-
-/** \page client_osc_namespace
- * \b /om/new_node - Notification of a new node's creation.
- * \arg \b path (string) - Path of the new node
- * \arg \b polyphonic (integer-boolean) - Node is polyphonic (1 = yes, 0 = no)
- * \arg \b type (string) - Type of plugin (LADSPA, DSSI, Internal, Patch)
- * \arg \b lib-name (string) - Name of library if a plugin (ie cmt.so)
- * \arg \b plug-label (string) - Label of plugin in library (ie adsr_env)
- *
- * \li New nodes are sent as a bundle. The first message in the bundle will be
- * this one (/om/new_node), followed by a series of /om/new_port commands,
- * followed by /om/new_node_end.
\n \n
- */
-void
-OSCSender::send_node_to(ClientRecord* client, const Node* const node)
-{
- assert(client != NULL);
-
- lo_timetag tt;
- lo_timetag_now(&tt);
- lo_bundle b = lo_bundle_new(tt);
- lo_message m = lo_message_new();
- list msgs;
-
- lo_message_add_string(m, node->path().c_str());
- lo_message_add_int32(m,
- (node->poly() > 1
- && node->poly() == node->parent_patch()->internal_poly()
- ? 1 : 0));
-
- lo_message_add_string(m, node->plugin()->type_string());
- lo_message_add_string(m, node->plugin()->uri().c_str());
- /*lo_message_add_string(m, node->plugin()->lib_name().c_str());
- lo_message_add_string(m, node->plugin()->plug_label().c_str());*/
- lo_bundle_add_message(b, "/om/new_node", m);
- msgs.push_back(m);
-
- const Array& ports = node->ports();
- Port* port;
- PortInfo* info;
- for (size_t j=0; j < ports.size(); ++j) {
- port = ports.at(j);
- info = port->port_info();
-
- assert(port != NULL);
- assert(info != NULL);
-
- m = lo_message_new();
- lo_message_add_string(m, port->path().c_str());
- lo_message_add_string(m, info->type_string().c_str());
- lo_message_add_string(m, info->direction_string().c_str());
- lo_message_add_string(m, info->hint_string().c_str());
- lo_message_add_float(m, info->default_val());
- lo_message_add_float(m, info->min_val());
- lo_message_add_float(m, info->max_val());
- lo_bundle_add_message(b, "/om/new_port", m);
- msgs.push_back(m);
-
- // If the bundle is getting very large, send it and start
- // a new one
- if (lo_bundle_length(b) > 1024) {
- lo_send_bundle(client->address(), b);
- lo_bundle_free(b);
- b = lo_bundle_new(tt);
- }
- }
-
- m = lo_message_new();
- lo_bundle_add_message(b, "/om/new_node_end", m);
- msgs.push_back(m);
-
- lo_send_bundle(client->address(), b);
- lo_bundle_free(b);
-
- for (list::const_iterator i = msgs.begin(); i != msgs.end(); ++i)
- lo_message_free(*i);
-
- usleep(100);
-
- const map& data = node->metadata();
- // Send node metadata
- for (map::const_iterator i = data.begin(); i != data.end(); ++i)
- send_metadata_update_to(client, node->path(), (*i).first, (*i).second);
-
- // Send port metadata
- for (size_t j=0; j < ports.size(); ++j) {
- port = ports.at(j);
- const map& data = port->metadata();
- for (map::const_iterator i = data.begin(); i != data.end(); ++i)
- send_metadata_update_to(client, port->path(), (*i).first, (*i).second);
- }
-
- // Send control values
- for (size_t i=0; i < node->ports().size(); ++i) {
- PortBase* port = (PortBase*)node->ports().at(i);
- if (port->port_info()->is_input() && port->port_info()->is_control())
- send_control_change_to(client, port->path(), port->buffer(0)->value_at(0));
- }
-}
-
-
-
-/** \page client_osc_namespace
- * \b /om/new_port - Notification of a new port's creation.
- * \arg \b path (string) - Path of new port
- * \arg \b data-type (string) - Type of port (CONTROL or AUDIO)
- * \arg \b direction (string) - Direction of data flow (INPUT or OUTPUT)
- * \arg \b hint (string) - Hint (INTEGER, LOGARITHMIC, TOGGLE, or NONE)
- * \arg \b default-value (float) - Default (initial) value
- * \arg \b min-value (float) - Suggested minimum value
- * \arg \b min-value (float) - Suggested maximum value
- *
- * \li Note that in the event of loading a patch, this message could be
- * followed immediately by a control change, meaning the default-value is
- * not actually the current value of the port.
- * \li The minimum and maximum values are suggestions only, they are not
- * enforced in any way, and going outside them is perfectly fine. Also note
- * that the port ranges in om_gtk are not these ones! Those ranges are set
- * as metadata.
\n \n
- */
-void
-OSCSender::send_new_port_to(ClientRecord* client, const Port* port)
-{
- assert(client != NULL);
-
- PortInfo* info = port->port_info();
-
- lo_send(client->address(), "/om/new_port", "ssssfff",
- port->path().c_str(), info->type_string().c_str(), info->direction_string().c_str(),
- info->hint_string().c_str(), info->default_val(), info->min_val(), info->max_val());
-
- // Send metadata
- const map& data = port->metadata();
- for (map::const_iterator i = data.begin(); i != data.end(); ++i)
- send_metadata_update_to(client, port->path(), (*i).first, (*i).second);
-}
-
-
-/** \page client_osc_namespace
- * \b /om/destroyed - Notification an object has been destroyed
- * \arg \b path (string) - Path of object (which no longer exists)
\n \n
- */
-void
-OSCSender::send_destroyed_to(ClientRecord* client, const string& path)
-{
- assert(client != NULL);
- assert(path != "/");
-
- lo_send(client->address(), "/om/destroyed", "s", path.c_str());
-}
-
-
-/** \page client_osc_namespace
- * \b /om/patch_cleared - Notification a patch has been cleared (all children destroyed)
- * \arg \b path (string) - Path of patch (which is now empty)
\n \n
- */
-void
-OSCSender::send_patch_cleared_to(ClientRecord* client, const string& patch_path)
-{
- assert(client != NULL);
-
- lo_send(client->address(), "/om/patch_cleared", "s", patch_path.c_str());
-}
-
-
-/** \page client_osc_namespace
- * \b /om/patch_enabled - Notification a patch's DSP processing has been enabled.
- * \arg \b path (string) - Path of enabled patch
\n \n
- */
-void
-OSCSender::send_patch_enable_to(ClientRecord* client, const string& patch_path)
-{
- assert(client != NULL);
-
- lo_send(client->address(), "/om/patch_enabled", "s", patch_path.c_str());
-}
-
-
-/** \page client_osc_namespace
- * \b /om/patch_disabled - Notification a patch's DSP processing has been disabled.
- * \arg \b path (string) - Path of disabled patch
\n \n
- */
-void
-OSCSender::send_patch_disable_to(ClientRecord* client, const string& patch_path)
-{
- assert(client != NULL);
-
- lo_send(client->address(), "/om/patch_disabled", "s", patch_path.c_str());
-}
-
-
-/** \page client_osc_namespace
- * \b /om/new_connection - Notification a new connection has been made.
- * \arg \b src-path (string) - Path of the source port
- * \arg \b dst-path (string) - Path of the destination port
\n \n
- */
-void
-OSCSender::send_connection_to(ClientRecord* client, const Connection* const c)
-{
- assert(client != NULL);
-
- lo_send(client->address(), "/om/new_connection", "ss", c->src_port()->path().c_str(), c->dst_port()->path().c_str());
-}
-
-
-/** \page client_osc_namespace
- * \b /om/disconnection - Notification a connection has been unmade.
- * \arg \b src-path (string) - Path of the source port
- * \arg \b dst-path (string) - Path of the destination port
\n \n
- */
-void
-OSCSender::send_disconnection_to(ClientRecord* client, const string& src_port_path, const string& dst_port_path)
-{
- assert(client != NULL);
-
- lo_send(client->address(), "/om/disconnection", "ss", src_port_path.c_str(), dst_port_path.c_str());
-}
-
-
-/** \page client_osc_namespace
- * \b /om/metadata/update - Notification of a piece of metadata.
- * \arg \b path (string) - Path of the object associated with metadata (can be a node, patch, or port)
- * \arg \b key (string)
- * \arg \b value (string)
\n \n
- */
-void
-OSCSender::send_metadata_update_to(ClientRecord* client, const string& path, const string& key, const string& value)
-{
- assert(client != NULL);
-
- lo_send(client->address(), "/om/metadata/update", "sss", path.c_str(), key.c_str(), value.c_str());
-}
-
-
-/** \page client_osc_namespace
- * \b /om/control_change - Notification the value of a port has changed
- * \arg \b path (string) - Path of port
- * \arg \b value (float) - New value of port
- *
- * \li This will only send updates for values set by clients of course - not values
- * changing because of connections to other ports!
\n \n
- */
-void
-OSCSender::send_control_change_to(ClientRecord* client, const string& port_path, float value)
-{
- assert(client != NULL);
-
- lo_send(client->address(), "/om/control_change", "sf", port_path.c_str(), value);
-}
-
-
-/** \page client_osc_namespace
- * \b /om/new_patch - Notification of a new patch
- * \arg \b path (string) - Path of new patch
- * \arg \b poly (int) - Polyphony of new patch (\em not a boolean like new_node)
\n \n
- */
-void
-OSCSender::send_patch_to(ClientRecord* client, const Patch* const p)
-{
- assert(client != NULL);
-
- lo_send(client->address(), "/om/new_patch", "si", p->path().c_str(), p->internal_poly());
-
- if (p->process())
- send_patch_enable_to(client, p->path());
-
- // Send metadata
- const map& data = p->metadata();
- for (map::const_iterator i = data.begin(); i != data.end(); ++i) {
- send_metadata_update_to(client, p->path(), (*i).first, (*i).second);
- }
-}
-
-
-/** \page client_osc_namespace
- * \b /om/object_renamed - Notification of an object's renaming
- * \arg \b old-path (string) - Old path of object
- * \arg \b new-path (string) - New path of object
\n \n
- */
-void
-OSCSender::send_rename_to(ClientRecord* client, const string& old_path, const string& new_path)
-{
- assert(client != NULL);
-
- lo_send(client->address(), "/om/object_renamed", "ss", old_path.c_str(), new_path.c_str());
-}
-
-
-/** Sends all OmObjects known to the engine.
- */
-void
-OSCSender::send_all_objects_to(ClientRecord* client)
-{
- assert(client != NULL);
-
- for (Tree::iterator i = om->object_store()->objects().begin();
- i != om->object_store()->objects().end(); ++i)
- if ((*i)->as_node() != NULL && (*i)->parent() == NULL)
- (*i)->as_node()->send_creation_messages(client);
-}
-
-
-/** Sends information about a program associated with a DSSI plugin node.
- */
-void
-OSCSender::send_program_add_to(ClientRecord* client, const string& node_path, int bank, int program, const string& name)
-{
- assert(client != NULL);
-
- lo_send(client->address(), "/om/program_add", "siis",
- node_path.c_str(), bank, program, name.c_str());
-}
-
-
-void
-OSCSender::send_program_remove_to(ClientRecord* client, const string& node_path, int bank, int program)
-{
- assert(client != NULL);
-
- lo_send(client->address(), "/om/program_remove", "sii",
- node_path.c_str(), bank, program);
-}
-
-
-} // namespace Om
diff --git a/src/engine/bak/OSCSender.h b/src/engine/bak/OSCSender.h
deleted file mode 100644
index 1410bfa4..00000000
--- a/src/engine/bak/OSCSender.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* This file is part of Om. Copyright (C) 2005 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 OSCSENDER_H
-#define OSCSENDER_H
-
-#include
-#include
-#include
-#include
-#include
-#include "util/types.h"
-
-using std::list; using std::string;
-
-namespace Om {
-
-class Node;
-class Port;
-class PortInfo;
-class Plugin;
-class Patch;
-class Connection;
-class ClientRecord;
-class Responder;
-
-
-/** Sends OSC messages (for two-way communication with client)
- *
- * \ingroup engine
- */
-class OSCSender
-{
-public:
- void register_client(const string& url);
- ClientRecord* unregister_client(const Responder* responder);
- ClientRecord* client(const Responder* responder);
-
- // Notification band:
-
- //void send_client_registration(const string& url, int client_id);
-
- // Error that isn't the direct result of a request
- void send_error(const string& msg);
-
- void send_plugins_to(ClientRecord* client);
-
- void send_node_creation_messages(const Node* const node);
-
- // These versions send to all clients, using single client versions below
- void send_patch(const Patch* const p);
- void send_new_port(const Port* port);
- void send_node(const Node* const node);
- void send_destroyed(const string& path);
- void send_patch_cleared(const string& patch_path);
- void send_connection(const Connection* const connection);
- void send_disconnection(const string& src_port_path, const string& dst_port_path);
- void send_rename(const string& old_path, const string& new_path);
- void send_all_objects();
- void send_patch_enable(const string& patch_path);
- void send_patch_disable(const string& patch_path);
- void send_metadata_update(const string& node_path, const string& key, const string& value);
- void send_control_change(const string& port_path, float value);
- void send_program_add(const string& node_path, int bank, int program, const string& name);
- void send_program_remove(const string& node_path, int bank, int program);
-
-
- // These versions send to passed address
- void send_patch_to(ClientRecord* client, const Patch* const p);
- void send_new_port_to(ClientRecord* client, const Port* port);
- void send_node_to(ClientRecord* client, const Node* const node);
- void send_destroyed_to(ClientRecord* client, const string& path);
- void send_patch_cleared_to(ClientRecord* client, const string& patch_path);
- void send_connection_to(ClientRecord* client, const Connection* const connection);
- void send_disconnection_to(ClientRecord* client, const string& src_port_path, const string& dst_port_path);
- void send_rename_to(ClientRecord* client, const string& old_path, const string& new_path);
- void send_all_objects_to(ClientRecord* client);
- void send_patch_enable_to(ClientRecord* client, const string& patch_path);
- void send_patch_disable_to(ClientRecord* client, const string& patch_path);
- void send_metadata_update_to(ClientRecord* client, const string& node_path, const string& key, const string& value);
- void send_control_change_to(ClientRecord* client, const string& port_path, float value);
- void send_program_add_to(ClientRecord* client, const string& node_path, int bank, int program, const string& name);
- void send_program_remove_to(ClientRecord* client, const string& node_path, int bank, int program);
-
-private:
- list m_clients;
-};
-
-
-} // namespace Om
-
-#endif // OSCSENDER_H
diff --git a/src/engine/bak/Responder.cpp b/src/engine/bak/Responder.cpp
deleted file mode 100644
index a01c0790..00000000
--- a/src/engine/bak/Responder.cpp
+++ /dev/null
@@ -1,60 +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 "Responder.h"
-#include
-#include "ClientBroadcaster.h"
-
-namespace Om {
-
-// FIXME FIXME FIXME this is all reeeeally baaaaaadddd
-// Need an abstract interface for control band
-
-
-void
-Responder::respond_ok()
-{
- assert(_key.type() == ClientKey::OSC);
- lo_address source = lo_address_new_from_url(_key.source_url());
-
- if (source != NULL) {
- if (lo_send(source, "/om/response/ok", "i", _id) < 0) {
- cerr << "Unable to send response " << _id << "! ("
- << lo_address_errstr(source) << ")" << endl;
- }
- }
-
- lo_address_free(source);
-}
-
-
-void
-Responder::respond_error(const string& msg)
-{
- assert(_key.type() == ClientKey::OSC);
- lo_address source = lo_address_new_from_url(_key.source_url());
-
- if (source != NULL) {
- if (lo_send(source, "/om/response/error", "is",_id, msg.c_str()) < 0) {
- cerr << "Unable to send response " << _id << "! ("
- << lo_address_errstr(source) << endl;
- }
- }
- lo_address_free(source);
-}
-
-} // namespace OM
-
diff --git a/src/engine/events/ActivateEvent.cpp b/src/engine/events/ActivateEvent.cpp
new file mode 100644
index 00000000..671b26d5
--- /dev/null
+++ b/src/engine/events/ActivateEvent.cpp
@@ -0,0 +1,52 @@
+/* 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 "ActivateEvent.h"
+#include "Responder.h"
+#include "Om.h"
+#include "OmApp.h"
+
+namespace Om {
+
+
+ActivateEvent::ActivateEvent(CountedPtr responder)
+: QueuedEvent(responder)
+{
+}
+
+
+void
+ActivateEvent::pre_process()
+{
+ QueuedEvent::pre_process();
+
+ if (om != NULL)
+ om->activate();
+}
+
+
+void
+ActivateEvent::post_process()
+{
+ if (om != NULL)
+ m_responder->respond_ok();
+ else
+ m_responder->respond_error("Not ready to activate yet.");
+}
+
+
+} // namespace Om
+
diff --git a/src/engine/events/ActivateEvent.h b/src/engine/events/ActivateEvent.h
new file mode 100644
index 00000000..280b5523
--- /dev/null
+++ b/src/engine/events/ActivateEvent.h
@@ -0,0 +1,41 @@
+/* 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 ACTIVATEEVENT_H
+#define ACTIVATEEVENT_H
+
+#include "QueuedEvent.h"
+
+namespace Om {
+
+
+/** Activates the engine.
+ *
+ * \ingroup engine
+ */
+class ActivateEvent : public QueuedEvent
+{
+public:
+ ActivateEvent(CountedPtr responder);
+
+ void pre_process();
+ void post_process();
+};
+
+
+} // namespace Om
+
+#endif // ACTIVATEEVENT_H
diff --git a/src/engine/events/AddNodeEvent.cpp b/src/engine/events/AddNodeEvent.cpp
new file mode 100644
index 00000000..2b31ef4a
--- /dev/null
+++ b/src/engine/events/AddNodeEvent.cpp
@@ -0,0 +1,128 @@
+/* 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 "AddNodeEvent.h"
+#include "Responder.h"
+#include "Patch.h"
+#include "Node.h"
+#include "Tree.h"
+#include "Plugin.h"
+#include "Om.h"
+#include "OmApp.h"
+#include "Patch.h"
+#include "NodeFactory.h"
+#include "ClientBroadcaster.h"
+#include "Maid.h"
+#include "util/Path.h"
+#include "ObjectStore.h"
+#include "util/Path.h"
+#include "Port.h"
+
+namespace Om {
+
+
+AddNodeEvent::AddNodeEvent(CountedPtr responder, const string& path, Plugin* plugin, bool poly)
+: QueuedEvent(responder),
+ m_path(path),
+ m_plugin(plugin),
+ m_poly(poly),
+ m_patch(NULL),
+ m_node(NULL),
+ m_process_order(NULL),
+ m_node_already_exists(false)
+{
+}
+
+
+AddNodeEvent::~AddNodeEvent()
+{
+ delete m_plugin;
+}
+
+
+void
+AddNodeEvent::pre_process()
+{
+ if (om->object_store()->find(m_path) != NULL) {
+ m_node_already_exists = true;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ m_patch = om->object_store()->find_patch(m_path.parent());
+
+ if (m_patch != NULL) {
+ if (m_poly)
+ m_node = om->node_factory()->load_plugin(m_plugin, m_path.name(), m_patch->internal_poly(), m_patch);
+ else
+ m_node = om->node_factory()->load_plugin(m_plugin, m_path.name(), 1, m_patch);
+
+ if (m_node != NULL) {
+ m_node->activate();
+
+ // This can be done here because the audio thread doesn't touch the
+ // node tree - just the process order array
+ m_patch->add_node(new ListNode(m_node));
+ m_node->add_to_store();
+
+ if (m_patch->process())
+ m_process_order = m_patch->build_process_order();
+ }
+ }
+ QueuedEvent::pre_process();
+}
+
+
+void
+AddNodeEvent::execute(samplecount offset)
+{
+ QueuedEvent::execute(offset);
+
+ if (m_node != NULL) {
+ m_node->add_to_patch();
+
+ if (m_patch->process_order() != NULL)
+ om->maid()->push(m_patch->process_order());
+ m_patch->process_order(m_process_order);
+ }
+}
+
+
+void
+AddNodeEvent::post_process()
+{
+ string msg;
+ if (m_node_already_exists) {
+ msg = string("Could not create node - ").append(m_path);// + " already exists.";
+ m_responder->respond_error(msg);
+ } else if (m_patch == NULL) {
+ msg = "Could not find patch '" + m_path.parent() +"' for add_node.";
+ m_responder->respond_error(msg);
+ } else if (m_node == NULL) {
+ msg = "Unable to load node ";
+ msg.append(m_path).append(" (you're missing the plugin \"").append(
+ m_plugin->lib_name()).append(":").append(m_plugin->plug_label()).append("\")");;
+ m_responder->respond_error(msg);
+ } else {
+ m_responder->respond_ok();
+ //om->client_broadcaster()->send_node_creation_messages(m_node);
+ om->client_broadcaster()->send_node(m_node);
+ }
+}
+
+
+} // namespace Om
+
diff --git a/src/engine/events/AddNodeEvent.h b/src/engine/events/AddNodeEvent.h
new file mode 100644
index 00000000..fe0236ba
--- /dev/null
+++ b/src/engine/events/AddNodeEvent.h
@@ -0,0 +1,63 @@
+/* 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 ADDNODEEVENT_H
+#define ADDNODEEVENT_H
+
+#include "QueuedEvent.h"
+#include "util/Path.h"
+#include
+using std::string;
+
+template class Array;
+template class TreeNode;
+
+namespace Om {
+
+class Patch;
+class Node;
+class Plugin;
+
+
+/** An event to load a Node and insert it into a Patch.
+ *
+ * \ingroup engine
+ */
+class AddNodeEvent : public QueuedEvent
+{
+public:
+ AddNodeEvent(CountedPtr responder, const string& path, Plugin* plugin, bool poly);
+ ~AddNodeEvent();
+
+ void pre_process();
+ void execute(samplecount offset);
+ void post_process();
+
+private:
+ string m_patch_name;
+ Path m_path;
+ Plugin* m_plugin;
+ bool m_poly;
+ Patch* m_patch;
+ Node* m_node;
+ Array* m_process_order; // Patch's new process order
+ bool m_node_already_exists;
+};
+
+
+} // namespace Om
+
+#endif // ADDNODEEVENT_H
diff --git a/src/engine/events/AllNotesOffEvent.cpp b/src/engine/events/AllNotesOffEvent.cpp
new file mode 100644
index 00000000..aa3a00f1
--- /dev/null
+++ b/src/engine/events/AllNotesOffEvent.cpp
@@ -0,0 +1,67 @@
+/* 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 "AllNotesOffEvent.h"
+#include "Responder.h"
+#include "Om.h"
+#include "OmApp.h"
+#include "ObjectStore.h"
+
+namespace Om {
+
+
+/** Note off with patch explicitly passed - triggered by MIDI.
+ */
+AllNotesOffEvent::AllNotesOffEvent(CountedPtr responder, Patch* patch)
+: Event(responder),
+ m_patch(patch)
+{
+}
+
+
+/** Note off event with lookup - triggered by OSC.
+ */
+AllNotesOffEvent::AllNotesOffEvent(CountedPtr responder, const string& patch_path)
+: Event(responder),
+ m_patch(NULL),
+ m_patch_path(patch_path)
+{
+}
+
+
+void
+AllNotesOffEvent::execute(samplecount offset)
+{
+ if (m_patch == NULL && m_patch_path != "")
+ m_patch = om->object_store()->find_patch(m_patch_path);
+
+ //if (m_patch != NULL)
+ // for (List::iterator j = m_patch->midi_in_nodes().begin(); j != m_patch->midi_in_nodes().end(); ++j)
+ // (*j)->all_notes_off(offset);
+}
+
+
+void
+AllNotesOffEvent::post_process()
+{
+ if (m_patch != NULL)
+ m_responder->respond_ok();
+}
+
+
+} // namespace Om
+
+
diff --git a/src/engine/events/AllNotesOffEvent.h b/src/engine/events/AllNotesOffEvent.h
new file mode 100644
index 00000000..ea23301b
--- /dev/null
+++ b/src/engine/events/AllNotesOffEvent.h
@@ -0,0 +1,50 @@
+/* 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 ALLNOTESOFFEVENT_H
+#define ALLNOTESOFFEVENT_H
+
+#include "Event.h"
+#include
+using std::string;
+
+namespace Om {
+
+class Patch;
+
+
+/** A note off event for all active voices.
+ *
+ * \ingroup engine
+ */
+class AllNotesOffEvent : public Event
+{
+public:
+ AllNotesOffEvent(CountedPtr responder, Patch* patch);
+ AllNotesOffEvent(CountedPtr responder, const string& patch_path);
+
+ void execute(samplecount offset);
+ void post_process();
+
+private:
+ Patch* m_patch;
+ string m_patch_path;
+};
+
+
+} // namespace Om
+
+#endif // ALLNOTESOFFEVENT_H
diff --git a/src/engine/events/ClearPatchEvent.cpp b/src/engine/events/ClearPatchEvent.cpp
new file mode 100644
index 00000000..8b8fc223
--- /dev/null
+++ b/src/engine/events/ClearPatchEvent.cpp
@@ -0,0 +1,114 @@
+/* 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 "ClearPatchEvent.h"
+#include "Responder.h"
+#include "Om.h"
+#include "OmApp.h"
+#include "Patch.h"
+#include "ClientBroadcaster.h"
+#include "util.h"
+#include "ObjectStore.h"
+#include "Port.h"
+#include "Maid.h"
+#include "Node.h"
+#include "Connection.h"
+#include "QueuedEventSource.h"
+
+namespace Om {
+
+
+ClearPatchEvent::ClearPatchEvent(CountedPtr responder, const string& patch_path)
+: QueuedEvent(responder, true),
+ m_patch_path(patch_path),
+ m_patch(NULL),
+ m_process(false)
+{
+}
+
+
+void
+ClearPatchEvent::pre_process()
+{
+ m_patch = om->object_store()->find_patch(m_patch_path);
+
+ if (m_patch != NULL) {
+
+ m_process = m_patch->process();
+
+ for (List::const_iterator i = m_patch->nodes().begin(); i != m_patch->nodes().end(); ++i)
+ (*i)->remove_from_store();
+ }
+
+ QueuedEvent::pre_process();
+}
+
+
+void
+ClearPatchEvent::execute(samplecount offset)
+{
+ if (m_patch != NULL) {
+ m_patch->process(false);
+
+ for (List::const_iterator i = m_patch->nodes().begin(); i != m_patch->nodes().end(); ++i)
+ (*i)->remove_from_patch();
+
+ if (m_patch->process_order() != NULL) {
+ om->maid()->push(m_patch->process_order());
+ m_patch->process_order(NULL);
+ }
+ }
+
+ QueuedEvent::execute(offset);
+}
+
+
+void
+ClearPatchEvent::post_process()
+{
+ if (m_patch != NULL) {
+ // Delete all nodes
+ for (List::iterator i = m_patch->nodes().begin(); i != m_patch->nodes().end(); ++i) {
+ (*i)->deactivate();
+ delete *i;
+ }
+ m_patch->nodes().clear();
+
+ // Delete all connections
+ for (List::iterator i = m_patch->connections().begin(); i != m_patch->connections().end(); ++i)
+ delete *i;
+ m_patch->connections().clear();
+
+ // Restore patch's run state
+ m_patch->process(m_process);
+
+ // Make sure everything's sane
+ assert(m_patch->nodes().size() == 0);
+ assert(m_patch->connections().size() == 0);
+
+ // Reply
+ m_responder->respond_ok();
+ om->client_broadcaster()->send_patch_cleared(m_patch_path);
+ } else {
+ m_responder->respond_error(string("Patch ") + m_patch_path + " not found");
+ }
+
+ m_source->unblock();
+}
+
+
+} // namespace Om
+
diff --git a/src/engine/events/ClearPatchEvent.h b/src/engine/events/ClearPatchEvent.h
new file mode 100644
index 00000000..c6e531a8
--- /dev/null
+++ b/src/engine/events/ClearPatchEvent.h
@@ -0,0 +1,54 @@
+/* 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 CLEARPATCHEVENT_H
+#define CLEARPATCHEVENT_H
+
+#include
+#include "QueuedEvent.h"
+#include "Array.h"
+
+using std::string;
+
+namespace Om {
+
+class Patch;
+
+
+/** Delete all nodes from a patch.
+ *
+ * \ingroup engine
+ */
+class ClearPatchEvent : public QueuedEvent
+{
+public:
+ ClearPatchEvent(CountedPtr responder, const string& patch_path);
+
+ void pre_process();
+ void execute(samplecount offset);
+ void post_process();
+
+private:
+ string m_patch_path;
+ Patch* m_patch;
+ bool m_process;
+};
+
+
+} // namespace Om
+
+
+#endif // CLEARPATCHEVENT_H
diff --git a/src/engine/events/ConnectionEvent.cpp b/src/engine/events/ConnectionEvent.cpp
new file mode 100644
index 00000000..fe3b991e
--- /dev/null
+++ b/src/engine/events/ConnectionEvent.cpp
@@ -0,0 +1,240 @@
+/* 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 "ConnectionEvent.h"
+#include
+#include "Responder.h"
+#include "Om.h"
+#include "OmApp.h"
+#include "ConnectionBase.h"
+#include "InputPort.h"
+#include "OutputPort.h"
+#include "Patch.h"
+#include "ClientBroadcaster.h"
+#include "Port.h"
+#include "PortInfo.h"
+#include "Maid.h"
+#include "ObjectStore.h"
+#include "util/Path.h"
+
+using std::string;
+namespace Om {
+
+
+//// ConnectionEvent ////
+
+
+ConnectionEvent::ConnectionEvent(CountedPtr responder, const string& src_port_path, const string& dst_port_path)
+: QueuedEvent(responder),
+ m_src_port_path(src_port_path),
+ m_dst_port_path(dst_port_path),
+ m_patch(NULL),
+ m_src_port(NULL),
+ m_dst_port(NULL),
+ m_typed_event(NULL),
+ m_error(NO_ERROR)
+{
+}
+
+
+ConnectionEvent::~ConnectionEvent()
+{
+ delete m_typed_event;
+}
+
+
+void
+ConnectionEvent::pre_process()
+{
+ if (m_src_port_path.parent().parent() != m_dst_port_path.parent().parent()) {
+ m_error = PARENT_PATCH_DIFFERENT;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ /*m_patch = om->object_store()->find_patch(m_src_port_path.parent().parent());
+
+ if (m_patch == NULL) {
+ m_error = PORT_NOT_FOUND;
+ QueuedEvent::pre_process();
+ return;
+ }*/
+
+ Port* port1 = om->object_store()->find_port(m_src_port_path);
+ Port* port2 = om->object_store()->find_port(m_dst_port_path);
+
+ if (port1 == NULL || port2 == NULL) {
+ m_error = PORT_NOT_FOUND;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ if (port1->port_info()->type() != port2->port_info()->type()) {
+ m_error = TYPE_MISMATCH;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ if (port1->port_info()->is_output() && port2->port_info()->is_input()) {
+ m_src_port = port1;
+ m_dst_port = port2;
+ } else if (port2->port_info()->is_output() && port1->port_info()->is_input()) {
+ m_src_port = port2;
+ m_dst_port = port1;
+ } else {
+ m_error = TYPE_MISMATCH;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ // Create the typed event to actually do the work
+ const PortType type = port1->port_info()->type();
+ if (type == AUDIO || type == CONTROL) {
+ m_typed_event = new TypedConnectionEvent(m_responder,
+ (OutputPort*)m_src_port, (InputPort*)m_dst_port);
+ } else if (type == MIDI) {
+ m_typed_event = new TypedConnectionEvent(m_responder,
+ (OutputPort*)m_src_port, (InputPort*)m_dst_port);
+ } else {
+ m_error = TYPE_MISMATCH;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ m_typed_event->pre_process();
+
+ QueuedEvent::pre_process();
+}
+
+
+void
+ConnectionEvent::execute(samplecount offset)
+{
+ QueuedEvent::execute(offset);
+
+ if (m_error == NO_ERROR)
+ m_typed_event->execute(offset);
+}
+
+
+void
+ConnectionEvent::post_process()
+{
+ if (m_error == NO_ERROR) {
+ m_typed_event->post_process();
+ } else {
+ // FIXME: better error messages
+ string msg = "Unable to make connection ";
+ msg.append(m_src_port_path + " -> " + m_dst_port_path);
+ m_responder->respond_error(msg);
+ }
+}
+
+
+
+//// TypedConnectionEvent ////
+
+
+template
+TypedConnectionEvent::TypedConnectionEvent(CountedPtr responder, OutputPort* src_port, InputPort* dst_port)
+: QueuedEvent(responder),
+ m_src_port(src_port),
+ m_dst_port(dst_port),
+ m_patch(NULL),
+ m_process_order(NULL),
+ m_connection(NULL),
+ m_port_listnode(NULL),
+ m_succeeded(true)
+{
+ assert(src_port != NULL);
+ assert(dst_port != NULL);
+}
+
+template
+TypedConnectionEvent::~TypedConnectionEvent()
+{
+ // FIXME: haaaack, prevent a double delete
+ // this class is unusable by anything other than ConnectionEvent because of this
+ //m_responder = NULL;
+}
+
+
+template
+void
+TypedConnectionEvent::pre_process()
+{
+ Node* const src_node = m_src_port->parent_node();
+ Node* const dst_node = m_dst_port->parent_node();
+
+ m_patch = src_node->parent_patch();
+
+ if (src_node == NULL || dst_node == NULL) {
+ m_succeeded = false;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ if (src_node->parent() != m_patch || dst_node->parent() != m_patch) {
+ m_succeeded = false;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ m_connection = new ConnectionBase(m_src_port, m_dst_port);
+ m_port_listnode = new ListNode*>(m_connection);
+ m_patch_listnode = new ListNode(m_connection);
+
+ dst_node->providers()->push_back(new ListNode(src_node));
+ src_node->dependants()->push_back(new ListNode(dst_node));
+
+ if (m_patch->process())
+ m_process_order = m_patch->build_process_order();
+}
+
+
+template
+void
+TypedConnectionEvent::execute(samplecount offset)
+{
+ if (m_succeeded) {
+ // These must be inserted here, since they're actually used by the audio thread
+ m_dst_port->add_connection(m_port_listnode);
+ m_patch->add_connection(m_patch_listnode);
+ if (m_patch->process_order() != NULL)
+ om->maid()->push(m_patch->process_order());
+ m_patch->process_order(m_process_order);
+ }
+}
+
+
+template
+void
+TypedConnectionEvent::post_process()
+{
+ if (m_succeeded) {
+ assert(m_connection != NULL);
+
+ m_responder->respond_ok();
+
+ om->client_broadcaster()->send_connection(m_connection);
+ } else {
+ m_responder->respond_error("Unable to make connection.");
+ }
+}
+
+
+} // namespace Om
+
diff --git a/src/engine/events/ConnectionEvent.h b/src/engine/events/ConnectionEvent.h
new file mode 100644
index 00000000..8aaf2292
--- /dev/null
+++ b/src/engine/events/ConnectionEvent.h
@@ -0,0 +1,107 @@
+/* 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 CONNECTIONEVENT_H
+#define CONNECTIONEVENT_H
+
+#include
+#include "QueuedEvent.h"
+#include "util/Path.h"
+#include "util/types.h"
+using std::string;
+
+template class ListNode;
+template class Array;
+
+namespace Om {
+
+class Patch;
+class Node;
+class Connection;
+class MidiMessage;
+class Port;
+template class ConnectionBase;
+template class InputPort;
+template class OutputPort;
+template class TypedConnectionEvent; // helper, defined below
+
+
+/** Make a Connection between two Ports.
+ *
+ * \ingroup engine
+ */
+class ConnectionEvent : public QueuedEvent
+{
+public:
+ ConnectionEvent(CountedPtr responder, const string& src_port_path, const string& dst_port_path);
+ ~ConnectionEvent();
+
+ void pre_process();
+ void execute(samplecount offset);
+ void post_process();
+
+private:
+
+ enum ErrorType { NO_ERROR, PARENT_PATCH_DIFFERENT, PORT_NOT_FOUND, TYPE_MISMATCH };
+
+ Path m_src_port_path;
+ Path m_dst_port_path;
+
+ Patch* m_patch;
+ Port* m_src_port;
+ Port* m_dst_port;
+
+ QueuedEvent* m_typed_event;
+
+ ErrorType m_error;
+};
+
+
+/** Templated ConnectionEvent.
+ *
+ * Intended to be called from ConnectionEvent so callers (ie OSCReceiver)
+ * can use ConnectionEvent without knowing anything about types (which
+ * they can't, since all they have is Port paths).
+ */
+template
+class TypedConnectionEvent : public QueuedEvent
+{
+public:
+ TypedConnectionEvent(CountedPtr responder, OutputPort* src_port, InputPort* dst_port);
+ ~TypedConnectionEvent();
+
+ void pre_process();
+ void execute(samplecount offset);
+ void post_process();
+
+private:
+ OutputPort* m_src_port;
+ InputPort* m_dst_port;
+
+ Patch* m_patch;
+ Array* m_process_order; ///< New process order for Patch
+ ConnectionBase* m_connection;
+ ListNode* m_patch_listnode;
+ ListNode*>* m_port_listnode;
+
+ bool m_succeeded;
+};
+
+
+
+} // namespace Om
+
+#endif // CONNECTIONEVENT_H
diff --git a/src/engine/events/CreatePatchEvent.cpp b/src/engine/events/CreatePatchEvent.cpp
new file mode 100644
index 00000000..9f0ae7f2
--- /dev/null
+++ b/src/engine/events/CreatePatchEvent.cpp
@@ -0,0 +1,150 @@
+/* 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 "CreatePatchEvent.h"
+#include "Responder.h"
+#include "Patch.h"
+#include "Node.h"
+#include "Tree.h"
+#include "Plugin.h"
+#include "Om.h"
+#include "OmApp.h"
+#include "Maid.h"
+#include "ClientBroadcaster.h"
+#include "AudioDriver.h"
+#include "util/Path.h"
+#include "ObjectStore.h"
+
+namespace Om {
+
+
+CreatePatchEvent::CreatePatchEvent(CountedPtr responder, const string& path, int poly)
+: QueuedEvent(responder),
+ m_path(path),
+ m_patch(NULL),
+ m_parent(NULL),
+ m_process_order(NULL),
+ m_poly(poly),
+ m_error(NO_ERROR)
+{
+}
+
+
+void
+CreatePatchEvent::pre_process()
+{
+ if (om->object_store()->find(m_path) != NULL) {
+ m_error = OBJECT_EXISTS;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ if (m_poly < 1) {
+ m_error = INVALID_POLY;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ if (m_path != "/") {
+ m_parent = om->object_store()->find_patch(m_path.parent());
+ if (m_parent == NULL) {
+ m_error = PARENT_NOT_FOUND;
+ QueuedEvent::pre_process();
+ return;
+ }
+ }
+
+ size_t poly = 1;
+ if (m_parent != NULL && m_poly > 1 && m_poly == static_cast(m_parent->internal_poly()))
+ poly = m_poly;
+
+ 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(m_patch->as_node()));
+
+ if (m_parent->process())
+ m_process_order = m_parent->build_process_order();
+ }
+
+ m_patch->activate();
+
+ // Insert into ObjectStore
+ m_patch->add_to_store();
+
+ QueuedEvent::pre_process();
+}
+
+
+void
+CreatePatchEvent::execute(samplecount offset)
+{
+ QueuedEvent::execute(offset);
+
+ if (m_patch != NULL) {
+ if (m_parent == NULL) {
+ assert(m_path == "/");
+ assert(m_patch->parent_patch() == NULL);
+ om->audio_driver()->set_root_patch(m_patch);
+ } else {
+ assert(m_parent != NULL);
+ assert(m_path != "/");
+
+ m_patch->add_to_patch();
+
+ if (m_parent->process_order() != NULL)
+ om->maid()->push(m_parent->process_order());
+ m_parent->process_order(m_process_order);
+ }
+ }
+}
+
+
+void
+CreatePatchEvent::post_process()
+{
+ if (m_responder.get()) {
+ if (m_error == NO_ERROR) {
+
+ m_responder->respond_ok();
+
+ // Don't want to send nodes that have been added since prepare()
+ //om->client_broadcaster()->send_node_creation_messages(m_patch);
+
+ // Patches are always empty on creation, so this is fine
+ om->client_broadcaster()->send_patch(m_patch);
+
+ } else if (m_error == OBJECT_EXISTS) {
+ string msg = "Unable to create patch: ";
+ msg += m_path += " already exists.";
+ m_responder->respond_error(msg);
+ } else if (m_error == PARENT_NOT_FOUND) {
+ string msg = "Unable to create patch: Parent ";
+ msg += m_path.parent() += " not found.";
+ m_responder->respond_error(msg);
+ } else if (m_error == INVALID_POLY) {
+ string msg = "Unable to create patch ";
+ msg.append(m_path).append(": ").append("Invalid polyphony respondered.");
+ m_responder->respond_error(msg);
+ } else {
+ m_responder->respond_error("Unable to load patch.");
+ }
+ }
+}
+
+
+} // namespace Om
+
diff --git a/src/engine/events/CreatePatchEvent.h b/src/engine/events/CreatePatchEvent.h
new file mode 100644
index 00000000..507d03c7
--- /dev/null
+++ b/src/engine/events/CreatePatchEvent.h
@@ -0,0 +1,64 @@
+/* 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 CREATEPATCHEVENT_H
+#define CREATEPATCHEVENT_H
+
+#include "util/Path.h"
+#include "QueuedEvent.h"
+#include
+using std::string;
+
+template class Array;
+template class TreeNode;
+
+namespace Om {
+
+class Patch;
+class Node;
+class Plugin;
+
+
+/** Creates a new Patch.
+ *
+ * \ingroup engine
+ */
+class CreatePatchEvent : public QueuedEvent
+{
+public:
+ CreatePatchEvent(CountedPtr responder, const string& path, int poly);
+
+ void pre_process();
+ void execute(samplecount offset);
+ void post_process();
+
+private:
+ enum ErrorType { NO_ERROR, OBJECT_EXISTS, PARENT_NOT_FOUND, INVALID_POLY };
+
+ Path m_path;
+ Patch* m_patch;
+ Patch* m_parent;
+ Array* m_process_order;
+ TreeNode* m_patch_treenode;
+ int m_poly;
+ ErrorType m_error;
+};
+
+
+} // namespace Om
+
+
+#endif // CREATEPATCHEVENT_H
diff --git a/src/engine/events/DSSIConfigureEvent.cpp b/src/engine/events/DSSIConfigureEvent.cpp
new file mode 100644
index 00000000..2ade4671
--- /dev/null
+++ b/src/engine/events/DSSIConfigureEvent.cpp
@@ -0,0 +1,73 @@
+/* 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 "DSSIConfigureEvent.h"
+#include "Om.h"
+#include "OmApp.h"
+#include "Node.h"
+#include "ClientBroadcaster.h"
+#include "Plugin.h"
+#include "ObjectStore.h"
+
+namespace Om {
+
+
+DSSIConfigureEvent::DSSIConfigureEvent(CountedPtr responder, const string& node_path, const string& key, const string& val)
+: QueuedEvent(responder),
+ m_node_path(node_path),
+ m_key(key),
+ m_val(val),
+ m_node(NULL)
+{
+}
+
+
+void
+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->configure(m_key, m_val);
+ }
+
+ QueuedEvent::pre_process();
+}
+
+
+void
+DSSIConfigureEvent::execute(samplecount offset)
+{
+ // Nothing.
+}
+
+
+void
+DSSIConfigureEvent::post_process()
+{
+ if (m_node == NULL) {
+ cerr << "Unable to find DSSI node " << m_node_path << endl;
+ } else {
+ string key = "dssi-configure--";
+ key += m_key;
+ om->client_broadcaster()->send_metadata_update(m_node_path, key, m_val);
+ }
+}
+
+
+} // namespace Om
+
diff --git a/src/engine/events/DSSIConfigureEvent.h b/src/engine/events/DSSIConfigureEvent.h
new file mode 100644
index 00000000..00b4a134
--- /dev/null
+++ b/src/engine/events/DSSIConfigureEvent.h
@@ -0,0 +1,49 @@
+/* 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 DSSICONFIGUREEVENT_H
+#define DSSICONFIGUREEVENT_H
+
+#include "QueuedEvent.h"
+#include "DSSIPlugin.h"
+
+namespace Om {
+
+
+/** Change of a 'configure' key/value pair for a DSSI plugin.
+ *
+ * \ingroup engine
+ */
+class DSSIConfigureEvent : public QueuedEvent
+{
+public:
+ DSSIConfigureEvent(CountedPtr responder, const string& node_path, const string& key, const string& val);
+
+ void pre_process();
+ void execute(samplecount offset);
+ void post_process();
+
+private:
+ string m_node_path;
+ string m_key;
+ string m_val;
+ DSSIPlugin* m_node;
+};
+
+
+} // namespace Om
+
+#endif // DSSICONFIGUREEVENT_H
diff --git a/src/engine/events/DSSIControlEvent.cpp b/src/engine/events/DSSIControlEvent.cpp
new file mode 100644
index 00000000..ea3e70ac
--- /dev/null
+++ b/src/engine/events/DSSIControlEvent.cpp
@@ -0,0 +1,68 @@
+/* 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 "DSSIControlEvent.h"
+#include "Om.h"
+#include "OmApp.h"
+#include "Node.h"
+#include "Plugin.h"
+#include "ObjectStore.h"
+
+namespace Om {
+
+
+DSSIControlEvent::DSSIControlEvent(CountedPtr responder, const string& node_path, int port_num, sample val)
+: QueuedEvent(responder),
+ m_node_path(node_path),
+ m_port_num(port_num),
+ m_val(val),
+ m_node(NULL)
+{
+}
+
+
+void
+DSSIControlEvent::pre_process()
+{
+ Node* node = om->object_store()->find_node(m_node_path);
+
+ if (node->plugin()->type() != Plugin::DSSI)
+ m_node = NULL;
+ else
+ m_node = (DSSIPlugin*)node;
+
+ QueuedEvent::pre_process();
+}
+
+
+void
+DSSIControlEvent::execute(samplecount offset)
+{
+ if (m_node != NULL)
+ m_node->set_control(m_port_num, m_val);
+}
+
+
+void
+DSSIControlEvent::post_process()
+{
+ if (m_node == NULL)
+ std::cerr << "Unable to find DSSI node " << m_node_path << std::endl;
+}
+
+
+} // namespace Om
+
diff --git a/src/engine/events/DSSIControlEvent.h b/src/engine/events/DSSIControlEvent.h
new file mode 100644
index 00000000..30a5279e
--- /dev/null
+++ b/src/engine/events/DSSIControlEvent.h
@@ -0,0 +1,51 @@
+/* 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 DSSICONTROLEVENT_H
+#define DSSICONTROLEVENT_H
+
+#include "QueuedEvent.h"
+#include "DSSIPlugin.h"
+
+namespace Om {
+
+
+/** A control change event for a DSSI plugin.
+ *
+ * This does essentially the same thing as a SetPortValueEvent.
+ *
+ * \ingroup engine
+ */
+class DSSIControlEvent : public QueuedEvent
+{
+public:
+ DSSIControlEvent(CountedPtr responder, const string& node_path, int port_num, sample val);
+
+ void pre_process();
+ void execute(samplecount offset);
+ void post_process();
+
+private:
+ string m_node_path;
+ int m_port_num;
+ float m_val;
+ DSSIPlugin* m_node;
+};
+
+
+} // namespace Om
+
+#endif // DSSICONTROLEVENT_H
diff --git a/src/engine/events/DSSIProgramEvent.cpp b/src/engine/events/DSSIProgramEvent.cpp
new file mode 100644
index 00000000..eb68ef77
--- /dev/null
+++ b/src/engine/events/DSSIProgramEvent.cpp
@@ -0,0 +1,77 @@
+/* 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 "DSSIProgramEvent.h"
+#include
+#include
+#include "Om.h"
+#include "OmApp.h"
+#include "Node.h"
+#include "ClientBroadcaster.h"
+#include "Plugin.h"
+#include "ObjectStore.h"
+using std::cout; using std::cerr; using std::endl;
+
+
+namespace Om {
+
+
+DSSIProgramEvent::DSSIProgramEvent(CountedPtr responder, const string& node_path, int bank, int program)
+: QueuedEvent(responder),
+ m_node_path(node_path),
+ m_bank(bank),
+ m_program(program),
+ m_node(NULL)
+{
+}
+
+
+void
+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;
+
+ QueuedEvent::pre_process();
+}
+
+
+void
+DSSIProgramEvent::execute(samplecount offset)
+{
+ if (m_node != NULL)
+ m_node->program(m_bank, m_program);
+}
+
+
+void
+DSSIProgramEvent::post_process()
+{
+ if (m_node == NULL) {
+ cerr << "Unable to find DSSI node " << m_node_path << endl;
+ } else {
+ // sends program as metadata in the form bank/program
+ char* temp_buf = new char[16];
+ snprintf(temp_buf, 16, "%d/%d", m_bank, m_program);
+ om->client_broadcaster()->send_metadata_update(m_node_path, "dssi-program", temp_buf);
+ }
+}
+
+
+} // namespace Om
+
diff --git a/src/engine/events/DSSIProgramEvent.h b/src/engine/events/DSSIProgramEvent.h
new file mode 100644
index 00000000..152f3cb1
--- /dev/null
+++ b/src/engine/events/DSSIProgramEvent.h
@@ -0,0 +1,49 @@
+/* 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 DSSIPROGRAMEVENT_H
+#define DSSIPROGRAMEVENT_H
+
+#include "QueuedEvent.h"
+#include "DSSIPlugin.h"
+
+namespace Om {
+
+
+/** A program change for a DSSI plugin.
+ *
+ * \ingroup engine
+ */
+class DSSIProgramEvent : public QueuedEvent
+{
+public:
+ DSSIProgramEvent(CountedPtr responder, const string& node_path, int bank, int program);
+
+ void pre_process();
+ void execute(samplecount offset);
+ void post_process();
+
+private:
+ string m_node_path;
+ int m_bank;
+ int m_program;
+ DSSIPlugin* m_node;
+};
+
+
+} // namespace Om
+
+#endif // DSSIPROGRAMEVENT_H
diff --git a/src/engine/events/DSSIUpdateEvent.cpp b/src/engine/events/DSSIUpdateEvent.cpp
new file mode 100644
index 00000000..5650dd63
--- /dev/null
+++ b/src/engine/events/DSSIUpdateEvent.cpp
@@ -0,0 +1,80 @@
+/* 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 "DSSIUpdateEvent.h"
+#include
+#include "Node.h"
+#include "ObjectStore.h"
+#include "Om.h"
+#include "OmApp.h"
+#include "DSSIPlugin.h"
+#include "Plugin.h"
+
+using std::cerr; using std::endl;
+
+namespace Om {
+
+
+DSSIUpdateEvent::DSSIUpdateEvent(CountedPtr responder, const string& path, const string& url)
+: QueuedEvent(responder),
+ m_path(path),
+ m_url(url),
+ m_node(NULL)
+{
+}
+
+
+void
+DSSIUpdateEvent::pre_process()
+{
+ Node* node = om->object_store()->find_node(m_path);
+
+ if (node == NULL || node->plugin()->type() != Plugin::DSSI) {
+ m_node = NULL;
+ QueuedEvent::pre_process();
+ return;
+ } else {
+ m_node = (DSSIPlugin*)node;
+ }
+
+ QueuedEvent::pre_process();
+}
+
+
+void
+DSSIUpdateEvent::execute(samplecount offset)
+{
+ if (m_node != NULL) {
+ m_node->set_ui_url(m_url);
+ }
+
+ QueuedEvent::execute(offset);
+}
+
+
+void
+DSSIUpdateEvent::post_process()
+{
+ cerr << "DSSI update event: " << m_url << endl;
+
+ if (m_node != NULL) {
+ m_node->send_update();
+ }
+}
+
+
+} // namespace Om
+
diff --git a/src/engine/events/DSSIUpdateEvent.h b/src/engine/events/DSSIUpdateEvent.h
new file mode 100644
index 00000000..cdd8851e
--- /dev/null
+++ b/src/engine/events/DSSIUpdateEvent.h
@@ -0,0 +1,54 @@
+/* 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 DSSIUPDATEEVENT_H
+#define DSSIUPDATEEVENT_H
+
+#include "QueuedEvent.h"
+#include
+
+using std::string;
+
+namespace Om {
+
+class DSSIPlugin;
+
+
+/** A DSSI "update" responder for a DSSI plugin/node.
+ *
+ * This sends all information about the plugin to the UI (over OSC).
+ *
+ * \ingroup engine
+ */
+class DSSIUpdateEvent : public QueuedEvent
+{
+public:
+ DSSIUpdateEvent(CountedPtr responder, const string& path, const string& url);
+
+ void pre_process();
+ void execute(samplecount offset);
+ void post_process();
+
+private:
+ string m_path;
+ string m_url;
+ DSSIPlugin* m_node;
+};
+
+
+} // namespace Om
+
+#endif // DSSIUPDATEEVENT_H
diff --git a/src/engine/events/DeactivateEvent.cpp b/src/engine/events/DeactivateEvent.cpp
new file mode 100644
index 00000000..48bff55a
--- /dev/null
+++ b/src/engine/events/DeactivateEvent.cpp
@@ -0,0 +1,54 @@
+/* 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 "DeactivateEvent.h"
+#include "Responder.h"
+#include "Om.h"
+#include "OmApp.h"
+
+namespace Om {
+
+
+DeactivateEvent::DeactivateEvent(CountedPtr responder)
+: QueuedEvent(responder)
+{
+}
+
+
+void
+DeactivateEvent::pre_process()
+{
+ QueuedEvent::pre_process();
+}
+
+
+void
+DeactivateEvent::execute(samplecount offset)
+{
+ QueuedEvent::execute(offset);
+}
+
+
+void
+DeactivateEvent::post_process()
+{
+ m_responder->respond_ok();
+ om->deactivate();
+}
+
+
+} // namespace Om
+
diff --git a/src/engine/events/DeactivateEvent.h b/src/engine/events/DeactivateEvent.h
new file mode 100644
index 00000000..8401f332
--- /dev/null
+++ b/src/engine/events/DeactivateEvent.h
@@ -0,0 +1,42 @@
+/* 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 DEACTIVATEEVENT_H
+#define DEACTIVATEEVENT_H
+
+#include "QueuedEvent.h"
+
+namespace Om {
+
+
+/** Deactivates the engine.
+ *
+ * \ingroup engine
+ */
+class DeactivateEvent : public QueuedEvent
+{
+public:
+ DeactivateEvent(CountedPtr responder);
+
+ void pre_process();
+ void execute(samplecount offset);
+ void post_process();
+};
+
+
+} // namespace Om
+
+#endif // DEACTIVATEEVENT_H
diff --git a/src/engine/events/DestroyEvent.cpp b/src/engine/events/DestroyEvent.cpp
new file mode 100644
index 00000000..3988195a
--- /dev/null
+++ b/src/engine/events/DestroyEvent.cpp
@@ -0,0 +1,168 @@
+/* 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 "DestroyEvent.h"
+#include "Responder.h"
+#include "Om.h"
+#include "OmApp.h"
+#include "Patch.h"
+#include "Tree.h"
+#include "Node.h"
+#include "Plugin.h"
+#include "InternalNode.h"
+#include "DisconnectNodeEvent.h"
+#include "DisconnectPortEvent.h"
+#include "ClientBroadcaster.h"
+#include "Maid.h"
+#include "ObjectStore.h"
+#include "util/Path.h"
+#include "QueuedEventSource.h"
+#include "Port.h"
+
+namespace Om {
+
+
+DestroyEvent::DestroyEvent(CountedPtr responder, const string& path, bool lock_mutex)
+: QueuedEvent(responder, true),
+ m_path(path),
+ m_node(NULL),
+ m_patch_listnode(NULL),
+ m_store_treenode(NULL),
+ m_process_order(NULL),
+ m_disconnect_event(NULL),
+ m_parent_disconnect_event(NULL)
+{
+}
+
+
+DestroyEvent::DestroyEvent(CountedPtr responder, Node* node, bool lock_mutex)
+: QueuedEvent(responder, true),
+ m_path(node->path()),
+ m_node(node),
+ m_patch_listnode(NULL),
+ m_store_treenode(NULL),
+ m_process_order(NULL),
+ m_disconnect_event(NULL),
+ m_parent_disconnect_event(NULL)
+{
+}
+
+
+DestroyEvent::~DestroyEvent()
+{
+ delete m_disconnect_event;
+ delete m_parent_disconnect_event;
+}
+
+
+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_path != "/") {
+ assert(m_node->parent_patch() != NULL);
+ m_patch_listnode = m_node->parent_patch()->remove_node(m_path.name());
+ if (m_patch_listnode != NULL) {
+ assert(m_patch_listnode->elem() == m_node);
+
+ m_node->remove_from_store();
+
+ if (m_node->providers()->size() != 0 || m_node->dependants()->size() != 0) {
+ m_disconnect_event = new DisconnectNodeEvent(m_node);
+ m_disconnect_event->pre_process();
+ }
+
+ // Create a recursive disconnect event for the parent port, if a bridge node
+ 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();
+ // Remove node to be removed from the process order so it isn't executed by
+ // Patch::run and can safely be destroyed
+ //for (size_t i=0; i < m_process_order->size(); ++i)
+ // if (m_process_order->at(i) == m_node)
+ // m_process_order->at(i) = NULL; // ew, gap
+
+#ifdef DEBUG
+ // Be sure node is removed from process order, so it can be destroyed
+ for (size_t i=0; i < m_process_order->size(); ++i)
+ assert(m_process_order->at(i) != m_node);
+#endif
+ }
+ }
+ }
+
+ QueuedEvent::pre_process();
+}
+
+
+void
+DestroyEvent::execute(samplecount offset)
+{
+ QueuedEvent::execute(offset);
+
+ if (m_patch_listnode != NULL) {
+ m_node->remove_from_patch();
+
+ if (m_disconnect_event != NULL)
+ m_disconnect_event->execute(offset);
+ if (m_parent_disconnect_event != NULL)
+ m_parent_disconnect_event->execute(offset);
+
+ if (m_node->parent_patch()->process_order() != NULL)
+ om->maid()->push(m_node->parent_patch()->process_order());
+ m_node->parent_patch()->process_order(m_process_order);
+ }
+}
+
+
+void
+DestroyEvent::post_process()
+{
+ m_source->unblock();
+
+ if (m_node == NULL) {
+ if (m_path == "/")
+ m_responder->respond_error("You can not destroy the root patch (/)");
+ else
+ m_responder->respond_error("Could not find node to destroy");
+ } else if (m_patch_listnode != NULL) {
+ m_node->deactivate();
+ m_responder->respond_ok();
+ if (m_disconnect_event != NULL)
+ m_disconnect_event->post_process();
+ if (m_parent_disconnect_event != NULL)
+ m_parent_disconnect_event->post_process();
+ om->client_broadcaster()->send_destroyed(m_path);
+ om->maid()->push(m_patch_listnode);
+ om->maid()->push(m_node);
+ } else {
+ m_responder->respond_error("Unable to destroy object");
+ }
+}
+
+
+} // namespace Om
diff --git a/src/engine/events/DestroyEvent.h b/src/engine/events/DestroyEvent.h
new file mode 100644
index 00000000..fc579bf4
--- /dev/null
+++ b/src/engine/events/DestroyEvent.h
@@ -0,0 +1,68 @@
+/* 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 DESTROYEVENT_H
+#define DESTROYEVENT_H
+
+#include "util/Path.h"
+#include "QueuedEvent.h"
+#include
+
+using std::string;
+
+template class Array;
+template class ListNode;
+template class TreeNode;
+
+namespace Om {
+
+class OmObject;
+class Patch;
+class Node;
+class Plugin;
+class DisconnectNodeEvent;
+class DisconnectPortEvent;
+
+
+/** An event to remove and delete a Node.
+ *
+ * \ingroup engine
+ */
+class DestroyEvent : public QueuedEvent
+{
+public:
+ DestroyEvent(CountedPtr responder, const string& path, bool lock_mutex = true);
+ DestroyEvent(CountedPtr responder, Node* node, bool lock_mutex = true);
+ ~DestroyEvent();
+
+ void pre_process();
+ void execute(samplecount offset);
+ void post_process();
+
+private:
+ Path m_path;
+ Node* m_node;
+ ListNode* m_patch_listnode;
+ TreeNode* m_store_treenode;
+ Array* m_process_order; // Patch's new process order
+ DisconnectNodeEvent* m_disconnect_event;
+ DisconnectPortEvent* m_parent_disconnect_event; // used for input/output nodes
+};
+
+
+} // namespace Om
+
+#endif // DESTROYEVENT_H
diff --git a/src/engine/events/DisablePatchEvent.cpp b/src/engine/events/DisablePatchEvent.cpp
new file mode 100644
index 00000000..a772e6e9
--- /dev/null
+++ b/src/engine/events/DisablePatchEvent.cpp
@@ -0,0 +1,70 @@
+/* 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 "DisablePatchEvent.h"
+#include "Responder.h"
+#include "Om.h"
+#include "OmApp.h"
+#include "Patch.h"
+#include "ClientBroadcaster.h"
+#include "util.h"
+#include "ObjectStore.h"
+#include "Port.h"
+
+namespace Om {
+
+
+DisablePatchEvent::DisablePatchEvent(CountedPtr responder, const string& patch_path)
+: QueuedEvent(responder),
+ m_patch_path(patch_path),
+ m_patch(NULL)
+{
+}
+
+
+void
+DisablePatchEvent::pre_process()
+{
+ m_patch = om->object_store()->find_patch(m_patch_path);
+
+ QueuedEvent::pre_process();
+}
+
+
+void
+DisablePatchEvent::execute(samplecount offset)
+{
+ if (m_patch != NULL)
+ m_patch->process(false);
+
+ QueuedEvent::execute(offset);
+}
+
+
+void
+DisablePatchEvent::post_process()
+{
+ if (m_patch != NULL) {
+ m_responder->respond_ok();
+ om->client_broadcaster()->send_patch_disable(m_patch_path);
+ } else {
+ m_responder->respond_error(string("Patch ") + m_patch_path + " not found");
+ }
+}
+
+
+} // namespace Om
+
diff --git a/src/engine/events/DisablePatchEvent.h b/src/engine/events/DisablePatchEvent.h
new file mode 100644
index 00000000..f38f14af
--- /dev/null
+++ b/src/engine/events/DisablePatchEvent.h
@@ -0,0 +1,52 @@
+/* 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 DISABLEPATCHEVENT_H
+#define DISABLEPATCHEVENT_H
+
+#include
+#include "QueuedEvent.h"
+
+using std::string;
+
+namespace Om {
+
+class Patch;
+
+
+/** Disables a Patch's DSP processing.
+ *
+ * \ingroup engine
+ */
+class DisablePatchEvent : public QueuedEvent
+{
+public:
+ DisablePatchEvent(CountedPtr responder, const string& patch_path);
+
+ void pre_process();
+ void execute(samplecount offset);
+ void post_process();
+
+private:
+ string m_patch_path;
+ Patch* m_patch;
+};
+
+
+} // namespace Om
+
+
+#endif // DISABLEPATCHEVENT_H
diff --git a/src/engine/events/DisconnectNodeEvent.cpp b/src/engine/events/DisconnectNodeEvent.cpp
new file mode 100644
index 00000000..17367dd4
--- /dev/null
+++ b/src/engine/events/DisconnectNodeEvent.cpp
@@ -0,0 +1,140 @@
+/* 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 "DisconnectNodeEvent.h"
+#include
+#include "Responder.h"
+#include "Om.h"
+#include "OmApp.h"
+#include "Maid.h"
+#include "List.h"
+#include "Node.h"
+#include "ConnectionBase.h"
+#include "DisconnectionEvent.h"
+#include "Port.h"
+#include "Array.h"
+#include "InputPort.h"
+#include "OutputPort.h"
+#include "Patch.h"
+#include "ClientBroadcaster.h"
+#include "util.h"
+#include "ObjectStore.h"
+#include "util/Path.h"
+
+using std::cerr; using std::endl;
+
+namespace Om {
+
+
+DisconnectNodeEvent::DisconnectNodeEvent(CountedPtr responder, const string& node_path)
+: QueuedEvent(responder),
+ m_node_path(node_path),
+ m_patch(NULL),
+ m_node(NULL),
+ m_succeeded(true),
+ m_lookup(true)
+{
+}
+
+
+/** Internal version, disconnects parent port as well (in the case of InputNode, etc).
+ */
+DisconnectNodeEvent::DisconnectNodeEvent(Node* node)
+: QueuedEvent(),
+ m_node_path(""),
+ m_patch(node->parent_patch()),
+ m_node(node),
+ m_succeeded(true),
+ m_lookup(false)
+{
+}
+
+
+DisconnectNodeEvent::~DisconnectNodeEvent()
+{
+ for (List::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
+ delete (*i);
+}
+
+
+void
+DisconnectNodeEvent::pre_process()
+{
+ typedef List::const_iterator ConnectionListIterator;
+
+ // cerr << "Preparing disconnection event...\n";
+
+ if (m_lookup) {
+ m_patch = om->object_store()->find_patch(m_node_path.parent());
+
+ if (m_patch == NULL) {
+ m_succeeded = false;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ m_node = om->object_store()->find_node(m_node_path);
+
+ if (m_node == NULL) {
+ m_succeeded = false;
+ QueuedEvent::pre_process();
+ return;
+ }
+ }
+
+ Connection* c = NULL;
+ for (ConnectionListIterator i = m_patch->connections().begin(); i != m_patch->connections().end(); ++i) {
+ c = (*i);
+ if ((c->src_port()->parent_node() == m_node || c->dst_port()->parent_node() == m_node) && !c->pending_disconnection()) {
+ DisconnectionEvent* ev = new DisconnectionEvent(CountedPtr(new Responder()), c->src_port(), c->dst_port());
+ ev->pre_process();
+ m_disconnection_events.push_back(new ListNode(ev));
+ c->pending_disconnection(true);
+ }
+ }
+
+ m_succeeded = true;
+ QueuedEvent::pre_process();
+}
+
+
+void
+DisconnectNodeEvent::execute(samplecount offset)
+{
+ if (m_succeeded) {
+ for (List::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
+ (*i)->execute(offset);
+ }
+
+ QueuedEvent::execute(offset);
+}
+
+
+void
+DisconnectNodeEvent::post_process()
+{
+ if (m_succeeded) {
+ m_responder->respond_ok();
+ for (List::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
+ (*i)->post_process();
+ } else {
+ m_responder->respond_error("Unable to disconnect all ports.");
+ }
+}
+
+
+} // namespace Om
+
diff --git a/src/engine/events/DisconnectNodeEvent.h b/src/engine/events/DisconnectNodeEvent.h
new file mode 100644
index 00000000..a82fbaec
--- /dev/null
+++ b/src/engine/events/DisconnectNodeEvent.h
@@ -0,0 +1,68 @@
+/* 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 DISCONNECTNODEEVENT_H
+#define DISCONNECTNODEEVENT_H
+
+#include
+#include "util/Path.h"
+#include "QueuedEvent.h"
+#include "List.h"
+using std::string;
+
+namespace Om {
+
+class DisconnectionEvent;
+class Patch;
+class Node;
+class Connection;
+template class ConnectionBase;
+class Port;
+template class InputPort;
+template class OutputPort;
+
+
+/** An event to disconnect all connections to a Node.
+ *
+ * \ingroup engine
+ */
+class DisconnectNodeEvent : public QueuedEvent
+{
+public:
+ DisconnectNodeEvent(CountedPtr responder, const string& node_path);
+ DisconnectNodeEvent(Node* node);
+ ~DisconnectNodeEvent();
+
+ void pre_process();
+ void execute(samplecount offset);
+ void post_process();
+
+private:
+ Path m_node_path;
+ Patch* m_patch;
+ Node* m_node;
+ List m_disconnection_events;
+
+ bool m_succeeded;
+ bool m_lookup;
+ bool m_disconnect_parent;
+};
+
+
+} // namespace Om
+
+
+#endif // DISCONNECTNODEEVENT_H
diff --git a/src/engine/events/DisconnectPortEvent.cpp b/src/engine/events/DisconnectPortEvent.cpp
new file mode 100644
index 00000000..a4c213d5
--- /dev/null
+++ b/src/engine/events/DisconnectPortEvent.cpp
@@ -0,0 +1,145 @@
+/* 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 "DisconnectPortEvent.h"
+#include
+#include "Responder.h"
+#include "Om.h"
+#include "OmApp.h"
+#include "Maid.h"
+#include "List.h"
+#include "Node.h"
+#include "Connection.h"
+#include "DisconnectionEvent.h"
+#include "Port.h"
+#include "Array.h"
+#include "InputPort.h"
+#include "OutputPort.h"
+#include "Patch.h"
+#include "ClientBroadcaster.h"
+#include "util.h"
+#include "ObjectStore.h"
+#include "util/Path.h"
+
+using std::cerr; using std::endl;
+
+namespace Om {
+
+
+DisconnectPortEvent::DisconnectPortEvent(CountedPtr responder, const string& port_path)
+: QueuedEvent(responder),
+ m_port_path(port_path),
+ m_patch(NULL),
+ m_port(NULL),
+ m_process_order(NULL),
+ m_succeeded(true),
+ m_lookup(true)
+{
+}
+
+
+DisconnectPortEvent::DisconnectPortEvent(Port* port)
+: QueuedEvent(),
+ m_port_path(""),
+ m_patch((port->parent_node() == NULL) ? NULL : port->parent_node()->parent_patch()),
+ m_port(port),
+ m_process_order(NULL),
+ m_succeeded(true),
+ m_lookup(false)
+{
+ //cerr << "DisconnectPortEvent()\n";
+}
+
+
+DisconnectPortEvent::~DisconnectPortEvent()
+{
+ for (List::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
+ delete (*i);
+}
+
+
+void
+DisconnectPortEvent::pre_process()
+{
+ // cerr << "Preparing disconnection event...\n";
+
+ if (m_lookup) {
+ m_patch = om->object_store()->find_patch(m_port_path.parent().parent());
+
+ if (m_patch == NULL) {
+ m_succeeded = false;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ m_port = om->object_store()->find_port(m_port_path);
+
+ if (m_port == NULL) {
+ m_succeeded = false;
+ QueuedEvent::pre_process();
+ return;
+ }
+ }
+
+ if (m_patch == NULL) {
+ m_succeeded = false;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ Connection* c = NULL;
+ for (List::const_iterator i = m_patch->connections().begin(); i != m_patch->connections().end(); ++i) {
+ c = (*i);
+ if ((c->src_port() == m_port || c->dst_port() == m_port) && !c->pending_disconnection()) {
+ DisconnectionEvent* ev = new DisconnectionEvent(CountedPtr(new Responder()), c->src_port(), c->dst_port());
+ ev->pre_process();
+ m_disconnection_events.push_back(new ListNode(ev));
+ c->pending_disconnection(true);
+ }
+ }
+
+ m_succeeded = true;
+ QueuedEvent::pre_process();
+}
+
+
+void
+DisconnectPortEvent::execute(samplecount offset)
+{
+ if (m_succeeded) {
+ for (List::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
+ (*i)->execute(offset);
+ }
+
+ QueuedEvent::execute(offset);
+}
+
+
+void
+DisconnectPortEvent::post_process()
+{
+ if (m_succeeded) {
+ m_responder->respond_ok();
+ for (List::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
+ (*i)->post_process();
+ } else {
+ m_responder->respond_error("Unable to disconnect port.");
+ }
+}
+
+
+} // namespace Om
+
diff --git a/src/engine/events/DisconnectPortEvent.h b/src/engine/events/DisconnectPortEvent.h
new file mode 100644
index 00000000..e8de4120
--- /dev/null
+++ b/src/engine/events/DisconnectPortEvent.h
@@ -0,0 +1,70 @@
+/* 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 DISCONNECTPORTEVENT_H
+#define DISCONNECTPORTEVENT_H
+
+#include
+#include "util/Path.h"
+#include "QueuedEvent.h"
+#include "List.h"
+
+template class Array;
+
+namespace Om {
+
+
+class Patch;
+class Node;
+class Connection;
+class Port;
+class DisconnectionEvent;
+
+using std::string;
+
+
+/** An event to disconnect all connections to a Port.
+ *
+ * \ingroup engine
+ */
+class DisconnectPortEvent : public QueuedEvent
+{
+public:
+ DisconnectPortEvent(CountedPtr responder, const string& port_path);
+ DisconnectPortEvent(Port* port);
+ ~DisconnectPortEvent();
+
+ void pre_process();
+ void execute(samplecount offset);
+ void post_process();
+
+private:
+ Path m_port_path;
+ Patch* m_patch;
+ Port* m_port;
+ List m_disconnection_events;
+
+ Array* m_process_order; // Patch's new process order
+
+ bool m_succeeded;
+ bool m_lookup;
+};
+
+
+} // namespace Om
+
+
+#endif // DISCONNECTPORTEVENT_H
diff --git a/src/engine/events/DisconnectionEvent.cpp b/src/engine/events/DisconnectionEvent.cpp
new file mode 100644
index 00000000..e7d06eab
--- /dev/null
+++ b/src/engine/events/DisconnectionEvent.cpp
@@ -0,0 +1,295 @@
+/* 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 "DisconnectionEvent.h"
+#include
+#include "Responder.h"
+#include "Om.h"
+#include "OmApp.h"
+#include "ConnectionBase.h"
+#include "InputPort.h"
+#include "OutputPort.h"
+#include "Patch.h"
+#include "ClientBroadcaster.h"
+#include "Port.h"
+#include "PortInfo.h"
+#include "Maid.h"
+#include "ObjectStore.h"
+#include "util/Path.h"
+
+using std::string;
+namespace Om {
+
+
+//// DisconnectionEvent ////
+
+
+DisconnectionEvent::DisconnectionEvent(CountedPtr responder, const string& src_port_path, const string& dst_port_path)
+: QueuedEvent(responder),
+ m_src_port_path(src_port_path),
+ m_dst_port_path(dst_port_path),
+ m_patch(NULL),
+ m_src_port(NULL),
+ m_dst_port(NULL),
+ m_lookup(true),
+ m_typed_event(NULL),
+ m_error(NO_ERROR)
+{
+}
+
+
+DisconnectionEvent::DisconnectionEvent(CountedPtr responder, Port* const src_port, Port* const dst_port)
+: QueuedEvent(responder),
+ m_src_port_path(src_port->path()),
+ m_dst_port_path(dst_port->path()),
+ m_patch(src_port->parent_node()->parent_patch()),
+ m_src_port(src_port),
+ m_dst_port(dst_port),
+ m_lookup(false),
+ m_typed_event(NULL),
+ m_error(NO_ERROR)
+{
+ assert(src_port->port_info()->is_output());
+ assert(dst_port->port_info()->is_input());
+ assert(src_port->port_info()->type() == dst_port->port_info()->type());
+ assert(src_port->parent_node()->parent_patch()
+ == dst_port->parent_node()->parent_patch());
+}
+
+DisconnectionEvent::~DisconnectionEvent()
+{
+ delete m_typed_event;
+}
+
+
+void
+DisconnectionEvent::pre_process()
+{
+ if (m_lookup) {
+ if (m_src_port_path.parent().parent() != m_dst_port_path.parent().parent()) {
+ m_error = PARENT_PATCH_DIFFERENT;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ /*m_patch = om->object_store()->find_patch(m_src_port_path.parent().parent());
+
+ if (m_patch == NULL) {
+ m_error = PORT_NOT_FOUND;
+ QueuedEvent::pre_process();
+ return;
+ }*/
+
+ Port* port1 = om->object_store()->find_port(m_src_port_path);
+ Port* port2 = om->object_store()->find_port(m_dst_port_path);
+
+ if (port1 == NULL || port2 == NULL) {
+ m_error = PORT_NOT_FOUND;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ if (port1->port_info()->type() != port2->port_info()->type()) {
+ m_error = TYPE_MISMATCH;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ if (port1->port_info()->is_output() && port2->port_info()->is_input()) {
+ m_src_port = port1;
+ m_dst_port = port2;
+ } else if (port2->port_info()->is_output() && port1->port_info()->is_input()) {
+ m_src_port = port2;
+ m_dst_port = port1;
+ } else {
+ m_error = TYPE_MISMATCH;
+ QueuedEvent::pre_process();
+ return;
+ }
+ }
+
+ // Create the typed event to actually do the work
+ const PortType type = m_src_port->port_info()->type();
+ if (type == AUDIO || type == CONTROL) {
+ m_typed_event = new TypedDisconnectionEvent(m_responder,
+ (OutputPort*)m_src_port, (InputPort*)m_dst_port);
+ } else if (type == MIDI) {
+ m_typed_event = new TypedDisconnectionEvent(m_responder,
+ (OutputPort*)m_src_port, (InputPort*)m_dst_port);
+ } else {
+ m_error = TYPE_MISMATCH;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ m_typed_event->pre_process();
+
+ QueuedEvent::pre_process();
+}
+
+
+void
+DisconnectionEvent::execute(samplecount offset)
+{
+ QueuedEvent::execute(offset);
+
+ if (m_error == NO_ERROR)
+ m_typed_event->execute(offset);
+}
+
+
+void
+DisconnectionEvent::post_process()
+{
+ if (m_error == NO_ERROR) {
+ m_typed_event->post_process();
+ } else {
+ // FIXME: better error messages
+ string msg = "Unable to make connection ";
+ msg.append(m_src_port_path + " -> " + m_dst_port_path);
+ m_responder->respond_error(msg);
+ }
+}
+
+
+
+//// TypedDisconnectionEvent ////
+
+
+template
+TypedDisconnectionEvent::TypedDisconnectionEvent(CountedPtr responder, OutputPort* src_port, InputPort* dst_port)
+: QueuedEvent(responder),
+ m_src_port(src_port),
+ m_dst_port(dst_port),
+ m_patch(NULL),
+ m_process_order(NULL),
+ m_succeeded(true)
+{
+ assert(src_port != NULL);
+ assert(dst_port != NULL);
+}
+
+template
+TypedDisconnectionEvent::~TypedDisconnectionEvent()
+{
+ // FIXME: haaaack, prevent a double delete
+ // this class is unusable by anything other than DisconnectionEvent because of this
+ //m_responder = NULL;
+}
+
+
+template