From 975b01060a8b6a49e564b2bfa05fefadefcf9eff Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 28 Apr 2025 08:58:25 -0600 Subject: [PATCH] enforce a 1 octave minimum note range in MidiViews May revisit this to allow less in the future --- gtk2_ardour/midi_view_background.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gtk2_ardour/midi_view_background.cc b/gtk2_ardour/midi_view_background.cc index f6a8ff8f8f..365db2811f 100644 --- a/gtk2_ardour/midi_view_background.cc +++ b/gtk2_ardour/midi_view_background.cc @@ -255,6 +255,14 @@ MidiViewBackground::apply_note_range (uint8_t lowest, uint8_t highest, bool to_c { bool changed = false; + /* Enforce a 1 octave minimum */ + + if (highest - lowest < 12) { + int8_t mid = lowest + ((highest - lowest) / 2); + lowest = std::max (mid - 6, 0); + highest = lowest + 12; + } + if (_highest_note != highest) { _highest_note = highest; changed = true;