mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-20 05:36:31 +01:00
NO-OP: whitespace
This commit is contained in:
parent
51f184e1a2
commit
dd1bf47394
1 changed files with 229 additions and 230 deletions
|
|
@ -52,33 +52,33 @@ int alloc_allowed ()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Graph::Graph (Session & session)
|
Graph::Graph (Session & session)
|
||||||
: SessionHandleRef (session)
|
: SessionHandleRef (session)
|
||||||
, _threads_active (false)
|
, _threads_active (false)
|
||||||
, _execution_sem ("graph_execution", 0)
|
, _execution_sem ("graph_execution", 0)
|
||||||
, _callback_start_sem ("graph_start", 0)
|
, _callback_start_sem ("graph_start", 0)
|
||||||
, _callback_done_sem ("graph_done", 0)
|
, _callback_done_sem ("graph_done", 0)
|
||||||
, _cleanup_sem ("graph_cleanup", 0)
|
, _cleanup_sem ("graph_cleanup", 0)
|
||||||
{
|
{
|
||||||
pthread_mutex_init( &_trigger_mutex, NULL);
|
pthread_mutex_init( &_trigger_mutex, NULL);
|
||||||
|
|
||||||
/* XXX: rather hacky `fix' to stop _trigger_queue.push_back() allocating
|
/* XXX: rather hacky `fix' to stop _trigger_queue.push_back() allocating
|
||||||
memory in the RT thread.
|
* memory in the RT thread.
|
||||||
*/
|
*/
|
||||||
_trigger_queue.reserve (8192);
|
_trigger_queue.reserve (8192);
|
||||||
|
|
||||||
_execution_tokens = 0;
|
_execution_tokens = 0;
|
||||||
|
|
||||||
_current_chain = 0;
|
_current_chain = 0;
|
||||||
_pending_chain = 0;
|
_pending_chain = 0;
|
||||||
_setup_chain = 1;
|
_setup_chain = 1;
|
||||||
_graph_empty = true;
|
_graph_empty = true;
|
||||||
|
|
||||||
|
|
||||||
ARDOUR::AudioEngine::instance()->Running.connect_same_thread (engine_connections, boost::bind (&Graph::reset_thread_list, this));
|
ARDOUR::AudioEngine::instance()->Running.connect_same_thread (engine_connections, boost::bind (&Graph::reset_thread_list, this));
|
||||||
ARDOUR::AudioEngine::instance()->Stopped.connect_same_thread (engine_connections, boost::bind (&Graph::engine_stopped, this));
|
ARDOUR::AudioEngine::instance()->Stopped.connect_same_thread (engine_connections, boost::bind (&Graph::engine_stopped, this));
|
||||||
ARDOUR::AudioEngine::instance()->Halted.connect_same_thread (engine_connections, boost::bind (&Graph::engine_stopped, this));
|
ARDOUR::AudioEngine::instance()->Halted.connect_same_thread (engine_connections, boost::bind (&Graph::engine_stopped, this));
|
||||||
|
|
||||||
reset_thread_list ();
|
reset_thread_list ();
|
||||||
|
|
||||||
#ifdef DEBUG_RT_ALLOC
|
#ifdef DEBUG_RT_ALLOC
|
||||||
graph = this;
|
graph = this;
|
||||||
|
|
@ -98,67 +98,67 @@ Graph::engine_stopped ()
|
||||||
void
|
void
|
||||||
Graph::reset_thread_list ()
|
Graph::reset_thread_list ()
|
||||||
{
|
{
|
||||||
uint32_t num_threads = how_many_dsp_threads ();
|
uint32_t num_threads = how_many_dsp_threads ();
|
||||||
|
|
||||||
/* For now, we shouldn't be using the graph code if we only have 1 DSP thread */
|
/* For now, we shouldn't be using the graph code if we only have 1 DSP thread */
|
||||||
assert (num_threads > 1);
|
assert (num_threads > 1);
|
||||||
|
|
||||||
/* don't bother doing anything here if we already have the right
|
/* don't bother doing anything here if we already have the right
|
||||||
number of threads.
|
* number of threads.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (AudioEngine::instance()->process_thread_count() == num_threads) {
|
if (AudioEngine::instance()->process_thread_count() == num_threads) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lm (_session.engine().process_lock());
|
Glib::Threads::Mutex::Lock lm (_session.engine().process_lock());
|
||||||
|
|
||||||
if (AudioEngine::instance()->process_thread_count() != 0) {
|
if (AudioEngine::instance()->process_thread_count() != 0) {
|
||||||
drop_threads ();
|
drop_threads ();
|
||||||
}
|
}
|
||||||
|
|
||||||
_threads_active = true;
|
_threads_active = true;
|
||||||
|
|
||||||
if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::main_thread, this)) != 0) {
|
if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::main_thread, this)) != 0) {
|
||||||
throw failed_constructor ();
|
throw failed_constructor ();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t i = 1; i < num_threads; ++i) {
|
for (uint32_t i = 1; i < num_threads; ++i) {
|
||||||
if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::helper_thread, this))) {
|
if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::helper_thread, this))) {
|
||||||
throw failed_constructor ();
|
throw failed_constructor ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Graph::session_going_away()
|
Graph::session_going_away()
|
||||||
{
|
{
|
||||||
drop_threads ();
|
drop_threads ();
|
||||||
|
|
||||||
// now drop all references on the nodes.
|
// now drop all references on the nodes.
|
||||||
_nodes_rt[0].clear();
|
_nodes_rt[0].clear();
|
||||||
_nodes_rt[1].clear();
|
_nodes_rt[1].clear();
|
||||||
_init_trigger_list[0].clear();
|
_init_trigger_list[0].clear();
|
||||||
_init_trigger_list[1].clear();
|
_init_trigger_list[1].clear();
|
||||||
_trigger_queue.clear();
|
_trigger_queue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Graph::drop_threads ()
|
Graph::drop_threads ()
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock ls (_swap_mutex);
|
Glib::Threads::Mutex::Lock ls (_swap_mutex);
|
||||||
_threads_active = false;
|
_threads_active = false;
|
||||||
|
|
||||||
uint32_t thread_count = AudioEngine::instance()->process_thread_count ();
|
uint32_t thread_count = AudioEngine::instance()->process_thread_count ();
|
||||||
|
|
||||||
for (unsigned int i=0; i < thread_count; i++) {
|
for (unsigned int i=0; i < thread_count; i++) {
|
||||||
pthread_mutex_lock (&_trigger_mutex);
|
pthread_mutex_lock (&_trigger_mutex);
|
||||||
_execution_sem.signal ();
|
_execution_sem.signal ();
|
||||||
pthread_mutex_unlock (&_trigger_mutex);
|
pthread_mutex_unlock (&_trigger_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_lock (&_trigger_mutex);
|
pthread_mutex_lock (&_trigger_mutex);
|
||||||
_callback_start_sem.signal ();
|
_callback_start_sem.signal ();
|
||||||
pthread_mutex_unlock (&_trigger_mutex);
|
pthread_mutex_unlock (&_trigger_mutex);
|
||||||
|
|
||||||
AudioEngine::instance()->join_process_threads ();
|
AudioEngine::instance()->join_process_threads ();
|
||||||
|
|
@ -169,59 +169,59 @@ Graph::drop_threads ()
|
||||||
void
|
void
|
||||||
Graph::clear_other_chain ()
|
Graph::clear_other_chain ()
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock ls (_swap_mutex);
|
Glib::Threads::Mutex::Lock ls (_swap_mutex);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (_setup_chain != _pending_chain) {
|
if (_setup_chain != _pending_chain) {
|
||||||
|
|
||||||
for (node_list_t::iterator ni=_nodes_rt[_setup_chain].begin(); ni!=_nodes_rt[_setup_chain].end(); ni++) {
|
for (node_list_t::iterator ni=_nodes_rt[_setup_chain].begin(); ni!=_nodes_rt[_setup_chain].end(); ni++) {
|
||||||
(*ni)->_activation_set[_setup_chain].clear();
|
(*ni)->_activation_set[_setup_chain].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
_nodes_rt[_setup_chain].clear ();
|
_nodes_rt[_setup_chain].clear ();
|
||||||
_init_trigger_list[_setup_chain].clear ();
|
_init_trigger_list[_setup_chain].clear ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* setup chain == pending chain - we have
|
/* setup chain == pending chain - we have
|
||||||
to wait till this is no longer true.
|
* to wait till this is no longer true.
|
||||||
*/
|
*/
|
||||||
_cleanup_cond.wait (_swap_mutex);
|
_cleanup_cond.wait (_swap_mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Graph::prep()
|
Graph::prep()
|
||||||
{
|
{
|
||||||
node_list_t::iterator i;
|
node_list_t::iterator i;
|
||||||
int chain;
|
int chain;
|
||||||
|
|
||||||
if (_swap_mutex.trylock()) {
|
if (_swap_mutex.trylock()) {
|
||||||
// we got the swap mutex.
|
// we got the swap mutex.
|
||||||
if (_current_chain != _pending_chain)
|
if (_current_chain != _pending_chain)
|
||||||
{
|
{
|
||||||
// printf ("chain swap ! %d -> %d\n", _current_chain, _pending_chain);
|
// printf ("chain swap ! %d -> %d\n", _current_chain, _pending_chain);
|
||||||
_setup_chain = _current_chain;
|
_setup_chain = _current_chain;
|
||||||
_current_chain = _pending_chain;
|
_current_chain = _pending_chain;
|
||||||
_cleanup_cond.signal ();
|
_cleanup_cond.signal ();
|
||||||
}
|
}
|
||||||
_swap_mutex.unlock ();
|
_swap_mutex.unlock ();
|
||||||
}
|
}
|
||||||
|
|
||||||
chain = _current_chain;
|
chain = _current_chain;
|
||||||
|
|
||||||
_graph_empty = true;
|
_graph_empty = true;
|
||||||
for (i=_nodes_rt[chain].begin(); i!=_nodes_rt[chain].end(); i++) {
|
for (i=_nodes_rt[chain].begin(); i!=_nodes_rt[chain].end(); i++) {
|
||||||
(*i)->prep( chain);
|
(*i)->prep( chain);
|
||||||
_graph_empty = false;
|
_graph_empty = false;
|
||||||
}
|
}
|
||||||
_finished_refcount = _init_finished_refcount[chain];
|
_finished_refcount = _init_finished_refcount[chain];
|
||||||
|
|
||||||
/* Trigger the initial nodes for processing, which are the ones at the `input' end */
|
/* Trigger the initial nodes for processing, which are the ones at the `input' end */
|
||||||
pthread_mutex_lock (&_trigger_mutex);
|
pthread_mutex_lock (&_trigger_mutex);
|
||||||
for (i=_init_trigger_list[chain].begin(); i!=_init_trigger_list[chain].end(); i++) {
|
for (i=_init_trigger_list[chain].begin(); i!=_init_trigger_list[chain].end(); i++) {
|
||||||
/* don't use ::trigger here, as we have already locked the mutex */
|
/* don't use ::trigger here, as we have already locked the mutex */
|
||||||
_trigger_queue.push_back (i->get ());
|
_trigger_queue.push_back (i->get ());
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock (&_trigger_mutex);
|
pthread_mutex_unlock (&_trigger_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -229,7 +229,7 @@ void
|
||||||
Graph::trigger (GraphNode* n)
|
Graph::trigger (GraphNode* n)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock (&_trigger_mutex);
|
pthread_mutex_lock (&_trigger_mutex);
|
||||||
_trigger_queue.push_back (n);
|
_trigger_queue.push_back (n);
|
||||||
pthread_mutex_unlock (&_trigger_mutex);
|
pthread_mutex_unlock (&_trigger_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -239,78 +239,77 @@ Graph::trigger (GraphNode* n)
|
||||||
void
|
void
|
||||||
Graph::dec_ref()
|
Graph::dec_ref()
|
||||||
{
|
{
|
||||||
if (g_atomic_int_dec_and_test (const_cast<gint*> (&_finished_refcount))) {
|
if (g_atomic_int_dec_and_test (const_cast<gint*> (&_finished_refcount))) {
|
||||||
|
|
||||||
/* We have run all the nodes that are at the `output' end of
|
/* We have run all the nodes that are at the `output' end of
|
||||||
the graph, so there is nothing more to do this time around.
|
* the graph, so there is nothing more to do this time around.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
restart_cycle ();
|
restart_cycle ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Graph::restart_cycle()
|
Graph::restart_cycle()
|
||||||
{
|
{
|
||||||
// we are through. wakeup our caller.
|
// we are through. wakeup our caller.
|
||||||
|
|
||||||
again:
|
again:
|
||||||
_callback_done_sem.signal ();
|
_callback_done_sem.signal ();
|
||||||
|
|
||||||
/* Block until the a process callback triggers us */
|
/* Block until the a process callback triggers us */
|
||||||
_callback_start_sem.wait();
|
_callback_start_sem.wait();
|
||||||
|
|
||||||
if (!_threads_active) {
|
if (!_threads_active) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
prep ();
|
prep ();
|
||||||
|
|
||||||
if (_graph_empty && _threads_active) {
|
if (_graph_empty && _threads_active) {
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returning will restart the cycle.
|
// returning will restart the cycle.
|
||||||
// starting with waking up the others.
|
// starting with waking up the others.
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Rechain our stuff using a list of routes (which can be in any order) and
|
/** Rechain our stuff using a list of routes (which can be in any order) and
|
||||||
* a directed graph of their interconnections, which is guaranteed to be
|
* a directed graph of their interconnections, which is guaranteed to be
|
||||||
* acyclic.
|
* acyclic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
Graph::rechain (boost::shared_ptr<RouteList> routelist, GraphEdges const & edges)
|
Graph::rechain (boost::shared_ptr<RouteList> routelist, GraphEdges const & edges)
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock ls (_swap_mutex);
|
Glib::Threads::Mutex::Lock ls (_swap_mutex);
|
||||||
|
|
||||||
int chain = _setup_chain;
|
int chain = _setup_chain;
|
||||||
DEBUG_TRACE (DEBUG::Graph, string_compose ("============== setup %1\n", chain));
|
DEBUG_TRACE (DEBUG::Graph, string_compose ("============== setup %1\n", chain));
|
||||||
|
|
||||||
/* This will become the number of nodes that do not feed any other node;
|
/* This will become the number of nodes that do not feed any other node;
|
||||||
once we have processed this number of those nodes, we have finished.
|
* once we have processed this number of those nodes, we have finished.
|
||||||
*/
|
*/
|
||||||
_init_finished_refcount[chain] = 0;
|
_init_finished_refcount[chain] = 0;
|
||||||
|
|
||||||
/* This will become a list of nodes that are not fed by another node, ie
|
/* This will become a list of nodes that are not fed by another node, ie
|
||||||
those at the `input' end.
|
* those at the `input' end.
|
||||||
*/
|
*/
|
||||||
_init_trigger_list[chain].clear();
|
_init_trigger_list[chain].clear();
|
||||||
|
|
||||||
_nodes_rt[chain].clear();
|
_nodes_rt[chain].clear();
|
||||||
|
|
||||||
/* Clear things out, and make _nodes_rt[chain] a copy of routelist */
|
/* Clear things out, and make _nodes_rt[chain] a copy of routelist */
|
||||||
for (RouteList::iterator ri=routelist->begin(); ri!=routelist->end(); ri++) {
|
for (RouteList::iterator ri=routelist->begin(); ri!=routelist->end(); ri++) {
|
||||||
(*ri)->_init_refcount[chain] = 0;
|
(*ri)->_init_refcount[chain] = 0;
|
||||||
(*ri)->_activation_set[chain].clear();
|
(*ri)->_activation_set[chain].clear();
|
||||||
_nodes_rt[chain].push_back (*ri);
|
_nodes_rt[chain].push_back (*ri);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now add refs for the connections.
|
// now add refs for the connections.
|
||||||
|
|
||||||
for (node_list_t::iterator ni = _nodes_rt[chain].begin(); ni != _nodes_rt[chain].end(); ni++) {
|
for (node_list_t::iterator ni = _nodes_rt[chain].begin(); ni != _nodes_rt[chain].end(); ni++) {
|
||||||
|
|
||||||
boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route> (*ni);
|
boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route> (*ni);
|
||||||
|
|
||||||
/* The routes that are directly fed by r */
|
/* The routes that are directly fed by r */
|
||||||
set<GraphVertex> fed_from_r = edges.from (r);
|
set<GraphVertex> fed_from_r = edges.from (r);
|
||||||
|
|
@ -327,25 +326,25 @@ Graph::rechain (boost::shared_ptr<RouteList> routelist, GraphEdges const & edges
|
||||||
bool const has_input = !edges.has_none_to (r);
|
bool const has_input = !edges.has_none_to (r);
|
||||||
|
|
||||||
/* Increment the refcount of any route that we directly feed */
|
/* Increment the refcount of any route that we directly feed */
|
||||||
for (node_set_t::iterator ai = r->_activation_set[chain].begin(); ai != r->_activation_set[chain].end(); ai++) {
|
for (node_set_t::iterator ai = r->_activation_set[chain].begin(); ai != r->_activation_set[chain].end(); ai++) {
|
||||||
(*ai)->_init_refcount[chain] += 1;
|
(*ai)->_init_refcount[chain] += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!has_input) {
|
if (!has_input) {
|
||||||
/* no input, so this node needs to be triggered initially to get things going */
|
/* no input, so this node needs to be triggered initially to get things going */
|
||||||
_init_trigger_list[chain].push_back (*ni);
|
_init_trigger_list[chain].push_back (*ni);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!has_output) {
|
if (!has_output) {
|
||||||
/* no output, so this is one of the nodes that we can count off to decide
|
/* no output, so this is one of the nodes that we can count off to decide
|
||||||
if we've finished
|
* if we've finished
|
||||||
*/
|
*/
|
||||||
_init_finished_refcount[chain] += 1;
|
_init_finished_refcount[chain] += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_pending_chain = chain;
|
_pending_chain = chain;
|
||||||
dump(chain);
|
dump(chain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Called by both the main thread and all helpers.
|
/** Called by both the main thread and all helpers.
|
||||||
|
|
@ -354,15 +353,15 @@ Graph::rechain (boost::shared_ptr<RouteList> routelist, GraphEdges const & edges
|
||||||
bool
|
bool
|
||||||
Graph::run_one()
|
Graph::run_one()
|
||||||
{
|
{
|
||||||
GraphNode* to_run;
|
GraphNode* to_run;
|
||||||
|
|
||||||
pthread_mutex_lock (&_trigger_mutex);
|
pthread_mutex_lock (&_trigger_mutex);
|
||||||
if (_trigger_queue.size()) {
|
if (_trigger_queue.size()) {
|
||||||
to_run = _trigger_queue.back();
|
to_run = _trigger_queue.back();
|
||||||
_trigger_queue.pop_back();
|
_trigger_queue.pop_back();
|
||||||
} else {
|
} else {
|
||||||
to_run = 0;
|
to_run = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the number of threads that are asleep */
|
/* the number of threads that are asleep */
|
||||||
int et = _execution_tokens;
|
int et = _execution_tokens;
|
||||||
|
|
@ -370,39 +369,39 @@ Graph::run_one()
|
||||||
int ts = _trigger_queue.size();
|
int ts = _trigger_queue.size();
|
||||||
|
|
||||||
/* hence how many threads to wake up */
|
/* hence how many threads to wake up */
|
||||||
int wakeup = min (et, ts);
|
int wakeup = min (et, ts);
|
||||||
/* update the number of threads that will still be sleeping */
|
/* update the number of threads that will still be sleeping */
|
||||||
_execution_tokens -= wakeup;
|
_execution_tokens -= wakeup;
|
||||||
|
|
||||||
DEBUG_TRACE(DEBUG::ProcessThreads, string_compose ("%1 signals %2\n", pthread_name(), wakeup));
|
DEBUG_TRACE(DEBUG::ProcessThreads, string_compose ("%1 signals %2\n", pthread_name(), wakeup));
|
||||||
|
|
||||||
for (int i = 0; i < wakeup; i++) {
|
for (int i = 0; i < wakeup; i++) {
|
||||||
_execution_sem.signal ();
|
_execution_sem.signal ();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (to_run == 0) {
|
while (to_run == 0) {
|
||||||
_execution_tokens += 1;
|
_execution_tokens += 1;
|
||||||
pthread_mutex_unlock (&_trigger_mutex);
|
pthread_mutex_unlock (&_trigger_mutex);
|
||||||
DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 goes to sleep\n", pthread_name()));
|
DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 goes to sleep\n", pthread_name()));
|
||||||
_execution_sem.wait ();
|
_execution_sem.wait ();
|
||||||
if (!_threads_active) {
|
if (!_threads_active) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 is awake\n", pthread_name()));
|
DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 is awake\n", pthread_name()));
|
||||||
pthread_mutex_lock (&_trigger_mutex);
|
pthread_mutex_lock (&_trigger_mutex);
|
||||||
if (_trigger_queue.size()) {
|
if (_trigger_queue.size()) {
|
||||||
to_run = _trigger_queue.back();
|
to_run = _trigger_queue.back();
|
||||||
_trigger_queue.pop_back();
|
_trigger_queue.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock (&_trigger_mutex);
|
pthread_mutex_unlock (&_trigger_mutex);
|
||||||
|
|
||||||
to_run->process();
|
to_run->process();
|
||||||
to_run->finish (_current_chain);
|
to_run->finish (_current_chain);
|
||||||
|
|
||||||
DEBUG_TRACE(DEBUG::ProcessThreads, string_compose ("%1 has finished run_one()\n", pthread_name()));
|
DEBUG_TRACE(DEBUG::ProcessThreads, string_compose ("%1 has finished run_one()\n", pthread_name()));
|
||||||
|
|
||||||
return !_threads_active;
|
return !_threads_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -467,26 +466,26 @@ void
|
||||||
Graph::dump (int chain)
|
Graph::dump (int chain)
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
node_list_t::iterator ni;
|
node_list_t::iterator ni;
|
||||||
node_set_t::iterator ai;
|
node_set_t::iterator ai;
|
||||||
|
|
||||||
chain = _pending_chain;
|
chain = _pending_chain;
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::Graph, "--------------------------------------------Graph dump:\n");
|
DEBUG_TRACE (DEBUG::Graph, "--------------------------------------------Graph dump:\n");
|
||||||
for (ni=_nodes_rt[chain].begin(); ni!=_nodes_rt[chain].end(); ni++) {
|
for (ni=_nodes_rt[chain].begin(); ni!=_nodes_rt[chain].end(); ni++) {
|
||||||
boost::shared_ptr<Route> rp = boost::dynamic_pointer_cast<Route>( *ni);
|
boost::shared_ptr<Route> rp = boost::dynamic_pointer_cast<Route>( *ni);
|
||||||
DEBUG_TRACE (DEBUG::Graph, string_compose ("GraphNode: %1 refcount: %2\n", rp->name().c_str(), (*ni)->_init_refcount[chain]));
|
DEBUG_TRACE (DEBUG::Graph, string_compose ("GraphNode: %1 refcount: %2\n", rp->name().c_str(), (*ni)->_init_refcount[chain]));
|
||||||
for (ai=(*ni)->_activation_set[chain].begin(); ai!=(*ni)->_activation_set[chain].end(); ai++) {
|
for (ai=(*ni)->_activation_set[chain].begin(); ai!=(*ni)->_activation_set[chain].end(); ai++) {
|
||||||
DEBUG_TRACE (DEBUG::Graph, string_compose (" triggers: %1\n", boost::dynamic_pointer_cast<Route>(*ai)->name().c_str()));
|
DEBUG_TRACE (DEBUG::Graph, string_compose (" triggers: %1\n", boost::dynamic_pointer_cast<Route>(*ai)->name().c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::Graph, "------------- trigger list:\n");
|
DEBUG_TRACE (DEBUG::Graph, "------------- trigger list:\n");
|
||||||
for (ni=_init_trigger_list[chain].begin(); ni!=_init_trigger_list[chain].end(); ni++) {
|
for (ni=_init_trigger_list[chain].begin(); ni!=_init_trigger_list[chain].end(); ni++) {
|
||||||
DEBUG_TRACE (DEBUG::Graph, string_compose ("GraphNode: %1 refcount: %2\n", boost::dynamic_pointer_cast<Route>(*ni)->name().c_str(), (*ni)->_init_refcount[chain]));
|
DEBUG_TRACE (DEBUG::Graph, string_compose ("GraphNode: %1 refcount: %2\n", boost::dynamic_pointer_cast<Route>(*ni)->name().c_str(), (*ni)->_init_refcount[chain]));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::Graph, string_compose ("final activation refcount: %1\n", _init_finished_refcount[chain]));
|
DEBUG_TRACE (DEBUG::Graph, string_compose ("final activation refcount: %1\n", _init_finished_refcount[chain]));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -495,24 +494,24 @@ Graph::silent_process_routes (pframes_t nframes, framepos_t start_frame, framepo
|
||||||
{
|
{
|
||||||
if (!_threads_active) return 0;
|
if (!_threads_active) return 0;
|
||||||
|
|
||||||
_process_nframes = nframes;
|
_process_nframes = nframes;
|
||||||
_process_start_frame = start_frame;
|
_process_start_frame = start_frame;
|
||||||
_process_end_frame = end_frame;
|
_process_end_frame = end_frame;
|
||||||
|
|
||||||
_process_silent = true;
|
_process_silent = true;
|
||||||
_process_noroll = false;
|
_process_noroll = false;
|
||||||
_process_retval = 0;
|
_process_retval = 0;
|
||||||
_process_need_butler = false;
|
_process_need_butler = false;
|
||||||
|
|
||||||
if (!_graph_empty) {
|
if (!_graph_empty) {
|
||||||
DEBUG_TRACE(DEBUG::ProcessThreads, "wake graph for silent process\n");
|
DEBUG_TRACE(DEBUG::ProcessThreads, "wake graph for silent process\n");
|
||||||
_callback_start_sem.signal ();
|
_callback_start_sem.signal ();
|
||||||
_callback_done_sem.wait ();
|
_callback_done_sem.wait ();
|
||||||
}
|
}
|
||||||
|
|
||||||
need_butler = _process_need_butler;
|
need_butler = _process_need_butler;
|
||||||
|
|
||||||
return _process_retval;
|
return _process_retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -522,25 +521,25 @@ Graph::process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end
|
||||||
|
|
||||||
if (!_threads_active) return 0;
|
if (!_threads_active) return 0;
|
||||||
|
|
||||||
_process_nframes = nframes;
|
_process_nframes = nframes;
|
||||||
_process_start_frame = start_frame;
|
_process_start_frame = start_frame;
|
||||||
_process_end_frame = end_frame;
|
_process_end_frame = end_frame;
|
||||||
_process_declick = declick;
|
_process_declick = declick;
|
||||||
|
|
||||||
_process_silent = false;
|
_process_silent = false;
|
||||||
_process_noroll = false;
|
_process_noroll = false;
|
||||||
_process_retval = 0;
|
_process_retval = 0;
|
||||||
_process_need_butler = false;
|
_process_need_butler = false;
|
||||||
|
|
||||||
DEBUG_TRACE(DEBUG::ProcessThreads, "wake graph for non-silent process\n");
|
DEBUG_TRACE(DEBUG::ProcessThreads, "wake graph for non-silent process\n");
|
||||||
_callback_start_sem.signal ();
|
_callback_start_sem.signal ();
|
||||||
_callback_done_sem.wait ();
|
_callback_done_sem.wait ();
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::ProcessThreads, "graph execution complete\n");
|
DEBUG_TRACE (DEBUG::ProcessThreads, "graph execution complete\n");
|
||||||
|
|
||||||
need_butler = _process_need_butler;
|
need_butler = _process_need_butler;
|
||||||
|
|
||||||
return _process_retval;
|
return _process_retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -551,50 +550,50 @@ Graph::routes_no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end
|
||||||
|
|
||||||
if (!_threads_active) return 0;
|
if (!_threads_active) return 0;
|
||||||
|
|
||||||
_process_nframes = nframes;
|
_process_nframes = nframes;
|
||||||
_process_start_frame = start_frame;
|
_process_start_frame = start_frame;
|
||||||
_process_end_frame = end_frame;
|
_process_end_frame = end_frame;
|
||||||
_process_declick = declick;
|
_process_declick = declick;
|
||||||
_process_non_rt_pending = non_rt_pending;
|
_process_non_rt_pending = non_rt_pending;
|
||||||
|
|
||||||
_process_silent = false;
|
_process_silent = false;
|
||||||
_process_noroll = true;
|
_process_noroll = true;
|
||||||
_process_retval = 0;
|
_process_retval = 0;
|
||||||
_process_need_butler = false;
|
_process_need_butler = false;
|
||||||
|
|
||||||
DEBUG_TRACE(DEBUG::ProcessThreads, "wake graph for no-roll process\n");
|
DEBUG_TRACE(DEBUG::ProcessThreads, "wake graph for no-roll process\n");
|
||||||
_callback_start_sem.signal ();
|
_callback_start_sem.signal ();
|
||||||
_callback_done_sem.wait ();
|
_callback_done_sem.wait ();
|
||||||
|
|
||||||
return _process_retval;
|
return _process_retval;
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
Graph::process_one_route (Route* route)
|
Graph::process_one_route (Route* route)
|
||||||
{
|
{
|
||||||
bool need_butler = false;
|
bool need_butler = false;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
assert (route);
|
assert (route);
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 runs route %2\n", pthread_name(), route->name()));
|
DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 runs route %2\n", pthread_name(), route->name()));
|
||||||
|
|
||||||
if (_process_silent) {
|
if (_process_silent) {
|
||||||
retval = route->silent_roll (_process_nframes, _process_start_frame, _process_end_frame, need_butler);
|
retval = route->silent_roll (_process_nframes, _process_start_frame, _process_end_frame, need_butler);
|
||||||
} else if (_process_noroll) {
|
} else if (_process_noroll) {
|
||||||
route->set_pending_declick (_process_declick);
|
route->set_pending_declick (_process_declick);
|
||||||
retval = route->no_roll (_process_nframes, _process_start_frame, _process_end_frame, _process_non_rt_pending);
|
retval = route->no_roll (_process_nframes, _process_start_frame, _process_end_frame, _process_non_rt_pending);
|
||||||
} else {
|
} else {
|
||||||
route->set_pending_declick (_process_declick);
|
route->set_pending_declick (_process_declick);
|
||||||
retval = route->roll (_process_nframes, _process_start_frame, _process_end_frame, _process_declick, need_butler);
|
retval = route->roll (_process_nframes, _process_start_frame, _process_end_frame, _process_declick, need_butler);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retval) {
|
if (retval) {
|
||||||
_process_retval = retval;
|
_process_retval = retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (need_butler) {
|
if (need_butler) {
|
||||||
_process_need_butler = true;
|
_process_need_butler = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue