2 Copyright (C) 2010 Paul Davis
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __ardour_graph_h__
22 #define __ardour_graph_h__
29 #include <boost/shared_ptr.hpp>
31 #include <glib/gatomic.h>
35 #include <semaphore.h>
37 #include "ardour/types.h"
38 #include "ardour/session_handle.h"
49 typedef boost::shared_ptr<GraphNode> node_ptr_t;
50 typedef boost::shared_ptr<Graph> graph_ptr_t;
52 typedef std::list< node_ptr_t > node_list_t;
53 typedef std::set< node_ptr_t > node_set_t;
55 class Graph : public SessionHandleRef
58 Graph (Session & session);
61 void trigger (GraphNode * n);
62 void rechain (boost::shared_ptr<RouteList> r);
64 void dump (int chain);
73 int silent_process_routes (nframes_t nframes, framepos_t start_frame, framepos_t end_frame,
74 bool can_record, bool rec_monitors_input, bool& need_butler);
76 int process_routes (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick,
77 bool can_record, bool rec_monitors_input, bool& need_butler);
79 int routes_no_roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame,
80 bool non_rt_pending, bool can_record, int declick);
82 void process_one_route (Route * route);
84 void clear_other_chain ();
87 virtual void session_going_away ();
90 std::list<pthread_t> _thread_list;
91 volatile bool _quit_threads;
93 node_list_t _nodes_rt[2];
95 node_list_t _init_trigger_list[2];
97 std::vector<GraphNode *> _trigger_queue;
98 pthread_mutex_t _trigger_mutex;
100 sem_t _execution_sem;
101 sem_t _callback_start_sem;
102 sem_t _callback_done_sem;
105 volatile gint _execution_tokens;
106 volatile gint _finished_refcount;
107 volatile gint _init_finished_refcount[2];
112 Glib::Mutex _swap_mutex;
113 Glib::Cond _cleanup_cond;
114 volatile int _current_chain;
115 volatile int _pending_chain;
116 volatile int _setup_chain;
119 nframes_t _process_nframes;
120 framepos_t _process_start_frame;
121 framepos_t _process_end_frame;
122 bool _process_can_record;
123 bool _process_rec_monitors_input;
124 bool _process_non_rt_pending;
125 int _process_declick;
127 bool _process_silent;
128 bool _process_noroll;
130 bool _process_need_butler;
135 #endif /* __ardour_graph_h__ */