From 3bf6e013eeea740199261752a705fa7556f0e3b1 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 25 Feb 2021 08:57:40 -0700 Subject: [PATCH] get rid of Region _last_position member, since the _last_length member has its own position --- libs/ardour/ardour/region.h | 5 ++--- libs/ardour/region.cc | 12 ++---------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index f247e26e68..364b4b03e2 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -141,7 +141,7 @@ public: /* these two are valid ONLY during a StateChanged signal handler */ - timepos_t last_position () const { return _last_position; } + timepos_t last_position () const { return _last_length.position(); } timecnt_t last_length () const { return _last_length; } samplecnt_t ancestral_start_sample () const { return _ancestral_start.val().samples(); } @@ -174,7 +174,7 @@ public: samplepos_t latest_possible_sample () const; Temporal::TimeRange last_range () const { - return Temporal::TimeRange (_last_position, _last_position + _last_length); + return Temporal::TimeRange (last_position(), last_position() + _last_length); } Temporal::TimeRange range_samples () const { @@ -522,7 +522,6 @@ private: PBD::Property _contents; // type is irrelevant timecnt_t _last_length; - timepos_t _last_position; mutable RegionEditState _first_edit; layer_t _layer; diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 3daed2cca9..8496cb898e 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -246,7 +246,6 @@ Region::Region (Session& s, timecnt_t const & start, timecnt_t const & length, c , _type(type) , REGION_DEFAULT_STATE(start,length) , _last_length (length) - , _last_position (_type == DataType::MIDI ? timepos_t (Temporal::Beats()) : timepos_t::from_superclock (0)) , _first_edit (EditChangesNothing) , _layer (0) , _changemap (0) @@ -263,7 +262,6 @@ Region::Region (const SourceList& srcs) , REGION_DEFAULT_STATE(_type == DataType::MIDI ? timecnt_t (Temporal::Beats()) : timecnt_t::from_superclock (0), _type == DataType::MIDI ? timecnt_t (Temporal::Beats()) : timecnt_t::from_superclock (0)) , _last_length (_type == DataType::MIDI ? timecnt_t (Temporal::Beats()) : timecnt_t::from_superclock (0)) - , _last_position (_type == DataType::MIDI ? timepos_t (Temporal::Beats()) : timepos_t::from_superclock (0)) , _first_edit (EditChangesNothing) , _layer (0) , _changemap (0) @@ -284,7 +282,6 @@ Region::Region (boost::shared_ptr other) , _type (other->data_type()) , REGION_COPY_STATE (other) , _last_length (other->_last_length) - , _last_position(other->_last_position) \ , _first_edit (EditChangesNothing) , _layer (other->_layer) , _changemap (other->_changemap) @@ -343,7 +340,6 @@ Region::Region (boost::shared_ptr other, timecnt_t const & offset) , _type (other->data_type()) , REGION_COPY_STATE (other) , _last_length (other->_last_length) - , _last_position(other->_last_position) \ , _first_edit (EditChangesNothing) , _layer (other->_layer) , _changemap (other->_changemap) @@ -389,7 +385,6 @@ Region::Region (boost::shared_ptr other, const SourceList& srcs) , _type (srcs.front()->type()) , REGION_COPY_STATE (other) , _last_length (other->_last_length) - , _last_position (other->_last_position) , _first_edit (EditChangesID) , _layer (other->_layer) , _changemap (other->_changemap) @@ -672,8 +667,7 @@ Region::set_position_internal (timepos_t const & pos) * (see Region::set_position), so we must always set this up so that * e.g. Playlist::notify_region_moved doesn't use an out-of-date last_position. */ - _last_position = position(); - _last_length.set_position (_last_position); + _last_length.set_position (position()); if (position() != pos) { #warning NUTEMPO is this correct? why would set position set the position of the start (duration)? @@ -721,7 +715,6 @@ Region::set_initial_position (timepos_t const & pos) recompute_position_from_time_domain (); /* ensure that this move doesn't cause a range move */ - _last_position = position(); _last_length.set_position (position()); } @@ -1005,7 +998,7 @@ Region::trim_to_internal (timepos_t const & pos, timecnt_t const & len) if (position() != pos) { if (!property_changes_suspended()) { - _last_position = position(); + _last_length.set_position (position()); } set_position_internal (pos); what_changed.add (Properties::position); @@ -1391,7 +1384,6 @@ Region::suspend_property_changes () { Stateful::suspend_property_changes (); _last_length = _length; - _last_position = position(); } void