From 2d07e72d40ca51149578a539560060b6ea3406fc Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Sat, 25 Jan 2020 11:27:31 -0600 Subject: Fix the ability to set Session Start&End Range on a new, empty session set_session_extents had a bug; it wasn't calling locations->add() on the newly created location. The correct implementation was in set_session_range_location, but this was only called from one place. This function was removed, and set_session_extents will be used in its place. set_session_extents will create a session location if one no longer exists, so there is no need for set_session_range_location. --- libs/ardour/ardour/session.h | 2 -- libs/ardour/session.cc | 23 ++++++++--------------- 2 files changed, 8 insertions(+), 17 deletions(-) (limited to 'libs') diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 3c01725740..807c2686eb 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -2033,8 +2033,6 @@ private: void rt_set_controls (boost::shared_ptr, double val, PBD::Controllable::GroupControlDisposition group_override); void rt_clear_all_solo_state (boost::shared_ptr, bool yn, PBD::Controllable::GroupControlDisposition group_override); - void set_session_range_location (samplepos_t, samplepos_t); - void setup_midi_machine_control (); void step_edit_status_change (bool); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 6b988be098..03891d4c47 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1512,18 +1512,18 @@ Session::set_auto_punch_location (Location* location) void Session::set_session_extents (samplepos_t start, samplepos_t end) { - Location* existing; - if ((existing = _locations->session_range_location()) == 0) { - //if there is no existing session, we need to make a new session location (should never happen) - existing = new Location (*this, 0, 0, _("session"), Location::IsSessionRange, 0); - } - if (end <= start) { error << _("Session: you can't use that location for session start/end)") << endmsg; return; } - existing->set( start, end ); + Location* existing; + if ((existing = _locations->session_range_location()) == 0) { + _session_range_location = new Location (*this, start, end, _("session"), Location::IsSessionRange, 0); + _locations->add (_session_range_location); + } else { + existing->set( start, end ); + } set_dirty(); } @@ -4176,7 +4176,7 @@ Session::maybe_update_session_range (samplepos_t a, samplepos_t b) if (_session_range_location == 0) { - set_session_range_location (a, b + session_end_marker_shift_samples); + set_session_extents (a, b + session_end_marker_shift_samples); } else { @@ -6111,13 +6111,6 @@ Session::current_end_sample () const return _session_range_location ? _session_range_location->end() : 0; } -void -Session::set_session_range_location (samplepos_t start, samplepos_t end) -{ - _session_range_location = new Location (*this, start, end, _("session"), Location::IsSessionRange, 0); - _locations->add (_session_range_location); -} - void Session::step_edit_status_change (bool yn) { -- cgit v1.2.3