#include <vector>
#include <ardour/chan_count.h>
#include <ardour/data_type.h>
+#include <ardour/types.h>
namespace ARDOUR {
class Buffer;
class AudioBuffer;
+class MidiBuffer;
class PortSet;
void clear();
- void attach_buffers(PortSet& ports);
+ void attach_buffers(PortSet& ports, nframes_t nframes, nframes_t offset);
void ensure_buffers(const ChanCount& count, size_t buffer_capacity);
void ensure_buffers(DataType type, size_t num_buffers, size_t buffer_capacity);
Buffer& get(DataType type, size_t i)
{
assert(i <= _count.get(type));
- return *_buffers[type.to_index()][i];
+ return *_buffers[type][i];
}
AudioBuffer& get_audio(size_t i)
{
return (AudioBuffer&)get(DataType::AUDIO, i);
}
-
- void read_from(BufferSet& in, jack_nframes_t nframes, jack_nframes_t offset=0)
+
+ MidiBuffer& get_midi(size_t i)
{
- throw; // FIXME: implement this with spiffy DataType iterator etc.
+ return (MidiBuffer&)get(DataType::MIDI, i);
}
+ void read_from(BufferSet& in, jack_nframes_t nframes, jack_nframes_t offset=0);
+
// ITERATORS
// FIXME: this is a filthy copy-and-paste mess
};
audio_iterator audio_begin() { return audio_iterator(*this, 0); }
- audio_iterator audio_end() { return audio_iterator(*this, _count.get(DataType::AUDIO)); }
+ audio_iterator audio_end() { return audio_iterator(*this, _count.n_audio()); }
class iterator {
public:
iterator& operator++() { ++_index; return *this; } // yes, prefix only
bool operator==(const iterator& other) { return (_index == other._index); }
bool operator!=(const iterator& other) { return (_index != other._index); }
+ iterator operator=(const iterator& other) { _set = other._set; _type = other._type; _index = other._index; return *this; }
private:
friend class BufferSet;
private:
typedef std::vector<Buffer*> BufferVec;
- /// Vector of vectors, indexed by DataType::to_index()
+ /// Vector of vectors, indexed by DataType
std::vector<BufferVec> _buffers;
/// Use counts (there may be more actual buffers than this)
/// Available counts (number of buffers actually allocated)
ChanCount _available;
- /// Whether we (don't) 'own' the contained buffers (are a mirror of a PortSet)
+ /// Whether we (don't) 'own' the contained buffers (otherwise we mirror a PortSet)
bool _is_mirror;
};