diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-11-27 17:43:32 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-11-27 17:43:32 +0000 |
commit | 7cbcf258ccac270d769ade00bc39edef518d679d (patch) | |
tree | 1a45f878a1b39203288740e85b027879f5f3903c /libs/pbd | |
parent | 979a61eb3f1729affe1b0ab4201749b5cde11f68 (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')
-rw-r--r-- | libs/pbd/controllable.cc | 13 | ||||
-rw-r--r-- | libs/pbd/pbd/controllable.h | 2 |
2 files changed, 13 insertions, 2 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 diff --git a/libs/pbd/pbd/controllable.h b/libs/pbd/pbd/controllable.h index 3ae27f72c2..d0769ffd01 100644 --- a/libs/pbd/pbd/controllable.h +++ b/libs/pbd/pbd/controllable.h @@ -82,7 +82,7 @@ class Controllable : public PBD::StatefulDestructible { static Controllable* by_id (const PBD::ID&); static Controllable* by_name (const std::string&); - + static const std::string xml_node_name; private: std::string _name; |