From 7428f13e15f84ba8bfd5c981fc4aca43508429ce Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 24 Sep 2022 15:38:45 -0600 Subject: [PATCH] MIDI: unlinked region copies get sources that are copies of the original Previously, the copied source file only contained data within the initial region bounds. This meant that you could not trim the (unlinked) copy to beyond its initial bounds. Seems wrong. --- libs/ardour/midi_region.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index f290393b54..e56897ad14 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -145,9 +145,6 @@ MidiRegion::clone (string path) const boost::shared_ptr MidiRegion::clone (boost::shared_ptr newsrc, ThawList* tl) const { - Temporal::Beats const bbegin = _start.val().beats (); - Temporal::Beats const bend = _start.val().beats() + _length.val().beats(); - { boost::shared_ptr ms = midi_source(0); @@ -156,7 +153,7 @@ MidiRegion::clone (boost::shared_ptr newsrc, ThawList* tl) const */ Source::ReaderLock lm (ms->mutex()); - if (ms->write_to (lm, newsrc, bbegin, bend)) { + if (ms->write_to (lm, newsrc, Temporal::Beats(), std::numeric_limits::max())) { return boost::shared_ptr (); } } @@ -168,6 +165,8 @@ MidiRegion::clone (boost::shared_ptr newsrc, ThawList* tl) const plist.add (Properties::automatic, false); plist.add (Properties::external, false); plist.add (Properties::import, false); + plist.add (Properties::start, _start.val()); + plist.add (Properties::length, _length.val()); plist.add (Properties::layer, 0); boost::shared_ptr ret (boost::dynamic_pointer_cast (RegionFactory::create (newsrc, plist, true, tl)));