summaryrefslogtreecommitdiff
path: root/libs/ardour/route.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-12-18 14:27:15 +0100
committerRobin Gareus <robin@gareus.org>2015-12-18 14:27:15 +0100
commit3eb04c3c2320ba60185e6efde170b562c3518e50 (patch)
tree778cc76f20384c6c72ae38edc5006425bdea6b4c /libs/ardour/route.cc
parent7b6ef41f0caca083441748a4ef5d836df2be243a (diff)
save/restore plugin state with track-template
Diffstat (limited to 'libs/ardour/route.cc')
-rw-r--r--libs/ardour/route.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 78eca17397..e24919a3b3 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -4158,7 +4158,30 @@ Route::shift (framepos_t pos, framecnt_t frames)
int
Route::save_as_template (const string& path, const string& name)
{
+ {
+ // would be nice to use foreach_processor()
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
+ std::string state_dir = path.substr (0, path.find_last_of ('.')); // strip template_suffix
+ for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) {
+ boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (*i);
+ if (pi) {
+ pi->set_state_dir (state_dir);
+ }
+ }
+ }
+
XMLNode& node (state (false));
+
+ {
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
+ for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) {
+ boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (*i);
+ if (pi) {
+ pi->set_state_dir ();
+ }
+ }
+ }
+
XMLTree tree;
IO::set_name_in_state (*node.children().front(), name);