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/Patch.h | |
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/Patch.h')
-rw-r--r-- | src/engine/Patch.h | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/src/engine/Patch.h b/src/engine/Patch.h deleted file mode 100644 index e2a1ed48..00000000 --- a/src/engine/Patch.h +++ /dev/null @@ -1,136 +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 PATCH_H -#define PATCH_H - -#include <cstdlib> -#include <string> -#include "NodeBase.h" -#include "Plugin.h" -#include "List.h" - -using std::string; - -template <typename T> class Array; - -namespace Om { - -class Connection; -class InternalNode; -namespace Shared { - class ClientInterface; -} using Shared::ClientInterface; - - -/** A group of nodes in a graph, possibly polyphonic. - * - * Note that this is also a Node, just one which contains Nodes. - * Therefore infinite subpatching is possible, of polyphonic - * patches of polyphonic nodes etc. etc. - * - * \ingroup engine - */ -class Patch : public NodeBase -{ -public: - Patch(const string& name, size_t poly, Patch* parent, samplerate srate, size_t buffer_size, size_t local_poly); - virtual ~Patch(); - - Patch* as_patch() { return static_cast<Patch*>(this); } - - void activate(); - void deactivate(); - - void run(size_t nframes); - - size_t num_ports() const; - - //void send_creation_messages(ClientInterface* client) const; - - void add_to_store(); - void remove_from_store(); - - void set_path(const Path& new_path); - - // Patch specific stuff not inherited from Node - - void add_node(ListNode<Node*>* tn); - ListNode<Node*>* remove_node(const string& name); - - List<Node*>& nodes() { return m_nodes; } - List<Connection*>& connections() { return m_connections; } - - const List<Node*>& nodes() const { return m_nodes; } - const List<Connection*>& connections() const { return m_connections; } - - void add_bridge_node(ListNode<InternalNode*>* n) { m_bridge_nodes.push_back(n); } - ListNode<InternalNode*>* remove_bridge_node(const InternalNode* n); - - void add_connection(ListNode<Connection*>* c) { m_connections.push_back(c); } - ListNode<Connection*>* remove_connection(const Port* src_port, const Port* dst_port); - - Array<Node*>* process_order() { return m_process_order; } - void process_order(Array<Node*>* po) { m_process_order = po; } - - Array<Node*>* build_process_order() const; - inline void build_process_order_recursive(Node* n, Array<Node*>* order) const; - - /** Whether to run this patch's DSP in the audio thread */ - bool process() const { return m_process; } - void process(bool b); - - size_t internal_poly() const { return m_internal_poly; } - - const Plugin* plugin() const { return &m_plugin; } - void plugin(const Plugin* const) { exit(EXIT_FAILURE); } - -private: - // Prevent copies (undefined) - Patch(const Patch&); - Patch& operator=(const Patch&); - - size_t m_internal_poly; - Array<Node*>* m_process_order; - List<Connection*> m_connections; - List<InternalNode*> m_bridge_nodes; ///< Inputs and outputs - List<Node*> m_nodes; - bool m_process; - - Plugin m_plugin; -}; - - - -/** Private helper for build_process_order */ -inline void -Patch::build_process_order_recursive(Node* n, Array<Node*>* order) const -{ - if (n == NULL || n->traversed()) return; - n->traversed(true); - assert(order != NULL); - - for (List<Node*>::iterator i = n->providers()->begin(); i != n->providers()->end(); ++i) - if ( ! (*i)->traversed() ) - build_process_order_recursive((*i), order); - - order->push_back(n); -} - - -} // namespace Om - -#endif // PATCH_H |