diff options
-rw-r--r-- | libs/ardour/ardour/port.h | 1 | ||||
-rw-r--r-- | libs/ardour/port_manager.cc | 22 |
2 files changed, 20 insertions, 3 deletions
diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h index 7284f2d9aa..983ba7c459 100644 --- a/libs/ardour/ardour/port.h +++ b/libs/ardour/ardour/port.h @@ -145,6 +145,7 @@ public: static std::string state_node_name; static pframes_t cycle_nframes () { return _cycle_nframes; } + static double speed_ratio () { return _speed_ratio; } protected: diff --git a/libs/ardour/port_manager.cc b/libs/ardour/port_manager.cc index 2b038142f8..98b85e03b7 100644 --- a/libs/ardour/port_manager.cc +++ b/libs/ardour/port_manager.cc @@ -753,7 +753,21 @@ PortManager::cycle_start (pframes_t nframes, Session* s) _cycle_ports = ports.reader (); - if (s && s->rt_tasklist ()) { + /* TODO optimize + * - when speed == 1.0, the resampler copies data without processing + * it may be more efficient to just run all in sequence + * + * - single sequential task for 'lightweight' tasks would make sense + * (run it in parallel with 'heavy' resampling. + * * output ports (sends_output()) only set a flag + * * midi-ports only scale event timestamps + * + * - a threshold parallel vs searial processing may be appropriate. + * amount of work (how many connected ports are there, how + * many resamplers need to run) vs. available CPU cores and semaphore + * synchronization overhead. + */ + if (s && s->rt_tasklist () /* && fabs (Port::speed_ratio ()) != 1.0 */) { RTTaskList::TaskList tl; for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) { tl.push_back (boost::bind (&Port::cycle_start, p->second, nframes)); @@ -769,7 +783,8 @@ PortManager::cycle_start (pframes_t nframes, Session* s) void PortManager::cycle_end (pframes_t nframes, Session* s) { - if (s && s->rt_tasklist ()) { + // see optimzation note in ::cycle_start() + if (s && s->rt_tasklist () /* && fabs (Port::speed_ratio ()) != 1.0 */) { RTTaskList::TaskList tl; for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) { tl.push_back (boost::bind (&Port::cycle_end, p->second, nframes)); @@ -871,7 +886,8 @@ PortManager::check_monitoring () void PortManager::cycle_end_fade_out (gain_t base_gain, gain_t gain_step, pframes_t nframes, Session* s) { - if (s && s->rt_tasklist ()) { + // see optimzation note in ::cycle_start() + if (s && s->rt_tasklist () /* && fabs (Port::speed_ratio ()) != 1.0 */) { RTTaskList::TaskList tl; for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) { tl.push_back (boost::bind (&Port::cycle_end, p->second, nframes)); |