diff options
author | Robin Gareus <robin@gareus.org> | 2015-11-20 03:11:39 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-11-20 03:22:41 +0100 |
commit | 4c04e8028aa73177f4ab02e3c82ea051e20b4edb (patch) | |
tree | 9687dcb70eac2630a962792b44c5c6bd00e816cd /libs/ardour/session_state.cc | |
parent | c4084932fab7ceb32a7a62ec5206fff18173dc1f (diff) |
add API to read snapshot name from instant.xml
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r-- | libs/ardour/session_state.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 9e8f8dcf2d..48bacdfe07 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -4216,6 +4216,29 @@ Session::get_info_from_path (const string& xmlpath, float& sample_rate, SampleFo return !(found_sr && found_data_format); // zero if they are both found } +std::string +Session::get_snapshot_from_instant (const std::string& session_dir) +{ + std::string instant_xml_path = Glib::build_filename (session_dir, "instant.xml"); + + if (!Glib::file_test (instant_xml_path, Glib::FILE_TEST_EXISTS)) { + return ""; + } + + XMLTree tree; + if (!tree.read (instant_xml_path)) { + return ""; + } + + const XMLProperty* prop; + XMLNode *last_used_snapshot = tree.root()->child("LastUsedSnapshot"); + if (last_used_snapshot && (prop = last_used_snapshot->property ("name")) != 0) { + return prop->value(); + } + + return ""; +} + typedef std::vector<boost::shared_ptr<FileSource> > SeveralFileSources; typedef std::map<std::string,SeveralFileSources> SourcePathMap; |