summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/midi_source.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-11-08 20:34:45 -0500
committerDavid Robillard <d@drobilla.net>2016-11-08 20:34:45 -0500
commitc61373212a87e519276d4c011994e2d37c77ee16 (patch)
tree216e0fcd47e24cd8db0511a074d2d203cb18fa5e /libs/ardour/ardour/midi_source.h
parent72297c0ca31400767177bbcb9310721c481a7dd8 (diff)
Support multiple readers for MIDI source/model
Fixes the multiple reader issue #6541 properly without resorting to a linear search kludge. All the read state has been pulled out into a MidiCursor which the caller is required to pass. The playlist keeps cursors for all the regions it is reading, any number of cursors are allowed at a time. MidiCursor should probably be made a smarter and more fool-proof object (and/or possibly merged with some of the other tracker/fixer stuff) but for now I wanted to keep it simple.
Diffstat (limited to 'libs/ardour/ardour/midi_source.h')
-rw-r--r--libs/ardour/ardour/midi_source.h22
1 files changed, 10 insertions, 12 deletions
diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h
index 4815263739..1ff0a08f71 100644
--- a/libs/ardour/ardour/midi_source.h
+++ b/libs/ardour/ardour/midi_source.h
@@ -36,8 +36,9 @@
namespace ARDOUR {
class MidiChannelFilter;
-class MidiStateTracker;
+class MidiCursor;
class MidiModel;
+class MidiStateTracker;
template<typename T> class MidiRingBuffer;
@@ -87,18 +88,18 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha
* \param tracker an optional pointer to MidiStateTracker object, for note on/off tracking.
* \param filtered Parameters whose MIDI messages will not be returned.
*/
-
virtual framecnt_t midi_read (const Lock& lock,
Evoral::EventSink<framepos_t>& dst,
framepos_t source_start,
framepos_t start,
framecnt_t cnt,
Evoral::Range<framepos_t>* loop_range,
+ MidiCursor& cursor,
MidiStateTracker* tracker,
MidiChannelFilter* filter,
const std::set<Evoral::Parameter>& filtered,
- const double pulse,
- const double start_beats) const;
+ const double pulse,
+ const double start_beats) const;
/** Write data from a MidiRingBuffer to this source.
* @param source Source to read from.
@@ -175,10 +176,11 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha
/** Reset cached information (like iterators) when things have changed.
* @param lock Source lock, which must be held by caller.
- * @param notes If non-NULL, currently active notes are added to this set.
*/
- void invalidate(const Glib::Threads::Mutex::Lock& lock,
- std::set<Evoral::Sequence<Evoral::Beats>::WeakNotePtr>* notes=NULL);
+ void invalidate(const Glib::Threads::Mutex::Lock& lock);
+
+ /** Thou shalt not emit this directly, use invalidate() instead. */
+ mutable PBD::Signal1<void, bool> Invalidated;
void set_note_mode(const Glib::Threads::Mutex::Lock& lock, NoteMode mode);
@@ -230,11 +232,7 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha
boost::shared_ptr<MidiModel> _model;
bool _writing;
- mutable Evoral::Sequence<Evoral::Beats>::const_iterator _model_iter;
- mutable bool _model_iter_valid;
-
- mutable Evoral::Beats _length_beats;
- mutable framepos_t _last_read_end;
+ Evoral::Beats _length_beats;
/** The total duration of the current capture. */
framepos_t _capture_length;