X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fmute_master.cc;h=14411580fd5806256743ceaea4aa69d330db6c8f;hb=9e0d03020ff47773f7d1c0414de1c74e6c9e0dac;hp=ca64fb01a591ae318fbe4df28a59ab3a2d520874;hpb=e6eb059576eefd9a26c177627ae7dd3ba2feb727;p=ardour.git diff --git a/libs/ardour/mute_master.cc b/libs/ardour/mute_master.cc index ca64fb01a5..14411580fd 100644 --- a/libs/ardour/mute_master.cc +++ b/libs/ardour/mute_master.cc @@ -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,10 @@ */ +#include "pbd/enumwriter.h" +#include "pbd/xml++.h" + +#include "ardour/types.h" #include "ardour/mute_master.h" #include "ardour/rc_configuration.h" @@ -25,14 +29,14 @@ using namespace ARDOUR; +const MuteMaster::MutePoint MuteMaster::AllPoints = MutePoint (MuteMaster::PreFader| + MuteMaster::PostFader| + MuteMaster::Listen| + MuteMaster::Main); + MuteMaster::MuteMaster (Session& s, const std::string& name) - : AutomationControl (s, Evoral::Parameter (MuteAutomation), boost::shared_ptr(), name) - , _mute_point (MutePoint (0)) + : _mute_point (MutePoint (0)) { - // default range for parameter is fine - - _automation = new AutomationList (MuteAutomation); - set_list (boost::shared_ptr(_automation)); } void @@ -62,18 +66,6 @@ MuteMaster::unmute_at (MutePoint mp) } } -void -MuteMaster::mute (bool yn) -{ - /* convenience wrapper around AutomationControl method */ - - if (yn) { - set_value (1.0f); - } else { - set_value (0.0f); - } -} - gain_t MuteMaster::mute_gain_at (MutePoint mp) const { @@ -84,26 +76,22 @@ MuteMaster::mute_gain_at (MutePoint mp) const } } -void -MuteMaster::set_value (float f) +int +MuteMaster::set_state (const XMLNode& node, int /*version*/) { - mute_at ((MutePoint) ((int) rint (f))); -} + const XMLProperty* prop; -float -MuteMaster::get_value () const -{ - return (float) _mute_point; -} + if ((prop = node.property ("mute-point")) != 0) { + _mute_point = (MutePoint) string_2_enum (prop->value(), _mute_point); + } -int -MuteMaster::set_state (const XMLNode& node) -{ 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; }