-MidiTrack::export_stuff (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framecnt_t /*nframes*/,
- boost::shared_ptr<Processor> /*endpoint*/, bool /*include_endpoint*/, bool /*forexport*/)
-{
- return -1;
+MidiTrack::export_stuff (BufferSet& buffers,
+ framepos_t start,
+ framecnt_t nframes,
+ boost::shared_ptr<Processor> endpoint,
+ bool include_endpoint,
+ bool for_export,
+ bool for_freeze)
+{
+ if (buffers.count().n_midi() == 0) {
+ return -1;
+ }
+
+ boost::shared_ptr<MidiDiskstream> diskstream = midi_diskstream();
+
+ Glib::Threads::RWLock::ReaderLock rlock (_processor_lock);
+
+ boost::shared_ptr<MidiPlaylist> mpl = boost::dynamic_pointer_cast<MidiPlaylist>(diskstream->playlist());
+ if (!mpl) {
+ return -2;
+ }
+
+ buffers.get_midi(0).clear();
+ if (mpl->read(buffers.get_midi(0), start, nframes, 0) != nframes) {
+ return -1;
+ }
+
+ //bounce_process (buffers, start, nframes, endpoint, include_endpoint, for_export, for_freeze);
+
+ return 0;