diff options
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; |