summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_region.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-06-07 02:14:31 +1000
committernick_m <mainsbridge@gmail.com>2016-06-07 02:14:31 +1000
commit6a622d86dca2c8af8993d85be8bd8a44debc5b8c (patch)
tree275fca3437f902be9188a1a5ddda93c2974a9acc /libs/ardour/midi_region.cc
parent92fdf7deda1dfd4eb73eba1182fcbc805e86548e (diff)
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.
Diffstat (limited to 'libs/ardour/midi_region.cc')
-rw-r--r--libs/ardour/midi_region.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc
index b1c332072e..05037d4af3 100644
--- a/libs/ardour/midi_region.cc
+++ b/libs/ardour/midi_region.cc
@@ -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).
*/