From f3b4644969c4a40c1afdd4aa2e77ce8b8b25a3f9 Mon Sep 17 00:00:00 2001 From: nick_m Date: Sat, 11 Jun 2016 05:40:50 +1000 Subject: Fix many offset errors when drawing notes in midi regions that have been edited. - hopefully this can close bugs such as 6270 & 6793 --- libs/ardour/region.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libs/ardour/region.cc') diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 15a3da8b8b..9119659870 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -441,7 +441,6 @@ Region::set_length (framecnt_t len) } - _last_length = _length; set_length_internal (len); _whole_file = false; first_edit (); @@ -459,6 +458,7 @@ Region::set_length (framecnt_t len) void Region::set_length_internal (framecnt_t len) { + _last_length = _length; _length = len; } @@ -925,6 +925,12 @@ Region::trim_to_internal (framepos_t position, framecnt_t length) PropertyChange what_changed; + if (_start != new_start) { + set_start_internal (new_start); + what_changed.add (Properties::start); + } + + /* Set position before length, otherwise for MIDI regions this bad thing happens: * 1. we call set_length_internal; length in beats is computed using the region's current * (soon-to-be old) position @@ -941,11 +947,6 @@ Region::trim_to_internal (framepos_t position, framecnt_t length) what_changed.add (Properties::position); } - if (_start != new_start) { - set_start_internal (new_start); - what_changed.add (Properties::start); - } - if (_length != length) { if (!property_changes_suspended()) { _last_length = _length; @@ -1834,4 +1835,3 @@ Region::latest_possible_frame () const return _position + (minlen - _start) - 1; } - -- cgit v1.2.3