diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index 79b30502b8..9c109c2c21 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -275,12 +275,6 @@ MidiStreamView::redisplay_track () _data_note_max = 71; } - // Extend visible range to show newly recorded data, if necessary - _lowest_note = std::min(_lowest_note, _data_note_min); - _highest_note = std::max(_highest_note, _data_note_max); - - veto_note_range(_lowest_note, _highest_note); - // Flag region views as invalid and disable drawing for (i = region_views.begin(); i != region_views.end(); ++i) { (*i)->set_valid(false); diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 0adb02725f..63f92f71b0 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -127,6 +127,10 @@ MidiTimeAxisView::set_route (boost::shared_ptr rt) subplugin_menu.set_name ("ArdourContextMenu"); _view = new MidiStreamView (*this); + if (!gui_property ("note-range-min").empty ()) { + midi_view()->apply_note_range (atoi (gui_property ("note-range-min").c_str()), atoi (gui_property ("note-range-max").c_str()), true); + } + midi_view()->NoteRangeChanged.connect (sigc::mem_fun (*this, &MidiTimeAxisView::note_range_changed)); ignore_toggle = false; @@ -1163,3 +1167,10 @@ MidiTimeAxisView::get_channel_for_add () const return channel; } + +void +MidiTimeAxisView::note_range_changed () +{ + set_gui_property ("note-range-min", (int) midi_view()->lowest_note ()); + set_gui_property ("note-range-max", (int) midi_view()->highest_note ()); +} diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h index 8c4aee65c1..b3c916ea69 100644 --- a/gtk2_ardour/midi_time_axis.h +++ b/gtk2_ardour/midi_time_axis.h @@ -122,6 +122,7 @@ class MidiTimeAxisView : public RouteTimeAxisView void set_note_range(MidiStreamView::VisibleNoteRange range); void route_active_changed (); + void note_range_changed (); bool _ignore_signals; MidiScroomer* _range_scroomer;