+BufferSet::VSTBuffer::clear ()
+{
+ _events->numEvents = 0;
+}
+
+void
+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
+ they won't be passed to VST plugins or VSTis
+ */
+ return;
+ }
+ int const n = _events->numEvents;
+ assert (n < (int) _capacity);
+
+ _events->events[n] = reinterpret_cast<VstEvent*> (_midi_events + n);
+ VstMidiEvent* v = reinterpret_cast<VstMidiEvent*> (_events->events[n]);
+
+ v->type = kVstMidiType;
+ v->byteSize = sizeof (VstMidiEvent);
+ v->deltaFrames = ev.time ();
+
+ v->flags = 0;
+ v->detune = 0;
+ v->noteLength = 0;
+ v->noteOffset = 0;
+ v->reserved1 = 0;
+ v->reserved2 = 0;
+ v->noteOffVelocity = 0;
+ memcpy (v->midiData, ev.buffer(), ev.size());
+ v->midiData[3] = 0;
+
+ _events->numEvents++;
+}
+
+#endif /* WINDOWS_VST_SUPPORT */
+
+/** Copy buffers of one type from `in' to this BufferSet */
+void
+BufferSet::read_from (const BufferSet& in, framecnt_t nframes, DataType type)
+{
+ assert (available().get (type) >= in.count().get (type));
+
+ BufferSet::iterator o = begin (type);
+ for (BufferSet::const_iterator i = in.begin (type); i != in.end (type); ++i, ++o) {
+ o->read_from (*i, nframes);
+ }
+
+ _count.set (type, in.count().get (type));
+}
+
+/** Copy buffers of all types from `in' to this BufferSet */
+void
+BufferSet::read_from (const BufferSet& in, framecnt_t nframes)