From 4bc0d1c475f4f8c87b0fea690e5105d31337d6f4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 20 Nov 2014 15:36:11 -0500 Subject: Fix lost MIDI note offs and controllers. Fix initial read of discrete MIDI controllers. Fix spurious note offs when starting to play in the middle of a note. Faster search for initial event when cached iterator is invalid. So much for dropping the cached iterator. The iterator is responsible for handling note offs, so that doesn't work. This design means we have some stuck note issues at the source read level, but they should be taken care of by the state tracker anyway. --- libs/ardour/ardour/midi_source.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libs/ardour/ardour') diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index 364b220ebb..65e382c4b7 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -140,6 +140,11 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha virtual void load_model(bool lock=true, bool force_reload=false) = 0; virtual void destroy_model() = 0; + /** This must be called with the source lock held whenever the + * source/model contents have been changed (reset iterators/cache/etc). + */ + void invalidate(); + void set_note_mode(NoteMode mode); boost::shared_ptr model() { return _model; } @@ -186,7 +191,11 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha boost::shared_ptr _model; bool _writing; - mutable double _length_beats; + mutable Evoral::Sequence::const_iterator _model_iter; + mutable bool _model_iter_valid; + + mutable double _length_beats; + mutable framepos_t _last_read_end; /** The total duration of the current capture. */ framepos_t _capture_length; -- cgit v1.2.3