From f5fabb595ae315e576b3b23717278d53c99b1921 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 18 Sep 2023 17:14:03 +0200 Subject: [PATCH] Section operations need to use audio-time cut/copy section does copy the tempo-map, so copying a 4 Bar MIDI section will be 4 Bars after the paste. This does not work the other way around: With a tempo-map, 4 bars may correspond to 10 seconds at the source position. While 4 bars at the target position may correspond to a different audio-time duration. This can lead to gaps or overlaps. --- libs/ardour/session.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index b2a3d18e9d..2b23dd57ee 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -7225,8 +7225,16 @@ Session::clear_object_selection () } void -Session::cut_copy_section (timepos_t const& start, timepos_t const& end, timepos_t const& to, SectionOperation const op) +Session::cut_copy_section (timepos_t const& start_, timepos_t const& end_, timepos_t const& to_, SectionOperation const op) { + timepos_t start = timepos_t::from_superclock (start_.superclocks()); + timepos_t end = timepos_t::from_superclock (end_.superclocks()); + timepos_t to = timepos_t::from_superclock (to_.superclocks()); + +#ifndef NDEBUG + cout << "Session::cut_copy_section " << start << " - " << end << " << to " << to << " op = " << op << "\n"; +#endif + std::list ltr; TimelineRange tlr (start, end, 0); ltr.push_back (tlr);