From a4d8cc2e048b823fa33ac1976373cc46e6a6cb85 Mon Sep 17 00:00:00 2001 From: nick_m Date: Tue, 13 Dec 2016 02:15:34 +1100 Subject: [PATCH] only recalculate MidiRegion start_beats if there is an offset in the 'part-of' ctor. - when drag-copying MIDI regions, a partial region ctor is used which can lead to _start_beats being off by a sample. this in turn leads to 7168 happening, but only if magnetic snap is used and the regions are copied as a group. this should fix 7168, but the magnetic snap part is not yet addressed. --- libs/ardour/midi_region.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index a070d9364f..abaf6d3484 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -104,10 +104,12 @@ MidiRegion::MidiRegion (boost::shared_ptr other) /** Create a new MidiRegion that is part of an existing one */ MidiRegion::MidiRegion (boost::shared_ptr other, frameoffset_t offset, const int32_t sub_num) : Region (other, offset, sub_num) - , _start_beats (Properties::start_beats, 0.0) + , _start_beats (Properties::start_beats, other->_start_beats) , _length_beats (Properties::length_beats, other->_length_beats) { - _start_beats = (_session.tempo_map().exact_qn_at_frame (other->_position + offset, sub_num) - other->_quarter_note) + other->_start_beats; + if (offset != 0) { + _start_beats = (_session.tempo_map().exact_qn_at_frame (other->_position + offset, sub_num) - other->_quarter_note) + other->_start_beats; + } update_length_beats (sub_num); register_properties ();