diff options
author | Robin Gareus <robin@gareus.org> | 2017-10-30 15:58:36 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-10-30 16:31:38 +0100 |
commit | 471644c59db05ed5b73253e545ef20cdd3d58fd8 (patch) | |
tree | 3925356ba2dd44e366b3480df4bed4798f467eaf /libs/ardour/port_manager.cc | |
parent | fba0fce4416578de29b7701cf4d400399d44ceff (diff) |
Parallel execution of cycle-start/end
Diffstat (limited to 'libs/ardour/port_manager.cc')
-rw-r--r-- | libs/ardour/port_manager.cc | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/libs/ardour/port_manager.cc b/libs/ardour/port_manager.cc index 1ef7ca1d8b..eae1654543 100644 --- a/libs/ardour/port_manager.cc +++ b/libs/ardour/port_manager.cc @@ -38,6 +38,7 @@ #include "ardour/midiport_manager.h" #include "ardour/port_manager.h" #include "ardour/profile.h" +#include "ardour/rt_tasklist.h" #include "ardour/session.h" #include "ardour/types_convert.h" @@ -745,24 +746,39 @@ PortManager::graph_order_callback () } void -PortManager::cycle_start (pframes_t nframes) +PortManager::cycle_start (pframes_t nframes, Session* s) { Port::set_global_port_buffer_offset (0); Port::set_cycle_samplecnt (nframes); _cycle_ports = ports.reader (); - // TODO parallelize - for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) { - p->second->cycle_start (nframes); + if (s && s->rt_tasklist ()) { + 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)); + } + s->rt_tasklist()->process (tl); + } else { + for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) { + p->second->cycle_start (nframes); + } } } void -PortManager::cycle_end (pframes_t nframes) +PortManager::cycle_end (pframes_t nframes, Session* s) { - for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) { - p->second->cycle_end (nframes); + if (s && s->rt_tasklist ()) { + 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)); + } + s->rt_tasklist()->process (tl); + } else { + for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) { + p->second->cycle_end (nframes); + } } for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) { |