From 688bd284583e1b1184ddf7826e49822ac032b098 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Wed, 6 Feb 2019 09:54:13 -0600 Subject: [PATCH] Session-range behavior (libardour part) --- libs/ardour/ardour/session.h | 6 +++--- libs/ardour/luabindings.cc | 4 ++-- libs/ardour/session.cc | 10 +++++----- libs/ardour/session_state.cc | 7 +++++-- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 36f323a6d4..36ca4b4774 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -468,8 +468,8 @@ public: void set_auto_punch_location (Location *); void set_auto_loop_location (Location *); void set_session_extents (samplepos_t start, samplepos_t end); - bool end_is_free () const { return _session_range_end_is_free; } - void set_end_is_free (bool); + bool session_range_is_free () const { return _session_range_is_free; } + void set_session_range_is_free (bool); pframes_t get_block_size () const { return current_block_size; } samplecnt_t worst_output_latency () const { return _worst_output_latency; } @@ -1245,7 +1245,7 @@ private: samplepos_t _transport_sample; gint _seek_counter; Location* _session_range_location; ///< session range, or 0 if there is nothing in the session yet - bool _session_range_end_is_free; + bool _session_range_is_free; bool _silent; samplecnt_t _remaining_latency_preroll; diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index 39fe95cd63..660ef8a57a 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -2290,8 +2290,8 @@ LuaBindings::common (lua_State* L) .addFunction ("cfg", &Session::cfg) .addFunction ("route_groups", &Session::route_groups) .addFunction ("new_route_group", &Session::new_route_group) - .addFunction ("end_is_free", &Session::end_is_free) - .addFunction ("set_end_is_free", &Session::set_end_is_free) + .addFunction ("session_range_is_free", &Session::session_range_is_free) + .addFunction ("set_session_range_is_free", &Session::set_session_range_is_free) .addFunction ("remove_route_group", (void (Session::*)(RouteGroup*))&Session::remove_route_group) .addFunction ("vca_manager", &Session::vca_manager_ptr) .addExtCFunction ("timecode_to_sample_lua", ARDOUR::LuaAPI::timecode_to_sample_lua) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 1a33adc7d1..f43877194b 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -183,7 +183,7 @@ Session::Session (AudioEngine &eng, , _transport_sample (0) , _seek_counter (0) , _session_range_location (0) - , _session_range_end_is_free (true) + , _session_range_is_free (true) , _silent (false) , _remaining_latency_preroll (0) , _engine_speed (1.0) @@ -4642,20 +4642,20 @@ Session::maybe_update_session_range (samplepos_t a, samplepos_t b) } else { - if (a < _session_range_location->start()) { + if (_session_range_is_free && (a < _session_range_location->start())) { _session_range_location->set_start (a); } - if (_session_range_end_is_free && (b > _session_range_location->end())) { + if (_session_range_is_free && (b > _session_range_location->end())) { _session_range_location->set_end (b); } } } void -Session::set_end_is_free (bool yn) +Session::set_session_range_is_free (bool yn) { - _session_range_end_is_free = yn; + _session_range_is_free = yn; } void diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index a8f9d6022f..4ed837e3fd 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1208,7 +1208,8 @@ Session::state (bool save_template, snapshot_t snapshot_type, bool only_used_ass child = node->add_child ("Path"); child->add_content (p); } - node->set_property ("end-is-free", _session_range_end_is_free); + node->set_property ("end-is-free", _session_range_is_free); //deprecated, but keep storing this value for compatibility with prior v5. + node->set_property ("session-range-is-free", _session_range_is_free); } /* save the ID counter */ @@ -1559,7 +1560,9 @@ Session::set_state (const XMLNode& node, int version) setup_raid_path(_session_dir->root_path()); - node.get_property (X_("end-is-free"), _session_range_end_is_free); + node.get_property (X_("end-is-free"), _session_range_is_free); //deprectated, but use old values if they are in the config + + node.get_property (X_("session-range-is-free"), _session_range_is_free); uint64_t counter; if (node.get_property (X_("id-counter"), counter)) {