From 6dac4da98344ed8ce609a4e7d567ef2f9fbb9b31 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 28 Apr 2010 01:29:06 +0000 Subject: more solo/mute architecture work. NOTE: changes to mute points are ignored right now git-svn-id: svn://localhost/ardour2/branches/3.0@7009 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/mute_master.cc | 66 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 16 deletions(-) (limited to 'libs/ardour/mute_master.cc') diff --git a/libs/ardour/mute_master.cc b/libs/ardour/mute_master.cc index b3b3d23724..0182e205d0 100644 --- a/libs/ardour/mute_master.cc +++ b/libs/ardour/mute_master.cc @@ -28,6 +28,7 @@ #include "i18n.h" using namespace ARDOUR; +using namespace std; const MuteMaster::MutePoint MuteMaster::AllPoints = MutePoint (MuteMaster::PreFader| MuteMaster::PostFader| @@ -35,26 +36,18 @@ const MuteMaster::MutePoint MuteMaster::AllPoints = MutePoint (MuteMaster::PreFa MuteMaster::Main); MuteMaster::MuteMaster (Session&, const std::string&) - : _mute_point (MutePoint (0)) + : _mute_point (AllPoints) , _self_muted (false) , _muted_by_others (0) { } -void -MuteMaster::clear_mute () -{ - if (_mute_point != MutePoint (0)) { - _mute_point = MutePoint (0); - MutePointChanged (); // EMIT SIGNAL - } -} - void MuteMaster::mute_at (MutePoint mp) { if ((_mute_point & mp) != mp) { _mute_point = MutePoint (_mute_point | mp); + cerr << "Mute point set, now " << _mute_point << endl; MutePointChanged (); // EMIT SIGNAL } } @@ -64,10 +57,17 @@ MuteMaster::unmute_at (MutePoint mp) { if ((_mute_point & mp) == mp) { _mute_point = MutePoint (_mute_point & ~mp); + cerr << "Mute point unset, now " << _mute_point << endl; MutePointChanged (); // EMIT SIGNAL } } +void +MuteMaster::clear_muted_by_others () +{ + _muted_by_others = 0; +} + void MuteMaster::mod_muted_by_others (int32_t delta) { @@ -82,14 +82,45 @@ MuteMaster::mod_muted_by_others (int32_t delta) } } +void +MuteMaster::set_solo_level (int32_t l) +{ + _solo_level = l; +} + gain_t MuteMaster::mute_gain_at (MutePoint mp) const { - if (muted_at (mp)) { - return Config->get_solo_mute_gain (); - } else { - return 1.0; - } + gain_t gain; + int32_t l = _solo_level; + + if (Config->get_solo_mute_override()) { + if (l == 2) { // self-soloed + gain = 1.0; + } else if (self_muted_at (mp)) { // self-muted + gain = Config->get_solo_mute_gain (); + } else if (l == 1) { // soloed by others + gain = 1.0; + } else if (muted_by_others_at (mp)) { // muted by others + gain = Config->get_solo_mute_gain (); + } else { + gain = 1.0; + } + } else { + if (self_muted_at (mp)) { // self-muted + gain = Config->get_solo_mute_gain (); + } else if (l == 2) { // self-soloed + gain = 1.0; + } else if (muted_by_others_at (mp)) { // muted by others + gain = Config->get_solo_mute_gain (); + } else if (l == 1) { // soloed by others + gain = 1.0; + } else { + gain = 1.0; + } + } + + return gain; } void @@ -98,6 +129,7 @@ MuteMaster::set_mute_points (const std::string& mute_point) MutePoint old = _mute_point; _mute_point = (MutePoint) string_2_enum (mute_point, _mute_point); + cerr << "Mute point set from string, now " << _mute_point << endl; if (old != _mute_point) { MutePointChanged(); /* EMIT SIGNAL */ @@ -109,6 +141,7 @@ MuteMaster::set_mute_points (MutePoint mp) { if (_mute_point != mp) { _mute_point = mp; + cerr << "Mute point set from mp, now " << _mute_point << endl; MutePointChanged (); /* EMIT SIGNAL */ } } @@ -119,7 +152,8 @@ 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); + //_mute_point = (MutePoint) string_2_enum (prop->value(), _mute_point); + cerr << "Mute point set from STATE string, now " << _mute_point << endl; } if ((prop = node.property ("muted")) != 0) { -- cgit v1.2.3