From c3afeab49c7f454f58bd1fb17b39ccac1d39258e Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 7 Mar 2016 16:46:36 -0500 Subject: [PATCH] don't increment actual VCA counter when saving session state --- libs/ardour/ardour/vca.h | 3 +++ libs/ardour/session_state.cc | 2 +- libs/ardour/vca.cc | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/ardour/ardour/vca.h b/libs/ardour/ardour/vca.h index 42224eb708..069eb98564 100644 --- a/libs/ardour/ardour/vca.h +++ b/libs/ardour/ardour/vca.h @@ -55,6 +55,9 @@ class LIBARDOUR_API VCA : public Stripable, public Automatable, public boost::en static std::string default_name_template (); static int next_vca_number (); static std::string xml_node_name; + + /* used by Session to save/restore the atomic counter */ + static uint32_t get_next_vca_number (); static void set_next_vca_number (uint32_t); virtual boost::shared_ptr gain_control() const { return _gain_control; } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 273aef20a7..45d6f6efce 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1102,7 +1102,7 @@ Session::state (bool full_state) /* save the VCA counter */ - snprintf (buf, sizeof (buf), "%" PRIu32, VCA::next_vca_number()); + snprintf (buf, sizeof (buf), "%" PRIu32, VCA::get_next_vca_number()); node->add_property ("vca-counter", buf); /* various options */ diff --git a/libs/ardour/vca.cc b/libs/ardour/vca.cc index aafb084a40..2616549e17 100644 --- a/libs/ardour/vca.cc +++ b/libs/ardour/vca.cc @@ -55,6 +55,12 @@ VCA::set_next_vca_number (uint32_t n) g_atomic_int_set (&next_number, n); } +uint32_t +VCA::get_next_vca_number () +{ + return g_atomic_int_get (&next_number); +} + VCA::VCA (Session& s, uint32_t num, const string& name) : Stripable (s, name) , Automatable (s)