add API to get current MIDI option from an audio/MIDI backend
[ardour.git] / libs / ardour / ardour / graph.h
index 0279fe8fd9698ae8dfa68ffd775513b7216175d5..763723c792eb4e0dda2653c7b86fec5f45bec71a 100644 (file)
 
 #include <boost/shared_ptr.hpp>
 
-#include <glib/gatomic.h>
+#include <glib.h>
 #include <cassert>
 
-#include <pthread.h>
-
 #include "pbd/semutils.h"
 
 #include "ardour/types.h"
+#include "ardour/audio_backend.h"
 #include "ardour/session_handle.h"
 
 namespace ARDOUR
@@ -46,9 +45,9 @@ class Graph;
 
 class Route;
 class Session;
+class GraphEdges;      
 
 typedef boost::shared_ptr<GraphNode> node_ptr_t;
-typedef boost::shared_ptr<Graph> graph_ptr_t;
 
 typedef std::list< node_ptr_t > node_list_t;
 typedef std::set< node_ptr_t > node_set_t;
@@ -58,11 +57,9 @@ class Graph : public SessionHandleRef
 public:
        Graph (Session & session);
 
-       uint32_t threads_in_use () const { return _thread_list.size(); }
-
        void prep();
        void trigger (GraphNode * n);
-       void rechain (boost::shared_ptr<RouteList> r);
+       void rechain (boost::shared_ptr<RouteList>, GraphEdges const &);
 
        void dump (int chain);
        void process();
@@ -74,13 +71,13 @@ public:
        void main_thread();
 
        int silent_process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                                  bool can_record, bool& need_butler);
+                                  bool& need_butler);
 
        int process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick,
-                           bool can_record, bool& need_butler);
+                           bool& need_butler);
 
        int routes_no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                           bool non_rt_pending, bool can_record, int declick);
+                           bool non_rt_pending, int declick);
 
        void process_one_route (Route * route);
 
@@ -92,11 +89,8 @@ protected:
        virtual void session_going_away ();
 
 private:
-       std::list<pthread_t> _thread_list;
        volatile bool        _quit_threads;
-       PBD::ScopedConnection processor_usage_connection;
 
-       void parameter_changed (std::string);
        void reset_thread_list ();
        void drop_threads ();
 
@@ -109,19 +103,23 @@ private:
 
        PBD::ProcessSemaphore _execution_sem;
 
+       /** Signalled to start a run of the graph for a process callback */
        PBD::ProcessSemaphore _callback_start_sem;
        PBD::ProcessSemaphore _callback_done_sem;
        PBD::ProcessSemaphore _cleanup_sem;
 
+       /** The number of processing threads that are asleep */
        volatile gint _execution_tokens;
+       /** The number of unprocessed nodes that do not feed any other node; updated during processing */
        volatile gint _finished_refcount;
+       /** The initial number of nodes that do not feed any other node (for each chain) */
        volatile gint _init_finished_refcount[2];
 
        bool _graph_empty;
 
        // chain swapping
-       Glib::Mutex  _swap_mutex;
-       Glib::Cond   _cleanup_cond;
+       Glib::Threads::Mutex  _swap_mutex;
+        Glib::Threads::Cond   _cleanup_cond;
        volatile int _current_chain;
        volatile int _pending_chain;
        volatile int _setup_chain;
@@ -136,7 +134,7 @@ private:
 
        bool _process_silent;
        bool _process_noroll;
-       int      _process_retval;
+       int  _process_retval;
        bool _process_need_butler;
 };