From 44d938b6b2010a7bca1f14eb9b2fec3aa41770d1 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 7 Feb 2011 17:01:43 +0000 Subject: [PATCH] if using only 1 processor for DSP, do not use the graph code to execute routes - fallback to original unthreaded code git-svn-id: svn://localhost/ardour2/branches/3.0@8741 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/session_process.cc | 144 +++++++++++++++++---------------- 1 file changed, 76 insertions(+), 68 deletions(-) diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 4d18aaf73c..61c35da480 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -106,25 +106,26 @@ Session::no_roll (pframes_t nframes) _click_io->silence (nframes); } - DEBUG_TRACE(DEBUG::Graph,"calling graph/no-roll\n"); - route_graph->routes_no_roll( nframes, _transport_frame, end_frame, non_realtime_work_pending(), actively_recording(), declick); - /* - for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - - if ((*i)->is_hidden()) { - continue; - } - - (*i)->set_pending_declick (declick); - - if ((*i)->no_roll (nframes, _transport_frame, end_frame, non_realtime_work_pending(), - actively_recording(), declick)) { - error << string_compose(_("Session: error in no roll for %1"), (*i)->name()) << endmsg; - ret = -1; - break; - } - } - */ + if (Config->get_processor_usage() != 1) { + DEBUG_TRACE(DEBUG::Graph,"calling graph/no-roll\n"); + route_graph->routes_no_roll( nframes, _transport_frame, end_frame, non_realtime_work_pending(), actively_recording(), declick); + } else { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + + if ((*i)->is_hidden()) { + continue; + } + + (*i)->set_pending_declick (declick); + + if ((*i)->no_roll (nframes, _transport_frame, end_frame, non_realtime_work_pending(), + actively_recording(), declick)) { + error << string_compose(_("Session: error in no roll for %1"), (*i)->name()) << endmsg; + ret = -1; + break; + } + } + } return ret; } @@ -132,40 +133,44 @@ Session::no_roll (pframes_t nframes) int Session::process_routes (pframes_t nframes, bool& need_butler) { - bool record_active; - int declick = get_transport_declick_required(); - bool rec_monitors = get_rec_monitors_input(); - boost::shared_ptr r = routes.reader (); - - if (transport_sub_state & StopPendingCapture) { - /* force a declick out */ - declick = -1; - } - - record_active = actively_recording(); // || (get_record_enabled() && get_punch_in()); - - const framepos_t start_frame = _transport_frame; - const framepos_t end_frame = _transport_frame + floor (nframes * _transport_speed); - - DEBUG_TRACE(DEBUG::Graph,"calling graph/process-routes\n"); - route_graph->process_routes( nframes, start_frame, end_frame, declick, record_active, rec_monitors, need_butler); -/* - for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - - int ret; - - if ((*i)->is_hidden()) { - continue; - } - - (*i)->set_pending_declick (declick); + bool record_active; + int declick = get_transport_declick_required(); + bool rec_monitors = get_rec_monitors_input(); + boost::shared_ptr r = routes.reader (); + + if (transport_sub_state & StopPendingCapture) { + /* force a declick out */ + declick = -1; + } + + record_active = actively_recording(); // || (get_record_enabled() && get_punch_in()); + + const framepos_t start_frame = _transport_frame; + const framepos_t end_frame = _transport_frame + floor (nframes * _transport_speed); + + if (Config->get_processor_usage() != 1) { + DEBUG_TRACE(DEBUG::Graph,"calling graph/process-routes\n"); + route_graph->process_routes( nframes, start_frame, end_frame, declick, record_active, rec_monitors, need_butler); + + } else { + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + + int ret; + + if ((*i)->is_hidden()) { + continue; + } + + (*i)->set_pending_declick (declick); + + if ((ret = (*i)->roll (nframes, start_frame, end_frame, declick, record_active, rec_monitors, need_butler)) < 0) { + stop_transport (); + return -1; + } + } + } - if ((ret = (*i)->roll (nframes, start_frame, end_frame, declick, record_active, rec_monitors, need_butler)) < 0) { - stop_transport (); - return -1; - } - } -*/ return 0; } @@ -185,22 +190,25 @@ Session::silent_process_routes (pframes_t nframes, bool& need_butler) const framepos_t start_frame = _transport_frame; const framepos_t end_frame = _transport_frame + lrintf(nframes * _transport_speed); - route_graph->silent_process_routes( nframes, start_frame, end_frame, record_active, rec_monitors, need_butler); -/* - for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - - int ret; - - if ((*i)->is_hidden()) { - continue; - } + if (Config->get_processor_usage() != 1) { + cerr << "GRAPH PROCESS\n"; + route_graph->silent_process_routes( nframes, start_frame, end_frame, record_active, rec_monitors, need_butler); + } else { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + + int ret; + + if ((*i)->is_hidden()) { + continue; + } + + if ((ret = (*i)->silent_roll (nframes, start_frame, end_frame, record_active, rec_monitors, need_butler)) < 0) { + stop_transport (); + return -1; + } + } + } - if ((ret = (*i)->silent_roll (nframes, start_frame, end_frame, record_active, rec_monitors, need_butler)) < 0) { - stop_transport (); - return -1; - } - } -*/ return 0; } @@ -716,7 +724,7 @@ Session::track_slave_state (float slave_speed, framepos_t slave_transport_frame, if (_transport_speed != 0.0f) { DEBUG_TRACE (DEBUG::Slave, string_compose ("slave stops transport: %1 frame %2 tf %3\n", slave_speed, slave_transport_frame, _transport_frame)); - stop_transport(); + stop_transport (); } if (slave_transport_frame != _transport_frame) { -- 2.30.2