mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-05 05:05:43 +01:00
Remove Region::absolute_time_to_region_beats()
This method did not do what its name suggested. Replace it with ::absolute_time_to_source_beats() which already existed and computed the same result. Also in a NoteCreateDrag, correctly adjust note start depending on whether we are viewing the whole source or just the region. This part may be amended later.
This commit is contained in:
parent
f9e78dc128
commit
67fa5282cb
4 changed files with 11 additions and 10 deletions
|
|
@ -6837,7 +6837,14 @@ NoteCreateDrag::finished (GdkEvent* ev, bool had_movement)
|
|||
|
||||
/* Compute start within region, rather than absolute time start */
|
||||
|
||||
Beats const start = _midi_view->midi_region ()->absolute_time_to_region_beats (min (_note[0], _note[1]));
|
||||
Beats start;
|
||||
|
||||
if (_midi_view->show_source()) {
|
||||
Beats spos = _midi_view->midi_region()->source_position().beats() + min (_note[0], _note[1]).beats();
|
||||
start = _midi_view->midi_region ()->absolute_time_to_source_beats (timepos_t (spos));
|
||||
} else {
|
||||
start = _midi_view->midi_region ()->absolute_time_to_source_beats (timepos_t (min (_note[0], _note[1])));
|
||||
}
|
||||
|
||||
if (!had_movement) {
|
||||
/* we create a note even if there was no movement */
|
||||
|
|
@ -6899,7 +6906,7 @@ HitCreateDrag::finished (GdkEvent* event, bool had_movement)
|
|||
editing_context.snap_to (pos, RoundNearest, SnapToGrid_Scaled);
|
||||
Temporal::Beats aligned_beats (pos.beats ());
|
||||
|
||||
Beats const start = _midi_view->midi_region ()->absolute_time_to_region_beats (timepos_t (aligned_beats));
|
||||
Beats const start = _midi_view->midi_region ()->absolute_time_to_source_beats (timepos_t (aligned_beats));
|
||||
|
||||
/* Percussive hits are as short as possible */
|
||||
Beats length (0, 1);
|
||||
|
|
|
|||
|
|
@ -4378,7 +4378,7 @@ MidiView::update_ghost_note (double x, double y, uint32_t state)
|
|||
Temporal::timepos_t snapped_pos = timepos_t (unsnapped_sample);
|
||||
_editing_context.snap_to (snapped_pos, RoundNearest, SnapToGrid_Scaled);
|
||||
|
||||
const Temporal::Beats snapped_beats = _midi_region->absolute_time_to_region_beats(snapped_pos);
|
||||
const Temporal::Beats snapped_beats = _midi_region->absolute_time_to_source_beats(snapped_pos);
|
||||
|
||||
/* prevent Percussive mode from displaying a ghost hit at region end */
|
||||
if ((_midi_context.note_mode() == Percussive) && (snapped_beats >= _midi_region->length().beats())) {
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ public:
|
|||
/** Convert a timestamp in absolute time to beats measured from source start*/
|
||||
Temporal::Beats absolute_time_to_source_beats(Temporal::timepos_t const &) const;
|
||||
|
||||
Temporal::Beats absolute_time_to_region_beats (Temporal::timepos_t const &) const;
|
||||
Temporal::Beats absolute_time_to_soucre_beats (Temporal::timepos_t const &) const;
|
||||
|
||||
Temporal::timepos_t absolute_time_to_region_time (Temporal::timepos_t const &) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -2299,12 +2299,6 @@ Region::source_beats_to_absolute_beats (Temporal::Beats beats) const
|
|||
return source_position().beats() + beats;
|
||||
}
|
||||
|
||||
Temporal::Beats
|
||||
Region::absolute_time_to_region_beats(timepos_t const & b) const
|
||||
{
|
||||
return (position().distance (b)).beats () + start().beats();
|
||||
}
|
||||
|
||||
Temporal::timepos_t
|
||||
Region::absolute_time_to_region_time (timepos_t const & t) const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue