diff --git a/gtk2_ardour/midi_view.cc b/gtk2_ardour/midi_view.cc index 7e38905e4d..d4fa1be699 100644 --- a/gtk2_ardour/midi_view.cc +++ b/gtk2_ardour/midi_view.cc @@ -1076,6 +1076,8 @@ MidiView::model_changed() return; } + MidiViewBackground::NoteRangeSuspender nrs (_midi_context); + if (_active_notes) { // Currently recording const samplecnt_t zoom = _editing_context.get_current_zoom(); diff --git a/gtk2_ardour/midi_view_background.h b/gtk2_ardour/midi_view_background.h index 57f093170c..b531219ecc 100644 --- a/gtk2_ardour/midi_view_background.h +++ b/gtk2_ardour/midi_view_background.h @@ -54,6 +54,19 @@ class MidiViewBackground : public virtual ViewBackground Gtk::Adjustment note_range_adjustment; + struct NoteRangeSuspender { + NoteRangeSuspender (MidiViewBackground& mv) : mvb (mv) { + mvb.NoteRangeChanged.block (); + } + + ~NoteRangeSuspender() { + mvb.NoteRangeChanged.unblock (); + mvb.NoteRangeChanged(); /* EMIT SIGNAL */ + } + + MidiViewBackground& mvb; + }; + enum VisibleNoteRange { FullRange, ContentsRange