13
0

Fix midi region split, trim and move operations.

- there is still the problem of being unable to drag
	  a trimmed region to the left when it's source
	  (not it's position) would end up on a negative beat.
This commit is contained in:
nick_m 2016-06-07 02:14:31 +10:00
parent 92fdf7deda
commit 6a622d86dc

View File

@ -107,11 +107,11 @@ MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, frameoffset_t
, _start_beats (Properties::start_beats, Evoral::Beats())
, _length_beats (Properties::length_beats, Evoral::Beats())
{
BeatsFramesConverter bfc (_session.tempo_map(), _position);
BeatsFramesConverter bfc (_session.tempo_map(), other->_position);
Evoral::Beats const offset_beats = bfc.from (offset);
_start_beats = other->_start_beats.val() + offset_beats;
_length_beats = other->_length_beats.val() - offset_beats;
_start_beats = other->_start_beats.val() + offset_beats;
_length_beats = Evoral::Beats (_session.tempo_map().beat_at_frame (other->length() - offset));
register_properties ();
@ -224,6 +224,9 @@ MidiRegion::set_position_internal (framepos_t pos, bool allow_bbt_recompute)
{
Region::set_position_internal (pos, allow_bbt_recompute);
/* set _start to new position in tempo map */
_start = _position - _session.tempo_map().framepos_minus_beats (_position, _start_beats);
/* leave _length_beats alone, and change _length to reflect the state of things
at the new position (tempo map may dictate a different number of frames).
*/