make sure Pianoroll background gets the data range set when a region is set

This commit is contained in:
Paul Davis
2025-06-13 17:19:30 -06:00
parent 28eaf90790
commit 4aedc6f882
3 changed files with 14 additions and 0 deletions

View File

@@ -2651,6 +2651,8 @@ Pianoroll::set_region (std::shared_ptr<ARDOUR::MidiRegion> r)
zoom_to_show (timecnt_t (timepos_t (max_extents_scale() * max_zoom_extent ().second.samples())));
}
bg->display_region (*view);
_update_connection = Timers::rapid_connect (sigc::mem_fun (*this, &Pianoroll::maybe_update));
}

View File

@@ -20,6 +20,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "ardour/smf_source.h"
#include "ardour/midi_region.h"
#include "pianoroll.h"
#include "pianoroll_background.h"
#include "midi_view.h"
@@ -101,3 +104,11 @@ PianorollMidiBackground::apply_note_range_to_children ()
view->apply_note_range (lowest_note(), highest_note());
}
}
void
PianorollMidiBackground::display_region (MidiView& mv)
{
std::shared_ptr<ARDOUR::SMFSource> smf (std::dynamic_pointer_cast<ARDOUR::SMFSource> (mv.midi_region()->source()));
assert (smf);
(void) update_data_note_range (smf->model()->lowest_note(), smf->model()->highest_note());
}

View File

@@ -49,6 +49,7 @@ class PianorollMidiBackground : public MidiViewBackground
void set_size (int w, int h);
void set_view (MidiView*);
void display_region (MidiView&);
ARDOUR::InstrumentInfo* instrument_info() const;