diff options
author | David Robillard <d@drobilla.net> | 2015-03-01 13:33:25 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-03-05 17:30:31 -0500 |
commit | a8aae56d92699e4545b5f8a69742f9a1c75ad238 (patch) | |
tree | ae3c14f1b78fbfddf126b44e533692b137d93f28 /libs/ardour/ardour/midi_model.h | |
parent | 09f1571fc0c9dd164601cfd3d12fac31a084b9f6 (diff) |
Handle edits while playing precisely.
This avoids stuck notes if active notes are edited, but without stopping all
active notes in the region on any edit as before.
This implementation injects note ons in places that aren't actually note
starts. Depending on how percussive the instrument is, this may not be
desired. In the future, an option for this would be an improvement, but there
are other places where "start notes in the middle" is a reasonable option. I
think that should be handled universally if we're to do it at all, so not
considering it a part of this fix for now.
Diffstat (limited to 'libs/ardour/ardour/midi_model.h')
-rw-r--r-- | libs/ardour/ardour/midi_model.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index 4214431280..b2e018ca3b 100644 --- a/libs/ardour/ardour/midi_model.h +++ b/libs/ardour/ardour/midi_model.h @@ -126,7 +126,6 @@ public: static Variant::Type value_type (Property prop); - private: struct NoteChange { NoteDiffCommand::Property property; NotePtr note; @@ -135,12 +134,17 @@ public: Variant new_value; }; - typedef std::list<NoteChange> ChangeList; - ChangeList _changes; - + typedef std::list<NoteChange> ChangeList; typedef std::list< boost::shared_ptr< Evoral::Note<TimeType> > > NoteList; - NoteList _added_notes; - NoteList _removed_notes; + + const ChangeList& changes() const { return _changes; } + const NoteList& added_notes() const { return _added_notes; } + const NoteList& removed_notes() const { return _removed_notes; } + + private: + ChangeList _changes; + NoteList _added_notes; + NoteList _removed_notes; std::set<NotePtr> side_effect_removals; @@ -285,6 +289,8 @@ public: void insert_silence_at_start (TimeType); void transpose (TimeType, TimeType, int); + std::set<WeakNotePtr>& active_notes() { return _active_notes; } + protected: int resolve_overlaps_unlocked (const NotePtr, void* arg = 0); @@ -302,7 +308,6 @@ private: public: WriteLock edit_lock(); - WriteLock write_lock(); private: friend class DeltaCommand; @@ -319,6 +324,8 @@ private: // We cannot use a boost::shared_ptr here to avoid a retain cycle boost::weak_ptr<MidiSource> _midi_source; InsertMergePolicy _insert_merge_policy; + + std::set<WeakNotePtr> _active_notes; }; } /* namespace ARDOUR */ |