properly clean up meter-pattern cache
[ardour.git] / libs / surfaces / control_protocol / control_protocol.cc
index e0eb57fc87836038572492fb97ea0554aeecb043..6ac673925a52d347f7fe1700197e20135cc52dde 100644 (file)
@@ -53,6 +53,8 @@ PBD::Signal0<void>          ControlProtocol::ClearRouteSelection;
 PBD::Signal0<void>          ControlProtocol::StepTracksDown;
 PBD::Signal0<void>          ControlProtocol::StepTracksUp;
 
+const std::string ControlProtocol::state_node_name ("Protocol");
+
 ControlProtocol::ControlProtocol (Session& s, string str)
        : BasicUI (s)
        , _name (str)
@@ -64,6 +66,13 @@ ControlProtocol::~ControlProtocol ()
 {
 }
 
+int
+ControlProtocol::set_active (bool yn)
+{
+       _active = yn;
+       return 0;
+}
+
 void
 ControlProtocol::next_track (uint32_t initial_id)
 {
@@ -272,7 +281,7 @@ ControlProtocol::route_get_peak_input_power (uint32_t table_index, uint32_t whic
                return 0.0f;
        }
 
-       return r->peak_meter().peak_power (which_input);
+       return r->peak_meter().meter_level (which_input, MeterPeak);
 }
 
 
@@ -356,5 +365,28 @@ ControlProtocol:: route_get_name (uint32_t table_index)
 list<boost::shared_ptr<Bundle> >
 ControlProtocol::bundles ()
 {
-       return list<boost::shared_ptr<Bundle> > ();
+       return list<boost::shared_ptr<Bundle> > ();
+}
+
+XMLNode&
+ControlProtocol::get_state ()
+{
+       XMLNode* node = new XMLNode (state_node_name);
+
+       node->add_property ("name", _name);
+       node->add_property ("feedback", get_feedback() ? "yes" : "no");
+
+       return *node;
+}
+
+int
+ControlProtocol::set_state (XMLNode const & node, int /* version */)
+{
+       const XMLProperty* prop;
+
+       if ((prop = node.property ("feedback")) != 0) {
+               set_feedback (string_is_affirmative (prop->value()));
+       }
+
+       return 0;
 }