diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-07-22 15:44:13 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-07-22 15:44:13 +0000 |
commit | 862972eaaa2232c399bb819eb1092379689d747e (patch) | |
tree | e0c1e80f9585f58df763d06b8604e8ffccc26b8b /libs/ardour/buffer_set.cc | |
parent | 1d7190b18671bf6ff33136cd157de9e6435176c6 (diff) |
use std::vector::assign() in BufferSet::attach_buffers() rather than an explicit loop; minor formatting touchups
git-svn-id: svn://localhost/ardour2/branches/3.0@9912 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/buffer_set.cc')
-rw-r--r-- | libs/ardour/buffer_set.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libs/ardour/buffer_set.cc b/libs/ardour/buffer_set.cc index 3c66bddbb7..56245882d6 100644 --- a/libs/ardour/buffer_set.cc +++ b/libs/ardour/buffer_set.cc @@ -23,7 +23,9 @@ #include <iostream> #include <algorithm> + #include "pbd/compose.h" + #include "ardour/buffer.h" #include "ardour/buffer_set.h" #include "ardour/debug.h" @@ -93,27 +95,27 @@ BufferSet::clear() void BufferSet::attach_buffers (PortSet& ports) { - clear(); + const ChanCount& count (ports.count()); + + clear (); for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { - _buffers.push_back(BufferVec()); + _buffers.push_back (BufferVec()); BufferVec& v = _buffers[*t]; - - for (PortSet::iterator p = ports.begin(*t); p != ports.end(*t); ++p) { - assert(p->type() == *t); - v.push_back (0); - } + v.assign (count.n (*t), (Buffer*) 0); } _count = ports.count(); _available = ports.count(); + _is_mirror = true; } /** Write the JACK port addresses from a PortSet into our data structures. This * call assumes that attach_buffers() has already been called for the same PortSet. - * Does not allocate, so RT-safe. + * Does not allocate, so RT-safe BUT you can only call Port::get_buffer() from + * the process() callback tree anyway, so this has to be called in RT context. */ void BufferSet::get_jack_port_addresses (PortSet& ports, framecnt_t nframes) |