diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 11a93c4170..4b989f28f1 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -60,6 +60,7 @@ #include "pbd/statefuldestructible.h" #include "pbd/signals.h" #include "pbd/undo.h" +#include "pbd/uuid.h" #ifdef USE_TLSF # include "pbd/tlsf.h" @@ -233,6 +234,7 @@ public: * internal, not user-visible IDs */ static unsigned int next_name_id (); + std::string uuid() const { return _uuid.to_s(); } std::string path() const { return _path; } std::string name() const { return _name; } std::string snap_name() const { return _current_snapshot_name; } @@ -1555,6 +1557,7 @@ private: bool maybe_stop (samplepos_t limit); bool maybe_sync_start (pframes_t &); + PBD::UUID _uuid; std::string _path; std::string _name; bool _is_new; diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index 51625687c2..7421c7027a 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -3136,6 +3136,7 @@ LuaBindings::common (lua_State* L) .addFunction ("name", &Session::name) .addFunction ("path", &Session::path) + .addFunction ("uuid", &Session::uuid) .addFunction ("record_status", &Session::record_status) .addFunction ("maybe_enable_record", &Session::maybe_enable_record) .addFunction ("disable_record", &Session::disable_record) diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index ff29053146..d4e336c7dc 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -831,6 +831,8 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot PBD::Unwinder uw (LV2Plugin::force_state_save, for_archive); + PBD::Unwinder uw2 (_uuid, fork_state != NormalSave ? PBD::UUID () : _uuid); + SessionSaveUnderway (); /* EMIT SIGNAL */ bool mark_as_clean = true; @@ -1235,6 +1237,7 @@ Session::state (bool save_template, snapshot_t snapshot_type, bool for_archive, if (!save_template) { + node->set_property ("uuid", _uuid.to_s()); node->set_property ("name", _name); node->set_property ("sample-rate", _base_sample_rate); @@ -1819,6 +1822,13 @@ Session::set_state (const XMLNode& node, int version) #endif } + { + std::string str; + if (node.get_property ("uuid", str)) { + _uuid = str; + } + } + setup_raid_path(_session_dir->root_path()); node.get_property (X_("end-is-free"), _session_range_is_free); //deprecated, but use old values if they are in the config