diff --git a/libs/ardour/ardour/graph.h b/libs/ardour/ardour/graph.h index 2725c5372b..f7a84fce95 100644 --- a/libs/ardour/ardour/graph.h +++ b/libs/ardour/ardour/graph.h @@ -41,6 +41,7 @@ namespace ARDOUR { +class ProcessNode; class GraphNode; class Graph; @@ -82,7 +83,7 @@ public: uint32_t n_threads () const; /* called by GraphNode */ - void trigger (GraphNode* n); + void trigger (ProcessNode* n); void reached_terminal_node (); /* called by virtual GraphNode::process() */ @@ -101,8 +102,8 @@ private: void helper_thread (); - PBD::MPMCQueue _trigger_queue; ///< nodes that can be processed - GATOMIC_QUAL guint _trigger_queue_size; ///< number of entries in trigger-queue + PBD::MPMCQueue _trigger_queue; ///< nodes that can be processed + GATOMIC_QUAL guint _trigger_queue_size; ///< number of entries in trigger-queue /** Start worker threads */ PBD::Semaphore _execution_sem; diff --git a/libs/ardour/ardour/graphnode.h b/libs/ardour/ardour/graphnode.h index 673fce1d4c..2457e3e2ba 100644 --- a/libs/ardour/ardour/graphnode.h +++ b/libs/ardour/ardour/graphnode.h @@ -42,6 +42,14 @@ typedef boost::shared_ptr node_ptr_t; typedef std::set node_set_t; typedef std::list node_list_t; +class LIBARDOUR_API ProcessNode +{ +public: + virtual ~ProcessNode() {} + virtual void prep (GraphChain const*) = 0; + virtual void run (GraphChain const*) = 0; +}; + class LIBARDOUR_API GraphActivision { public: @@ -64,15 +72,14 @@ protected: }; /** A node on our processing graph, ie a Route */ -class LIBARDOUR_API GraphNode : public GraphActivision +class LIBARDOUR_API GraphNode : public ProcessNode, public GraphActivision { public: GraphNode (boost::shared_ptr Graph); /* API used by Graph */ void prep (GraphChain const*); - void trigger (); - void run (GraphChain const* chain); + void run (GraphChain const*); /* API used to sort Nodes and create GraphChain */ virtual std::string graph_node_name () const = 0; @@ -80,6 +87,7 @@ public: virtual bool direct_feeds_according_to_reality (boost::shared_ptr, bool* via_send_only = 0) = 0; protected: + void trigger (); virtual void process () = 0; boost::shared_ptr _graph; diff --git a/libs/ardour/graph.cc b/libs/ardour/graph.cc index 38d16ef912..e71942a978 100644 --- a/libs/ardour/graph.cc +++ b/libs/ardour/graph.cc @@ -226,7 +226,7 @@ Graph::prep () } void -Graph::trigger (GraphNode* n) +Graph::trigger (ProcessNode* n) { g_atomic_int_inc (&_trigger_queue_size); _trigger_queue.push_back (n); @@ -274,7 +274,7 @@ Graph::reached_terminal_node () * - Reset terminal reference count * - queue initial nodes */ - prep (); // XXX + prep (); if (_graph_empty && !g_atomic_int_get (&_terminate)) { goto again; @@ -287,7 +287,7 @@ Graph::reached_terminal_node () void Graph::run_one () { - GraphNode* to_run = NULL; + ProcessNode* to_run = NULL; if (g_atomic_int_get (&_terminate)) { return;