From 15f1d68e9f0c22e5874d4c9613cf3006c31174b5 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 4 Jun 2010 12:09:09 +0000 Subject: more style-guidification, plus do not run process threads RT if JACK is not RT git-svn-id: svn://localhost/ardour2/branches/3.0@7232 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/graph.h | 33 +++++++++++++++------------------ libs/ardour/graph.cc | 30 +++++++++++++++++++----------- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/libs/ardour/ardour/graph.h b/libs/ardour/ardour/graph.h index e8bae4a32c..4a7d26eb8b 100644 --- a/libs/ardour/ardour/graph.h +++ b/libs/ardour/ardour/graph.h @@ -1,5 +1,6 @@ /* Copyright (C) 2010 Paul Davis + Author: Torben Hohn This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,14 +15,12 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. - */ #ifndef __ardour_graph_h__ #define __ardour_graph_h__ - #include #include #include @@ -53,18 +52,16 @@ typedef boost::shared_ptr graph_ptr_t; typedef std::list< node_ptr_t > node_list_t; typedef std::set< node_ptr_t > node_set_t; - - class Graph : public SessionHandleRef { public: - Graph( Session & session ); + Graph (Session & session); void prep(); - void trigger( GraphNode * n ); - void rechain( boost::shared_ptr r ); + void trigger (GraphNode * n); + void rechain (boost::shared_ptr r); - void dump( int chain ); + void dump (int chain); void process(); void dec_ref(); void restart_cycle(); @@ -73,16 +70,16 @@ class Graph : public SessionHandleRef void helper_thread(); void main_thread(); - int silent_process_routes (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, - bool can_record, bool rec_monitors_input, bool& need_butler ); + int silent_process_routes (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, + bool can_record, bool rec_monitors_input, bool& need_butler); - int process_routes (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, int declick, - bool can_record, bool rec_monitors_input, bool& need_butler ); + int process_routes (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, + bool can_record, bool rec_monitors_input, bool& need_butler); - int routes_no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, + int routes_no_roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool non_rt_pending, bool can_record, int declick); - void process_one_route( Route * route ); + void process_one_route (Route * route); protected: virtual void session_going_away (); @@ -119,8 +116,8 @@ class Graph : public SessionHandleRef // parameter caches. nframes_t _process_nframes; - sframes_t _process_start_frame; - sframes_t _process_end_frame; + framepos_t _process_start_frame; + framepos_t _process_end_frame; bool _process_can_record; bool _process_rec_monitors_input; bool _process_non_rt_pending; @@ -132,6 +129,6 @@ class Graph : public SessionHandleRef bool _process_need_butler; }; -} +} // namespace -#endif +#endif /* __ardour_graph_h__ */ diff --git a/libs/ardour/graph.cc b/libs/ardour/graph.cc index b998884ad0..fe5dc8aca2 100644 --- a/libs/ardour/graph.cc +++ b/libs/ardour/graph.cc @@ -290,15 +290,16 @@ Graph::run_one() if (_trigger_queue.size()) { to_run = _trigger_queue.back(); _trigger_queue.pop_back(); - } - else + } else { to_run = 0; + } - int wakeup = std::min ((int) _execution_tokens, (int) _trigger_queue.size() ); + int wakeup = std::min ((int) _execution_tokens, (int) _trigger_queue.size()); _execution_tokens -= wakeup; - for (int i=0; ijack())) { + return; + } + int priority = jack_client_real_time_priority (AudioEngine::instance()->jack()); if (priority) { @@ -344,11 +349,12 @@ Graph::helper_thread() pt->get_buffers(); get_rt(); - while(1) { - if (run_one()) + if (run_one()) { break; + } } + pt->drop_buffers(); } @@ -370,10 +376,12 @@ Graph::main_thread() goto again; } - while(1) { - if (run_one()) + while (1) { + if (run_one()) { break; + } } + pt->drop_buffers(); } @@ -405,7 +413,7 @@ Graph::dump (int chain) } int -Graph::silent_process_routes (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, +Graph::silent_process_routes (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool can_record, bool rec_monitors_input, bool& need_butler) { _process_nframes = nframes; @@ -430,7 +438,7 @@ Graph::silent_process_routes (nframes_t nframes, sframes_t start_frame, sframes_ } int -Graph::process_routes (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, int declick, +Graph::process_routes (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool can_record, bool rec_monitors_input, bool& need_butler) { _process_nframes = nframes; @@ -454,7 +462,7 @@ Graph::process_routes (nframes_t nframes, sframes_t start_frame, sframes_t end_f } int -Graph::routes_no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, +Graph::routes_no_roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool non_rt_pending, bool can_record, int declick) { _process_nframes = nframes; -- cgit v1.2.3