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 | |
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')
-rw-r--r-- | libs/ardour/ardour/audio_library.h | 7 | ||||
-rw-r--r-- | libs/ardour/audio_library.cc | 50 | ||||
-rw-r--r-- | libs/ardour/globals.cc | 5 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 2 |
4 files changed, 60 insertions, 4 deletions
diff --git a/libs/ardour/ardour/audio_library.h b/libs/ardour/ardour/audio_library.h index 2f9e84551b..3d4585fbd8 100644 --- a/libs/ardour/ardour/audio_library.h +++ b/libs/ardour/ardour/audio_library.h @@ -28,18 +28,23 @@ #include <sigc++/signal.h> +#include <pbd/stateful.h> + using std::vector; using std::string; using std::map; namespace ARDOUR { -class AudioLibrary +class AudioLibrary : public Stateful { public: AudioLibrary (); ~AudioLibrary (); + XMLNode& get_state (void); + int set_state (const XMLNode&); + void set_paths (vector<string> paths); vector<string> get_paths (); void scan_paths (); 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; +} diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index e9fc1ddfaf..ffcc4ddb05 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -32,6 +32,7 @@ #include <lrdf.h> #include <pbd/error.h> +#include <pbd/id.h> #include <pbd/strsplit.h> #include <midi++/port.h> @@ -195,7 +196,7 @@ ARDOUR::init (AudioEngine& engine, bool use_vst, bool try_optimization) (void) bindtextdomain(PACKAGE, LOCALEDIR); - ID::init (); + PBD::ID::init (); Config = new Configuration; @@ -294,7 +295,7 @@ ARDOUR::init (AudioEngine& engine, bool use_vst, bool try_optimization) info << "No H/W specific optimizations in use" << endmsg; } - + lrdf_init(); Library = new AudioLibrary; diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 1e355990b4..b6b9746c92 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1499,7 +1499,7 @@ Session::set_state (const XMLNode& node) _state_of_the_state = StateOfTheState (_state_of_the_state|CannotSave); - if (node.name() != "Session"){ + if (node.name() != X_("Session")){ fatal << _("programming error: Session: incorrect XML node sent to set_state()") << endmsg; return -1; } |