Compare commits

...

2 Commits

Author SHA1 Message Date
Ben Loftis 41815f8d53 midi_region_view: use absolute_time_to_region_beats
* this fixes the location of the 'ghost note' that is shown
 when adding notes with the Draw tool
2022-05-12 12:15:53 -05:00
Ben Loftis 1fdfa53b9f region::absolute_time_to_region_beats() needs to incorporate start offset
* this fixes the Draw tool when adding notes;  if you tried to draw in
 a region with a trimmed front, the note would not get added in the correct
 location
2022-05-12 12:15:53 -05:00
2 changed files with 3 additions and 2 deletions

View File

@ -4094,7 +4094,8 @@ MidiRegionView::update_ghost_note (double x, double y, uint32_t state)
samplepos_t const unsnapped_sample = editor.pixel_to_sample (global_x);
Temporal::timepos_t snapped_pos = timepos_t (unsnapped_sample);
editor.snap_to (snapped_pos, RoundDownAlways, SnapToGrid_Scaled);
const Temporal::Beats snapped_beats = _region->position().distance (snapped_pos).beats ();
const Temporal::Beats snapped_beats = _region->absolute_time_to_region_beats(snapped_pos);
/* prevent Percussive mode from displaying a ghost hit at region end */
if ((midi_view()->note_mode() == Percussive) && (snapped_beats >= _region->length().beats())) {

View File

@ -303,7 +303,7 @@ public:
Temporal::Beats absolute_time_to_source_beats(Temporal::timepos_t const &) const;
Temporal::Beats absolute_time_to_region_beats (Temporal::timepos_t const & b) const {
return position().distance (b).beats ();
return position().distance (b+start()).beats ();
}
int apply (Filter &, Progress* progress = 0);