diff options
author | Taybin Rutkin <taybin@taybin.com> | 2006-07-11 04:15:29 +0000 |
---|---|---|
committer | Taybin Rutkin <taybin@taybin.com> | 2006-07-11 04:15:29 +0000 |
commit | 2161752a1bba3426c1ffbf5c5ceda734d4a48b25 (patch) | |
tree | 54072417ee6550121284167cf523ed94f0368d92 /libs/ardour/audio_library.cc | |
parent | c3b4df9867c727bd59d36b52911f9ebe2efea0c0 (diff) |
Fix for compiling on gcc4.
AudioLibrary now stateful.
git-svn-id: svn://localhost/ardour2/trunk@675 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audio_library.cc')
-rw-r--r-- | libs/ardour/audio_library.cc | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/libs/ardour/audio_library.cc b/libs/ardour/audio_library.cc index 7f421e86c8..168a1dcf5d 100644 --- a/libs/ardour/audio_library.cc +++ b/libs/ardour/audio_library.cc @@ -75,11 +75,16 @@ AudioLibrary::AudioLibrary () lrdf_free_statements(matches); + XMLNode* state = instant_xml(X_("AudioLibrary"), get_user_ardour_path()); + if (state) { + set_state(*state); + } scan_paths(); } AudioLibrary::~AudioLibrary () { + add_instant_xml(get_state(), get_user_ardour_path()); } void @@ -429,5 +434,50 @@ AudioLibrary::safe_file_extension(string file) file.rfind(".maud")== string::npos && file.rfind(".vwe") == string::npos && file.rfind(".paf") == string::npos && +#ifdef HAVE_COREAUDIO + file.rfind(".mp3") == string::npos && + file.rfind(".aac") == string::npos && + file.rfind(".mp4") == string::npos && +#endif // HAVE_COREAUDIO file.rfind(".voc") == string::npos); } + +XMLNode& +AudioLibrary::get_state () +{ + XMLNode* root = new XMLNode(X_("AudioLibrary")); + + for (vector<string>::iterator i = sfdb_paths.begin(); i != sfdb_paths.end(); ++i) { + XMLNode* node = new XMLNode(X_("Path")); + node->add_property("value", *i); + root->add_child_nocopy(*node); + } + + return *root; +} + +int +AudioLibrary::set_state (const XMLNode& node) +{ + if (node.name() != X_("AudioLibrary")) { + fatal << "programming error: AudioLibrary: incorrect XML node sent to set_state()" << endmsg; + return -1; + } + + XMLNodeList nodes = node.children(X_("Path")); + + vector<string> paths; + XMLProperty* prop; + XMLNode* child; + for (XMLNodeConstIterator iter = nodes.begin(); iter != nodes.end(); ++iter) { + child = *iter; + + if ((prop = child->property(X_("value"))) != 0) { + paths.push_back(prop->value()); + } + } + + sfdb_paths = paths; + + return 0; +} |