675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <iostream>
#include <algorithm>
-#include <ardour/buffer_set.h>
-#include <ardour/buffer.h>
-#include <ardour/port.h>
-#include <ardour/port_set.h>
+#include "ardour/buffer_set.h"
+#include "ardour/buffer.h"
+#include "ardour/port.h"
+#include "ardour/port_set.h"
namespace ARDOUR {
/** Make this BufferSet a direct mirror of a PortSet's buffers.
*/
void
-BufferSet::attach_buffers(PortSet& ports)
+BufferSet::attach_buffers(PortSet& ports, nframes_t nframes, nframes_t offset)
{
clear();
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
_buffers.push_back(BufferVec());
- BufferVec& v = _buffers[(*t).to_index()];
+ BufferVec& v = _buffers[*t];
for (PortSet::iterator p = ports.begin(*t); p != ports.end(*t); ++p) {
assert(p->type() == *t);
- v.push_back(&(p->get_buffer()));
+ v.push_back(&(p->get_buffer(nframes, offset)));
}
-
}
_count = ports.count();
BufferSet::ensure_buffers(DataType type, size_t num_buffers, size_t buffer_capacity)
{
assert(type != DataType::NIL);
- assert(type.to_index() < _buffers.size());
+ assert(type < _buffers.size());
+ assert(buffer_capacity > 0);
if (num_buffers == 0)
return;
+ // FIXME: Kludge to make MIDI buffers larger (size is bytes, not frames)
+ // See MidiPort::MidiPort
+ // We probably need a map<DataType, size_t> parameter for capacity
+ if (type == DataType::MIDI)
+ buffer_capacity *= 8;
+
// The vector of buffers of the type we care about
- BufferVec& bufs = _buffers[type.to_index()];
+ BufferVec& bufs = _buffers[type];
// If we're a mirror just make sure we're ok
if (_is_mirror) {
BufferSet::buffer_capacity(DataType type) const
{
assert(_available.get(type) > 0);
- return _buffers[type.to_index()][0]->capacity();
+ return _buffers[type][0]->capacity();
}
// FIXME: make 'in' const
void
-BufferSet::read_from(BufferSet& in, jack_nframes_t nframes, jack_nframes_t offset)
+BufferSet::read_from(BufferSet& in, nframes_t nframes, nframes_t offset)
{
assert(available() >= in.count());