diff options
author | David Robillard <d@drobilla.net> | 2006-06-10 01:52:02 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-06-10 01:52:02 +0000 |
commit | 98fe0e7056e6697396249531785d3899f94d79be (patch) | |
tree | 233319008d4bfb6c8bdc546bdf4a81b87ecf7f3a /src/engine/events | |
parent | 6c8eaee73b0ea66216744f49b452e22e26fe83e1 (diff) | |
download | ingen-98fe0e7056e6697396249531785d3899f94d79be.tar.gz ingen-98fe0e7056e6697396249531785d3899f94d79be.tar.bz2 ingen-98fe0e7056e6697396249531785d3899f94d79be.zip |
More juggling
git-svn-id: http://svn.drobilla.net/lad/grauph@15 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/events')
65 files changed, 0 insertions, 5083 deletions
diff --git a/src/engine/events/ActivateEvent.cpp b/src/engine/events/ActivateEvent.cpp deleted file mode 100644 index 671b26d5..00000000 --- a/src/engine/events/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> 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 deleted file mode 100644 index 280b5523..00000000 --- a/src/engine/events/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> 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 deleted file mode 100644 index 2b31ef4a..00000000 --- a/src/engine/events/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> 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<Node*>(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 deleted file mode 100644 index fe0236ba..00000000 --- a/src/engine/events/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 <string> -using std::string; - -template <typename T> class Array; -template<typename T> 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> 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<Node*>* 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 deleted file mode 100644 index aa3a00f1..00000000 --- a/src/engine/events/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> responder, Patch* patch) -: Event(responder), - m_patch(patch) -{ -} - - -/** Note off event with lookup - triggered by OSC. - */ -AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> 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<MidiInNode*>::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 deleted file mode 100644 index ea23301b..00000000 --- a/src/engine/events/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 <string> -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> responder, Patch* patch); - AllNotesOffEvent(CountedPtr<Responder> 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 deleted file mode 100644 index 8b8fc223..00000000 --- a/src/engine/events/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> 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<Node*>::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<Node*>::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<Node*>::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<Connection*>::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 deleted file mode 100644 index c6e531a8..00000000 --- a/src/engine/events/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 <string> -#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> 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 deleted file mode 100644 index fe3b991e..00000000 --- a/src/engine/events/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 <string> -#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> 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<sample>(m_responder, - (OutputPort<sample>*)m_src_port, (InputPort<sample>*)m_dst_port); - } else if (type == MIDI) { - m_typed_event = new TypedConnectionEvent<MidiMessage>(m_responder, - (OutputPort<MidiMessage>*)m_src_port, (InputPort<MidiMessage>*)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 <typename T> -TypedConnectionEvent<T>::TypedConnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* 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 <typename T> -TypedConnectionEvent<T>::~TypedConnectionEvent() -{ - // FIXME: haaaack, prevent a double delete - // this class is unusable by anything other than ConnectionEvent because of this - //m_responder = NULL; -} - - -template <typename T> -void -TypedConnectionEvent<T>::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<T>(m_src_port, m_dst_port); - m_port_listnode = new ListNode<ConnectionBase<T>*>(m_connection); - m_patch_listnode = new ListNode<Connection*>(m_connection); - - dst_node->providers()->push_back(new ListNode<Node*>(src_node)); - src_node->dependants()->push_back(new ListNode<Node*>(dst_node)); - - if (m_patch->process()) - m_process_order = m_patch->build_process_order(); -} - - -template <typename T> -void -TypedConnectionEvent<T>::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 <typename T> -void -TypedConnectionEvent<T>::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 deleted file mode 100644 index 8aaf2292..00000000 --- a/src/engine/events/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 <string> -#include "QueuedEvent.h" -#include "util/Path.h" -#include "util/types.h" -using std::string; - -template <typename T> class ListNode; -template <typename T> class Array; - -namespace Om { - -class Patch; -class Node; -class Connection; -class MidiMessage; -class Port; -template <typename T> class ConnectionBase; -template <typename T> class InputPort; -template <typename T> class OutputPort; -template <typename T> class TypedConnectionEvent; // helper, defined below - - -/** Make a Connection between two Ports. - * - * \ingroup engine - */ -class ConnectionEvent : public QueuedEvent -{ -public: - ConnectionEvent(CountedPtr<Responder> 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 <typename T> -class TypedConnectionEvent : public QueuedEvent -{ -public: - TypedConnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* dst_port); - ~TypedConnectionEvent(); - - void pre_process(); - void execute(samplecount offset); - void post_process(); - -private: - OutputPort<T>* m_src_port; - InputPort<T>* m_dst_port; - - Patch* m_patch; - Array<Node*>* m_process_order; ///< New process order for Patch - ConnectionBase<T>* m_connection; - ListNode<Connection*>* m_patch_listnode; - ListNode<ConnectionBase<T>*>* 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 deleted file mode 100644 index 9f0ae7f2..00000000 --- a/src/engine/events/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> 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<int>(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<Node*>(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 deleted file mode 100644 index 507d03c7..00000000 --- a/src/engine/events/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 <string> -using std::string; - -template<typename T> class Array; -template<typename T> class TreeNode; - -namespace Om { - -class Patch; -class Node; -class Plugin; - - -/** Creates a new Patch. - * - * \ingroup engine - */ -class CreatePatchEvent : public QueuedEvent -{ -public: - CreatePatchEvent(CountedPtr<Responder> 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<Node*>* m_process_order; - TreeNode<Node*>* 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 deleted file mode 100644 index 2ade4671..00000000 --- a/src/engine/events/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> 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 deleted file mode 100644 index 00b4a134..00000000 --- a/src/engine/events/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> 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 deleted file mode 100644 index ea3e70ac..00000000 --- a/src/engine/events/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> 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 deleted file mode 100644 index 30a5279e..00000000 --- a/src/engine/events/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> 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 deleted file mode 100644 index eb68ef77..00000000 --- a/src/engine/events/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 <cstdio> -#include <iostream> -#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> 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 deleted file mode 100644 index 152f3cb1..00000000 --- a/src/engine/events/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> 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 deleted file mode 100644 index 5650dd63..00000000 --- a/src/engine/events/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 <iostream> -#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> 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 deleted file mode 100644 index cdd8851e..00000000 --- a/src/engine/events/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 <string> - -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> 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 deleted file mode 100644 index 48bff55a..00000000 --- a/src/engine/events/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> 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 deleted file mode 100644 index 8401f332..00000000 --- a/src/engine/events/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> 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 deleted file mode 100644 index 3988195a..00000000 --- a/src/engine/events/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> 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> 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 deleted file mode 100644 index fc579bf4..00000000 --- a/src/engine/events/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 <string> - -using std::string; - -template<typename T> class Array; -template<typename T> class ListNode; -template<typename T> 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> responder, const string& path, bool lock_mutex = true); - DestroyEvent(CountedPtr<Responder> 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<Node*>* m_patch_listnode; - TreeNode<OmObject*>* m_store_treenode; - Array<Node*>* 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 deleted file mode 100644 index a772e6e9..00000000 --- a/src/engine/events/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> 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 deleted file mode 100644 index f38f14af..00000000 --- a/src/engine/events/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 <string> -#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> 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 deleted file mode 100644 index 17367dd4..00000000 --- a/src/engine/events/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 <iostream> -#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> 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<DisconnectionEvent*>::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i) - delete (*i); -} - - -void -DisconnectNodeEvent::pre_process() -{ - typedef List<Connection*>::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<Responder>(new Responder()), c->src_port(), c->dst_port()); - ev->pre_process(); - m_disconnection_events.push_back(new ListNode<DisconnectionEvent*>(ev)); - c->pending_disconnection(true); - } - } - - m_succeeded = true; - QueuedEvent::pre_process(); -} - - -void -DisconnectNodeEvent::execute(samplecount offset) -{ - if (m_succeeded) { - for (List<DisconnectionEvent*>::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<DisconnectionEvent*>::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 deleted file mode 100644 index a82fbaec..00000000 --- a/src/engine/events/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 <string> -#include "util/Path.h" -#include "QueuedEvent.h" -#include "List.h" -using std::string; - -namespace Om { - -class DisconnectionEvent; -class Patch; -class Node; -class Connection; -template <typename T> class ConnectionBase; -class Port; -template <typename T> class InputPort; -template <typename T> class OutputPort; - - -/** An event to disconnect all connections to a Node. - * - * \ingroup engine - */ -class DisconnectNodeEvent : public QueuedEvent -{ -public: - DisconnectNodeEvent(CountedPtr<Responder> 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<DisconnectionEvent*> 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 deleted file mode 100644 index a4c213d5..00000000 --- a/src/engine/events/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 <iostream> -#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> 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<DisconnectionEvent*>::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<Connection*>::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<Responder>(new Responder()), c->src_port(), c->dst_port()); - ev->pre_process(); - m_disconnection_events.push_back(new ListNode<DisconnectionEvent*>(ev)); - c->pending_disconnection(true); - } - } - - m_succeeded = true; - QueuedEvent::pre_process(); -} - - -void -DisconnectPortEvent::execute(samplecount offset) -{ - if (m_succeeded) { - for (List<DisconnectionEvent*>::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<DisconnectionEvent*>::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 deleted file mode 100644 index e8de4120..00000000 --- a/src/engine/events/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 <string> -#include "util/Path.h" -#include "QueuedEvent.h" -#include "List.h" - -template <typename T> 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> 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<DisconnectionEvent*> m_disconnection_events; - - Array<Node*>* 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 deleted file mode 100644 index e7d06eab..00000000 --- a/src/engine/events/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 <string> -#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> 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> 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<sample>(m_responder, - (OutputPort<sample>*)m_src_port, (InputPort<sample>*)m_dst_port); - } else if (type == MIDI) { - m_typed_event = new TypedDisconnectionEvent<MidiMessage>(m_responder, - (OutputPort<MidiMessage>*)m_src_port, (InputPort<MidiMessage>*)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 <typename T> -TypedDisconnectionEvent<T>::TypedDisconnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* 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 <typename T> -TypedDisconnectionEvent<T>::~TypedDisconnectionEvent() -{ - // FIXME: haaaack, prevent a double delete - // this class is unusable by anything other than DisconnectionEvent because of this - //m_responder = NULL; -} - - -template <typename T> -void -TypedDisconnectionEvent<T>::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<Node*>::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<Node*>::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 <typename T> -void -TypedDisconnectionEvent<T>::execute(samplecount offset) -{ - if (m_succeeded) { - - ListNode<ConnectionBase<T>*>* const port_connection - = m_dst_port->remove_connection(m_src_port); - - if (port_connection != NULL) { - ListNode<Connection*>* 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 <typename T> -void -TypedDisconnectionEvent<T>::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/events/DisconnectionEvent.h b/src/engine/events/DisconnectionEvent.h deleted file mode 100644 index bbb70f3c..00000000 --- a/src/engine/events/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 <string> -#include "util/Path.h" -#include "QueuedEvent.h" -#include "util/types.h" -using std::string; - -template <typename T> class ListNode; -template <typename T> class Array; - -namespace Om { - -class Patch; -class Node; -class Connection; -class MidiMessage; -class Port; -template <typename T> class ConnectionBase; -template <typename T> class InputPort; -template <typename T> class OutputPort; -template <typename T> class TypedDisconnectionEvent; // helper, defined below - - -/** Make a Connection between two Ports. - * - * \ingroup engine - */ -class DisconnectionEvent : public QueuedEvent -{ -public: - DisconnectionEvent(CountedPtr<Responder> responder, const string& src_port_path, const string& dst_port_path); - DisconnectionEvent(CountedPtr<Responder> 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 <typename T> -class TypedDisconnectionEvent : public QueuedEvent -{ -public: - TypedDisconnectionEvent(CountedPtr<Responder> responder, OutputPort<T>* src_port, InputPort<T>* dst_port); - ~TypedDisconnectionEvent(); - - void pre_process(); - void execute(samplecount offset); - void post_process(); - -private: - OutputPort<T>* m_src_port; - InputPort<T>* m_dst_port; - - Patch* m_patch; - Array<Node*>* m_process_order; ///< New process order for Patch - - bool m_succeeded; -}; - - - -} // namespace Om - -#endif // DISCONNECTIONEVENT_H diff --git a/src/engine/events/EnablePatchEvent.cpp b/src/engine/events/EnablePatchEvent.cpp deleted file mode 100644 index 6af3b844..00000000 --- a/src/engine/events/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> 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/events/EnablePatchEvent.h b/src/engine/events/EnablePatchEvent.h deleted file mode 100644 index f3d22e69..00000000 --- a/src/engine/events/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 <string> -#include "QueuedEvent.h" - -using std::string; - -template <typename T> class Array; - -namespace Om { - -class Patch; -class Node; - - -/** Enables a patch's DSP processing. - * - * \ingroup engine - */ -class EnablePatchEvent : public QueuedEvent -{ -public: - EnablePatchEvent(CountedPtr<Responder> responder, const string& patch_path); - - void pre_process(); - void execute(samplecount offset); - void post_process(); - -private: - string m_patch_path; - Patch* m_patch; - Array<Node*>* m_process_order; // Patch's new process order -}; - - -} // namespace Om - - -#endif // ENABLEPATCHEVENT_H diff --git a/src/engine/events/LashRestoreDoneEvent.h b/src/engine/events/LashRestoreDoneEvent.h deleted file mode 100644 index dfc5b120..00000000 --- a/src/engine/events/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 <iostream> -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> responder) : QueuedEvent(responder) {} - - void post_process() - { - m_responder->respond_ok(); - lash_driver->restore_finished(); - } -}; - - -} // namespace Om - -#endif // LASHRESTOREDONEEVENT_H diff --git a/src/engine/events/LoadPluginsEvent.cpp b/src/engine/events/LoadPluginsEvent.cpp deleted file mode 100644 index 656e9010..00000000 --- a/src/engine/events/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> 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/events/LoadPluginsEvent.h b/src/engine/events/LoadPluginsEvent.h deleted file mode 100644 index b69dbb38..00000000 --- a/src/engine/events/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> responder); - - void post_process(); -}; - - -} // namespace Om - -#endif // LOADPLUGINSEVENT_H diff --git a/src/engine/events/Makefile.am b/src/engine/events/Makefile.am deleted file mode 100644 index 5b29e12b..00000000 --- a/src/engine/events/Makefile.am +++ /dev/null @@ -1,67 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -EXTRA_DIST = \ - 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 \ - DSSIConfigureEvent.cpp \ - DSSIConfigureEvent.h \ - DSSIControlEvent.cpp \ - DSSIControlEvent.h \ - DSSIProgramEvent.cpp \ - DSSIProgramEvent.h \ - DSSIUpdateEvent.cpp \ - DSSIUpdateEvent.h - diff --git a/src/engine/events/MidiLearnEvent.cpp b/src/engine/events/MidiLearnEvent.cpp deleted file mode 100644 index 63ad82fc..00000000 --- a/src/engine/events/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> 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/events/MidiLearnEvent.h b/src/engine/events/MidiLearnEvent.h deleted file mode 100644 index 793e675a..00000000 --- a/src/engine/events/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 <string> -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<Responder>(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> 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/events/NoteOffEvent.cpp b/src/engine/events/NoteOffEvent.cpp deleted file mode 100644 index fde2e520..00000000 --- a/src/engine/events/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> 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> 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/events/NoteOffEvent.h b/src/engine/events/NoteOffEvent.h deleted file mode 100644 index edd0b373..00000000 --- a/src/engine/events/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 <string> -using std::string; - -namespace Om { - -class Node; - - -/** A note off event. - * - * \ingroup engine - */ -class NoteOffEvent : public Event -{ -public: - NoteOffEvent(CountedPtr<Responder> responder, Node* node, uchar note_num); - NoteOffEvent(CountedPtr<Responder> 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/events/NoteOnEvent.cpp b/src/engine/events/NoteOnEvent.cpp deleted file mode 100644 index 9688af79..00000000 --- a/src/engine/events/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> 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> 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/events/NoteOnEvent.h b/src/engine/events/NoteOnEvent.h deleted file mode 100644 index 1e09e450..00000000 --- a/src/engine/events/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 <string> -using std::string; - -namespace Om { - -class Node; - - -/** A note on event. - * - * \ingroup engine - */ -class NoteOnEvent : public Event -{ -public: - NoteOnEvent(CountedPtr<Responder> responder, Node* patch, uchar note_num, uchar velocity); - NoteOnEvent(CountedPtr<Responder> 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/events/PingQueuedEvent.h b/src/engine/events/PingQueuedEvent.h deleted file mode 100644 index cfba7058..00000000 --- a/src/engine/events/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> responder) : QueuedEvent(responder) {} - - void post_process() { m_responder->respond_ok(); } -}; - - -} // namespace Om - -#endif // PINGQUEUEDEVENT_H diff --git a/src/engine/events/RegisterClientEvent.cpp b/src/engine/events/RegisterClientEvent.cpp deleted file mode 100644 index ca7dd1f6..00000000 --- a/src/engine/events/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> responder, - ClientKey key, - CountedPtr<ClientInterface> 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/events/RegisterClientEvent.h b/src/engine/events/RegisterClientEvent.h deleted file mode 100644 index f4b6b60f..00000000 --- a/src/engine/events/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 <string> -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> responder, - ClientKey key, - CountedPtr<ClientInterface> client); - - void pre_process(); - void post_process(); - -private: - ClientKey _key; - CountedPtr<ClientInterface> _client; -}; - - -} // namespace Om - -#endif // REGISTERCLIENTEVENT_H diff --git a/src/engine/events/RenameEvent.cpp b/src/engine/events/RenameEvent.cpp deleted file mode 100644 index e2e98dd0..00000000 --- a/src/engine/events/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> 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/events/RenameEvent.h b/src/engine/events/RenameEvent.h deleted file mode 100644 index c1c9fe91..00000000 --- a/src/engine/events/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 <string> -using std::string; - -template<typename T> class TreeNode; -template<typename T> 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> 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<OmObject*>* m_store_treenode; - ErrorType m_error; -}; - - -} // namespace Om - -#endif // RENAMEEVENT_H diff --git a/src/engine/events/RequestAllObjectsEvent.cpp b/src/engine/events/RequestAllObjectsEvent.cpp deleted file mode 100644 index ef40a0de..00000000 --- a/src/engine/events/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> responder) -: QueuedEvent(responder), - m_client(CountedPtr<ClientInterface>(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/events/RequestAllObjectsEvent.h b/src/engine/events/RequestAllObjectsEvent.h deleted file mode 100644 index df63a577..00000000 --- a/src/engine/events/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 <string> -#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> responder); - - void pre_process(); - void post_process(); - -private: - CountedPtr<ClientInterface> m_client; -}; - - -} // namespace Om - -#endif // REQUESTALLOBJECTSEVENT_H diff --git a/src/engine/events/RequestMetadataEvent.cpp b/src/engine/events/RequestMetadataEvent.cpp deleted file mode 100644 index 10e1007c..00000000 --- a/src/engine/events/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 <string> -#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> 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<ClientInterface>(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/events/RequestMetadataEvent.h b/src/engine/events/RequestMetadataEvent.h deleted file mode 100644 index e4243eb3..00000000 --- a/src/engine/events/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 <string> -#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> 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<ClientInterface> m_client; -}; - - -} // namespace Om - -#endif // REQUESTMETADATAEVENT_H diff --git a/src/engine/events/RequestPluginsEvent.cpp b/src/engine/events/RequestPluginsEvent.cpp deleted file mode 100644 index 89dbefd5..00000000 --- a/src/engine/events/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> responder) -: QueuedEvent(responder), - m_client(CountedPtr<ClientInterface>(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/events/RequestPluginsEvent.h b/src/engine/events/RequestPluginsEvent.h deleted file mode 100644 index 83447fb3..00000000 --- a/src/engine/events/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 <string> -#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> responder); - - void pre_process(); - void post_process(); - -private: - CountedPtr<ClientInterface> m_client; -}; - - -} // namespace Om - -#endif // REQUESTPLUGINSEVENT_H diff --git a/src/engine/events/RequestPortValueEvent.cpp b/src/engine/events/RequestPortValueEvent.cpp deleted file mode 100644 index e4d3985e..00000000 --- a/src/engine/events/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 <string> -#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> responder, const string& port_path) -: QueuedEvent(responder), - m_port_path(port_path), - m_port(NULL), - m_value(0.0), - m_client(CountedPtr<ClientInterface>(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<sample>*)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/events/RequestPortValueEvent.h b/src/engine/events/RequestPortValueEvent.h deleted file mode 100644 index d970ee9c..00000000 --- a/src/engine/events/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 <string> -#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> 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<ClientInterface> m_client; -}; - - -} // namespace Om - -#endif // REQUESTPORTVALUEEVENT_H diff --git a/src/engine/events/SetMetadataEvent.cpp b/src/engine/events/SetMetadataEvent.cpp deleted file mode 100644 index 614f7ca9..00000000 --- a/src/engine/events/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 <string> -#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> 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/events/SetMetadataEvent.h b/src/engine/events/SetMetadataEvent.h deleted file mode 100644 index ef471033..00000000 --- a/src/engine/events/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 <string> -#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> 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/events/SetPortValueEvent.cpp b/src/engine/events/SetPortValueEvent.cpp deleted file mode 100644 index 964cd9ca..00000000 --- a/src/engine/events/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> 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> 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<sample>*)m_port)->set_value(m_val, offset); - else - ((PortBase<sample>*)m_port)->set_value(m_voice_num, m_val, offset); - //((PortBase<sample>*)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/events/SetPortValueEvent.h b/src/engine/events/SetPortValueEvent.h deleted file mode 100644 index 0a9614b9..00000000 --- a/src/engine/events/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 <string> -#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> responder, const string& port_path, sample val); - SetPortValueEvent(CountedPtr<Responder> 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/events/SetPortValueQueuedEvent.cpp b/src/engine/events/SetPortValueQueuedEvent.cpp deleted file mode 100644 index e73c0486..00000000 --- a/src/engine/events/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> 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> 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<sample>*)m_port)->set_value(m_val, offset); - else - ((PortBase<sample>*)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/events/SetPortValueQueuedEvent.h b/src/engine/events/SetPortValueQueuedEvent.h deleted file mode 100644 index b92beacf..00000000 --- a/src/engine/events/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 <string> -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> responder, const string& port_path, sample val); - SetPortValueQueuedEvent(CountedPtr<Responder> 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/events/UnregisterClientEvent.cpp b/src/engine/events/UnregisterClientEvent.cpp deleted file mode 100644 index ef5a9979..00000000 --- a/src/engine/events/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> 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/events/UnregisterClientEvent.h b/src/engine/events/UnregisterClientEvent.h deleted file mode 100644 index fdbdb314..00000000 --- a/src/engine/events/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 <string> -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> responder, ClientKey key); - - void post_process(); - -private: - ClientKey _key; -}; - - -} // namespace Om - -#endif // UNREGISTERCLIENTEVENT_H |