summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_region.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-06-06 03:54:23 +1000
committernick_m <mainsbridge@gmail.com>2016-06-06 03:54:23 +1000
commitbd551e97eaeb970424048b3baa92593bda6a0184 (patch)
tree3cc94cea6fe32dea50b99e86519fa2cd56486ef3 /libs/ardour/midi_region.cc
parent86607097d618f778ea984cba2a7dc9c403fe8966 (diff)
Midi regions recalculate their length in frames when moved/copied.
- should fix 6793
Diffstat (limited to 'libs/ardour/midi_region.cc')
-rw-r--r--libs/ardour/midi_region.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc
index 7bb5bc7c06..bdf24f5e08 100644
--- a/libs/ardour/midi_region.cc
+++ b/libs/ardour/midi_region.cc
@@ -192,6 +192,10 @@ void
MidiRegion::set_length_internal (framecnt_t len)
{
Region::set_length_internal (len);
+ /* XX this seems wrong. we asked to set the length in
+ frames without requesting a new beat.
+ may cause beat drift due to frame rounding.
+ */
update_length_beats ();
}
@@ -223,16 +227,13 @@ void
MidiRegion::set_position_internal (framepos_t pos, bool allow_bbt_recompute)
{
Region::set_position_internal (pos, allow_bbt_recompute);
- /* zero length regions don't exist - so if _length_beats is zero, this object
- is under construction.
+
+ /* 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
*/
- if (_length_beats.val() == Evoral::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
- */
- BeatsFramesConverter converter (_session.tempo_map(), _position);
- Region::set_length_internal (converter.to (_length_beats));
- }
+ BeatsFramesConverter converter (_session.tempo_map(), _position);
+ Region::set_length_internal (converter.to (_length_beats));
+ send_change (Properties::length);
}
framecnt_t