mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +01:00
midi display: ensure that lollipops are visible right after import
VelocityGhostRegion used the visibility of the "parent" note canvas item of a lollipop canvas item to determine the lolli's visibility. But during the construction of the MidiRegionView, the note's container is not yet visible, so this fails. In addition this logic would hide lollis for notes that are outside the current visible note range of the track (because the parent note item was not visible). This change adds a method to MidiRegionView to decide if a note is within the region's time range, and if so, we show the lollipop item. This means that lollis for notes outside the note-range will still be visible, which seems more correct. In addition, the nascent condition of the parent note's container no longer affects lolli visibility.
This commit is contained in:
parent
61d8ceaa85
commit
1f13b311fd
3 changed files with 14 additions and 7 deletions
|
|
@ -1740,17 +1740,21 @@ MidiRegionView::start_playing_midi_chord (vector<std::shared_ptr<NoteType> > not
|
|||
player->play ();
|
||||
}
|
||||
|
||||
bool
|
||||
MidiRegionView::note_in_region_time_range (const std::shared_ptr<NoteType> note) const
|
||||
{
|
||||
const std::shared_ptr<ARDOUR::MidiRegion> midi_reg = midi_region();
|
||||
return (timepos_t (note->time()) >= _region->start()) && (timepos_t (note->time()) < _region->start() + _region->length());
|
||||
}
|
||||
|
||||
bool
|
||||
MidiRegionView::note_in_region_range (const std::shared_ptr<NoteType> note, bool& visible) const
|
||||
{
|
||||
const std::shared_ptr<ARDOUR::MidiRegion> midi_reg = midi_region();
|
||||
|
||||
/* must compare double explicitly as Beats::operator< rounds to ppqn */
|
||||
const bool outside = (timepos_t (note->time()) < _region->start()) || (timepos_t (note->time()) >= _region->start() + _region->length());
|
||||
const bool outside = !note_in_region_time_range (note);
|
||||
|
||||
visible = (note->note() >= _current_range_min) &&
|
||||
(note->note() <= _current_range_max);
|
||||
visible = (note->note() >= _current_range_min) && (note->note() <= _current_range_max);
|
||||
|
||||
return !outside;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue