summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_region.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-12-13 02:15:34 +1100
committernick_m <mainsbridge@gmail.com>2016-12-13 02:15:34 +1100
commita4d8cc2e048b823fa33ac1976373cc46e6a6cb85 (patch)
treec6cd3c70d8111e62c6e1c792bac2a0a98a045afe /libs/ardour/midi_region.cc
parentf22d852d8cd4f4212d25b40b77e26d4bcaf8f01e (diff)
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.
Diffstat (limited to 'libs/ardour/midi_region.cc')
-rw-r--r--libs/ardour/midi_region.cc6
1 files 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<const MidiRegion> other)
/** Create a new MidiRegion that is part of an existing one */
MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> 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 ();