21 #include "libardour-config.h"
33 #include "ardour/debug.h"
42 #if defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT
71 for (std::vector<BufferVec>::iterator i =
_buffers.begin(); i !=
_buffers.end(); ++i) {
72 for (BufferVec::iterator j = (*i).begin(); j != (*i).end(); ++j) {
82 #if defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT
83 for (VSTBuffers::iterator i = _vst_buffers.begin(); i != _vst_buffers.end(); ++i) {
87 _vst_buffers.clear ();
135 assert (v.size() == ports.
num_ports (*t));
139 v[i] = &p->get_buffer (nframes);
154 if (num_buffers == 0) {
164 assert(bufs[0]->type() == type);
170 if (bufs.size() < num_buffers
174 for (BufferVec::iterator i = bufs.begin(); i != bufs.end(); ++i) {
180 for (
size_t i = 0; i < num_buffers; ++i) {
192 while (_lv2_buffers.size() <
_buffers[type].size() * 2) {
193 _lv2_buffers.push_back(
202 #if defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT
205 while (_vst_buffers.size() <
_buffers[type].size()) {
206 _vst_buffers.push_back (
new VSTBuffer (buffer_capacity));
212 assert(bufs[0]->type() == type);
213 assert(bufs.size() >= num_buffers);
215 assert(bufs[0]->capacity() >= buffer_capacity);
237 return _buffers[type][0]->capacity();
257 BufferSet::ensure_lv2_bufsize(
bool input,
size_t i,
size_t buffer_capacity)
261 LV2Buffers::value_type b = _lv2_buffers.at(i * 2 + (input ? 0 : 1));
267 _lv2_buffers.at(i * 2 + (input ? 0 : 1)) =
276 BufferSet::get_lv2_midi(
bool input,
size_t i,
bool old_api)
280 LV2Buffers::value_type b = _lv2_buffers.at(i * 2 + (input ? 0 : 1));
289 BufferSet::forward_lv2_midi(
LV2_Evbuf* buf,
size_t i,
bool purge_ardour_buffer)
292 if (purge_ardour_buffer) {
298 uint32_t frames, subframes, type, size;
302 mbuf.push_back(frames, size, data);
308 BufferSet::flush_lv2_midi(
bool input,
size_t i)
311 LV2Buffers::value_type b = _lv2_buffers.at(i * 2 + (input ? 0 : 1));
326 for (uint16_t x = 0; x < size; ++x) {
332 mbuf.push_back(frames, size, data);
339 #if defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT
342 BufferSet::get_vst_midi (
size_t b)
345 VSTBuffer* vst = _vst_buffers[b];
353 return vst->events();
356 BufferSet::VSTBuffer::VSTBuffer (
size_t c)
362 if (_events == 0 || _midi_events == 0) {
368 _events->numEvents = 0;
369 _events->reserved = 0;
372 BufferSet::VSTBuffer::~VSTBuffer ()
379 BufferSet::VSTBuffer::clear ()
381 _events->numEvents = 0;
393 int const n = _events->numEvents;
394 assert (n < (
int) _capacity);
396 _events->events[n] =
reinterpret_cast<VstEvent*
> (_midi_events + n);
413 _events->numEvents++;
426 o->read_from (*i, nframes);
457 o->merge_from (*i, nframes);
465 for (std::vector<BufferVec>::iterator i =
_buffers.begin(); i !=
_buffers.end(); ++i) {
466 for (BufferVec::iterator b = i->begin(); b != i->end(); ++b) {
467 (*b)->silence (nframes, offset);
bool lv2_evbuf_is_valid(LV2_Evbuf_Iterator iter)
LV2_Evbuf_Iterator lv2_evbuf_begin(LV2_Evbuf *evbuf)
void ensure_buffers(DataType type, size_t num_buffers, size_t buffer_capacity)
MidiBuffer & get_midi(size_t i)
ChanCount _count
Use counts (there may be more actual buffers than this)
bool _is_mirror
False if we 'own' the contained buffers, if true we mirror a PortSet)
std::vector< Buffer * > BufferVec
iterator end(DataType type=DataType::NIL)
void lv2_evbuf_set_type(LV2_Evbuf *evbuf, LV2_Evbuf_Type type)
void read_from(const BufferSet &in, framecnt_t nframes)
static URIMap & instance()
bool lv2_evbuf_get(LV2_Evbuf_Iterator iter, uint32_t *frames, uint32_t *subframes, uint32_t *type, uint32_t *size, uint8_t **data)
LV2_Evbuf_Iterator lv2_evbuf_next(LV2_Evbuf_Iterator iter)
Buffer & get(DataType type, size_t i)
void silence(framecnt_t nframes, framecnt_t offset)
LV2_Evbuf * lv2_evbuf_new(uint32_t capacity, LV2_Evbuf_Type type, uint32_t atom_Chunk, uint32_t atom_Sequence)
iterator begin(DataType type)
uint32_t lv2_evbuf_get_capacity(LV2_Evbuf *evbuf)
iterator end(DataType type)
std::vector< BufferVec > _buffers
Vector of vectors, indexed by DataType.
#define DEBUG_TRACE(bits, str)
static const uint32_t num_types
void lv2_evbuf_free(LV2_Evbuf *evbuf)
void get_backend_port_addresses(PortSet &, framecnt_t)
LIBARDOUR_API uint64_t LV2
void merge_from(const BufferSet &in, framecnt_t nframes)
uint32_t get(DataType t) const
const ChanCount & count() const
void set(DataType t, uint32_t count)
const ChanCount & available() const
size_t buffer_capacity(DataType type) const
iterator_base< MidiBuffer, Evoral::MIDIEvent< TimeType > > iterator
const uint8_t * buffer() const
iterator begin(DataType type=DataType::NIL)
void lv2_evbuf_reset(LV2_Evbuf *evbuf, bool input)
void attach_buffers(PortSet &ports)
uint32_t n(DataType t) const
const ChanCount & count() const
ChanCount _available
Available counts (number of buffers actually allocated)
std::string string_compose(const std::string &fmt, const T1 &o1)
static Buffer * create(DataType type, size_t capacity)
struct _VstMidiEvent VstMidiEvent