summaryrefslogtreecommitdiff
path: root/libs/pbd/controllable.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-11-27 17:43:32 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-11-27 17:43:32 +0000
commit7cbcf258ccac270d769ade00bc39edef518d679d (patch)
tree1a45f878a1b39203288740e85b027879f5f3903c /libs/pbd/controllable.cc
parent979a61eb3f1729affe1b0ab4201749b5cde11f68 (diff)
changes associated with save/restore of AutomationControl id's
git-svn-id: svn://localhost/ardour2/branches/3.0@8111 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/controllable.cc')
-rw-r--r--libs/pbd/controllable.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/libs/pbd/controllable.cc b/libs/pbd/controllable.cc
index 38780bddbe..b79a523a00 100644
--- a/libs/pbd/controllable.cc
+++ b/libs/pbd/controllable.cc
@@ -36,6 +36,7 @@ PBD::Signal1<void,Controllable*> Controllable::DeleteBinding;
Glib::StaticRWLock Controllable::registry_lock = GLIBMM_STATIC_RW_LOCK_INIT;
Controllable::Controllables Controllable::registry;
PBD::ScopedConnectionList registry_connections;
+const std::string Controllable::xml_node_name = X_("Controllable");
Controllable::Controllable (const string& name, Flag f)
: _name (name)
@@ -100,13 +101,15 @@ Controllable::by_name (const string& str)
XMLNode&
Controllable::get_state ()
{
- XMLNode* node = new XMLNode (X_("Controllable"));
+ XMLNode* node = new XMLNode (xml_node_name);
char buf[64];
node->add_property (X_("name"), _name); // not reloaded from XML state, just there to look at
_id.print (buf, sizeof (buf));
node->add_property (X_("id"), buf);
node->add_property (X_("flags"), enum_2_string (_flags));
+ snprintf (buf, sizeof (buf), "%2.12f", get_value());
+ node->add_property (X_("value"), buf);
return *node;
}
@@ -127,6 +130,14 @@ Controllable::set_state (const XMLNode& node, int /*version*/)
if ((prop = node.property (X_("flags"))) != 0) {
_flags = (Flag) string_2_enum (prop->value(), _flags);
}
+
+ if ((prop = node.property (X_("value"))) != 0) {
+ float val;
+
+ if (sscanf (prop->value().c_str(), "%f", &val) == 1) {
+ set_value (val);
+ }
+ }
}
void