summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/midi_playlist.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-02-27 16:51:09 -0500
committerDavid Robillard <d@drobilla.net>2015-03-05 17:11:24 -0500
commit09f1571fc0c9dd164601cfd3d12fac31a084b9f6 (patch)
tree11712d2a224c9353be764d224bc1a10e748dc3c5 /libs/ardour/ardour/midi_playlist.h
parent5bf90524df6a1a6d62fabd83cda7fac393bfdcbc (diff)
Clean up MidiPlaylist::read, kill copy-paste code.
Towards putting more advanced logic here, where two copies of everything will get even more hairy. The two cases of reading from one or many regions are not very different in the read phase, the only difference is the target. So, point a reference to the appropriate target, use the same read code in either case, then sort/etc afterwards only if necessary.
Diffstat (limited to 'libs/ardour/ardour/midi_playlist.h')
-rw-r--r--libs/ardour/ardour/midi_playlist.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/libs/ardour/ardour/midi_playlist.h b/libs/ardour/ardour/midi_playlist.h
index 5e334d5546..f49593bd85 100644
--- a/libs/ardour/ardour/midi_playlist.h
+++ b/libs/ardour/ardour/midi_playlist.h
@@ -47,13 +47,30 @@ public:
MidiPlaylist (Session&, const XMLNode&, bool hidden = false);
MidiPlaylist (Session&, std::string name, bool hidden = false);
MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, std::string name, bool hidden = false);
- MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, framepos_t start, framecnt_t cnt,
- std::string name, bool hidden = false);
+
+ /** This constructor does NOT notify others (session) */
+ MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other,
+ framepos_t start,
+ framecnt_t cnt,
+ std::string name,
+ bool hidden = false);
~MidiPlaylist ();
+ /** Read a range from the playlist into an event sink.
+ *
+ * @param buf Destination for events.
+ * @param start First frame of read range.
+ * @param cnt Number of frames in read range.
+ * @param chan_n Must be 0 (this is the audio-style "channel", where each
+ * channel is backed by a separate region, not MIDI channels, which all
+ * exist in the same region and are not handled here).
+ * @return The number of frames read (time, not an event count).
+ */
framecnt_t read (Evoral::EventSink<framepos_t>& buf,
- framepos_t start, framecnt_t cnt, uint32_t chan_n = 0);
+ framepos_t start,
+ framecnt_t cnt,
+ uint32_t chan_n = 0);
int set_state (const XMLNode&, int version);
@@ -86,7 +103,6 @@ private:
typedef std::map<Region*,MidiStateTracker*> NoteTrackers;
NoteTrackers _note_trackers;
-
};
} /* namespace ARDOUR */