diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-07-08 19:39:53 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-07-08 19:39:53 +0000 |
commit | 05f8fcd189ca714c2c18b9fb174d5813140849df (patch) | |
tree | 02d5790564f6a6cc3660a3b9dcbc61aa9f40c6a2 /libs/ardour | |
parent | 3dec68cd6b61388a6c9310308e47c1fc892345ed (diff) |
save+restore ID counter; fix buglet introduced with ID's when saving region state
git-svn-id: svn://localhost/ardour2/trunk@672 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/audioregion.cc | 2 | ||||
-rw-r--r-- | libs/ardour/globals.cc | 2 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 22 |
3 files changed, 25 insertions, 1 deletions
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 6665b8d962..4a8593cd63 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -655,7 +655,7 @@ AudioRegion::state (bool full) for (uint32_t n=0; n < sources.size(); ++n) { snprintf (buf2, sizeof(buf2), "source-%d", n); - sources[n]->id().print (buf2); + sources[n]->id().print (buf); node.add_property (buf2, buf); } diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 2ade56f8a9..e9fc1ddfaf 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -195,6 +195,8 @@ ARDOUR::init (AudioEngine& engine, bool use_vst, bool try_optimization) (void) bindtextdomain(PACKAGE, LOCALEDIR); + ID::init (); + Config = new Configuration; if (Config->load_state ()) { diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 9fb20973e2..1e355990b4 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1333,6 +1333,13 @@ Session::state(bool full_state) } } + /* save the ID counter */ + + snprintf (buf, sizeof (buf), "%" PRIu64, ID::counter()); + node->add_property ("id-counter", buf); + + /* various options */ + node->add_child_nocopy (get_options()); child = node->add_child ("Sources"); @@ -1502,6 +1509,21 @@ Session::set_state (const XMLNode& node) if ((prop = node.property ("name")) != 0) { _name = prop->value (); } + + if ((prop = node.property (X_("id-counter"))) != 0) { + uint64_t x; + sscanf (prop->value().c_str(), "%" PRIu64, &x); + ID::init_counter (x); + } else { + /* old sessions used a timebased counter, so fake + the startup ID counter based on a standard + timestamp. + */ + time_t now; + time (&now); + ID::init_counter (now); + } + IO::disable_ports (); IO::disable_connecting (); |