From 93c24e4433d69fe1de28d4d2ed2045aa7cb3596b Mon Sep 17 00:00:00 2001 From: nick_m Date: Fri, 17 Jun 2016 03:20:37 +1000 Subject: Paste uses exact beats. rework _start_beats calculation in copy-with-offset ctor. --- libs/ardour/midi_region.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libs/ardour/midi_region.cc') diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index 4d4c081c24..035c17c9de 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -107,8 +107,7 @@ MidiRegion::MidiRegion (boost::shared_ptr other, frameoffset_t , _start_beats (Properties::start_beats, Evoral::Beats()) , _length_beats (Properties::length_beats, other->_length_beats) { - const double offset_beat = _session.tempo_map().exact_beat_at_frame (other->_position + offset, sub_num) - other->beat(); - _start_beats = Evoral::Beats (other->_start_beats.val().to_double() + offset_beat); + _start_beats = Evoral::Beats (_session.tempo_map().exact_beat_at_frame (other->_position + offset - other->_start, sub_num) - other->beat()); update_length_beats (sub_num); register_properties (); @@ -163,7 +162,10 @@ MidiRegion::clone (boost::shared_ptr newsrc) const plist.add (Properties::length_beats, _length_beats); plist.add (Properties::layer, 0); - return boost::dynamic_pointer_cast (RegionFactory::create (newsrc, plist, true)); + boost::shared_ptr ret (boost::dynamic_pointer_cast (RegionFactory::create (newsrc, plist, true))); + ret->set_beat (beat()); + + return ret; } void -- cgit v1.2.3