#endif
}
-/** Make this BufferSet a direct mirror of a PortSet's buffers.
+/** Set up this BufferSet so that its data structures mirror a PortSet's buffers.
+ * This is quite expensive and not RT-safe, so it should not be called in a process context;
+ * get_jack_port_addresses() will fill in a structure set up by this method.
*/
void
-BufferSet::attach_buffers(PortSet& ports, nframes_t nframes, nframes_t offset)
+BufferSet::attach_buffers (PortSet& ports)
{
clear();
for (PortSet::iterator p = ports.begin(*t); p != ports.end(*t); ++p) {
assert(p->type() == *t);
- v.push_back(&(p->get_buffer(nframes, offset)));
+ v.push_back (0);
}
}
_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.
+ */
+void
+BufferSet::get_jack_port_addresses (PortSet& ports, framecnt_t nframes, framecnt_t offset)
+{
+ assert (_count == ports.count ());
+ assert (_available == ports.count ());
+ assert (_is_mirror);
+
+ assert (_buffers.size() == DataType::num_types);
+
+ for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
+ BufferVec& v = _buffers[*t];
+
+ assert (v.size() == ports.num_ports (*t));
+
+ int i = 0;
+ for (PortSet::iterator p = ports.begin(*t); p != ports.end(*t); ++p) {
+ v[i] = &p->get_buffer (nframes, offset);
+ ++i;
+ }
+ }
+}
+
/** Ensure that there are @a num_buffers buffers of type @a type available,
* each of size at least @a buffer_size
*/
LV2EventBuffer&
BufferSet::get_lv2_midi(bool input, size_t i)
{
+ assert (count().get(DataType::MIDI) > i);
+
MidiBuffer& mbuf = get_midi(i);
LV2Buffers::value_type b = _lv2_buffers.at(i * 2 + (input ? 0 : 1));
LV2EventBuffer* ebuf = b.second;
ebuf->reset();
if (input) {
for (MidiBuffer::iterator e = mbuf.begin(); e != mbuf.end(); ++e) {
- const Evoral::MIDIEvent<nframes_t> ev(*e, false);
+ const Evoral::MIDIEvent<framepos_t> ev(*e, false);
uint32_t type = LV2Plugin::midi_event_type();
ebuf->append(ev.time(), 0, type, ev.size(), ev.buffer());
}
}
void
-BufferSet::VSTBuffer::push_back (Evoral::MIDIEvent<nframes_t> const & ev)
+BufferSet::VSTBuffer::push_back (Evoral::MIDIEvent<framepos_t> const & ev)
{
if (ev.size() > 3) {
/* XXX: this will silently drop MIDI messages longer than 3 bytes, so
#endif /* VST_SUPPORT */
void
-BufferSet::read_from (const BufferSet& in, nframes_t nframes)
+BufferSet::read_from (const BufferSet& in, framecnt_t nframes)
{
assert(available() >= in.count());
}
void
-BufferSet::merge_from (const BufferSet& in, nframes_t nframes)
+BufferSet::merge_from (const BufferSet& in, framecnt_t nframes)
{
/* merge all input buffers into out existing buffers.
}
void
-BufferSet::silence (nframes_t nframes, nframes_t offset)
+BufferSet::silence (framecnt_t nframes, framecnt_t offset)
{
for (std::vector<BufferVec>::iterator i = _buffers.begin(); i != _buffers.end(); ++i) {
for (BufferVec::iterator b = i->begin(); b != i->end(); ++b) {