13
0

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.
This commit is contained in:
nick_m 2016-12-13 02:15:34 +11:00
parent f22d852d8c
commit a4d8cc2e04

View File

@ -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 ();