Fix unused parameter warnings since GCC apparently doesn't feel like listening to...
[ardour.git] / libs / ardour / mute_master.cc
index ca64fb01a591ae318fbe4df28a59ab3a2d520874..224eccdd515b55dc2975f6136a7b8550234ac905 100644 (file)
@@ -1,6 +1,6 @@
 /*
 
-    Copyright (C) 2009 Paul Davis 
+    Copyright (C) 2009 Paul Davis
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -18,6 +18,8 @@
 
 */
 
+#include "pbd/enumwriter.h"
+
 #include "ardour/mute_master.h"
 #include "ardour/rc_configuration.h"
 
@@ -68,7 +70,7 @@ MuteMaster::mute (bool yn)
        /* convenience wrapper around AutomationControl method */
 
        if (yn) {
-               set_value (1.0f);
+               set_value ((float) 0xffff);
        } else {
                set_value (0.0f);
        }
@@ -87,7 +89,11 @@ MuteMaster::mute_gain_at (MutePoint mp) const
 void
 MuteMaster::set_value (float f)
 {
-       mute_at ((MutePoint) ((int) rint (f)));
+       MutePoint old = _mute_point;
+       _mute_point = (MutePoint) (rint (f));
+       if (old != _mute_point) {
+               MutePointChanged (); // EMIT SIGNAL
+       }
 }
 
 float
@@ -97,13 +103,21 @@ MuteMaster::get_value () const
 }
 
 int
-MuteMaster::set_state (const XMLNode& node)
+MuteMaster::set_state (const XMLNode& node, int /*version*/)
 {
+       const XMLProperty* prop;
+
+       if ((prop = node.property ("mute-point")) != 0) {
+               _mute_point = (MutePoint) string_2_enum (prop->value(), _mute_point);
+       }
+
        return 0;
 }
 
 XMLNode&
 MuteMaster::get_state()
 {
-       return *(new XMLNode (X_("MuteMaster")));
+       XMLNode* node = new XMLNode (X_("MuteMaster"));
+       node->add_property ("mute-point", enum_2_string (_mute_point));
+       return *node;
 }