From 8a7d92f196a2ce35f8d868e49f37af82c68a06f9 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 9 Apr 2024 21:59:42 +0200 Subject: [PATCH] Fix MonotorProc's channel_solo_control Previously only ::set_solo() worked. Directly using the controllable did not update `solo_cnt` and other channels were not muted. --- libs/ardour/monitor_processor.cc | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/libs/ardour/monitor_processor.cc b/libs/ardour/monitor_processor.cc index 91dd07e9d0..6e3cc2aa58 100644 --- a/libs/ardour/monitor_processor.cc +++ b/libs/ardour/monitor_processor.cc @@ -108,6 +108,22 @@ MonitorProcessor::allocate_channels (uint32_t size) while (_channels.size() < size) { _channels.push_back (new ChannelRecord (n)); + + /* update solo_cnt when Solo changes */ + std::shared_ptr sc = _channels.back()->soloed_control; + std::weak_ptr wc (sc); + sc->Changed.connect_same_thread (*this, [this, wc](bool, PBD::Controllable::GroupControlDisposition) + { + std::shared_ptr ac = wc.lock (); + if (ac && ac->get_value () > 0) { + solo_cnt++; + } else { + if (solo_cnt > 0) { + solo_cnt--; + } + } + update_monitor_state (); + }); } } @@ -391,18 +407,8 @@ MonitorProcessor::set_cut (uint32_t chn, bool yn) void MonitorProcessor::set_solo (uint32_t chn, bool solo) { - if (solo != _channels[chn]->soloed) { - _channels[chn]->soloed = solo; - - if (solo) { - solo_cnt++; - } else { - if (solo_cnt > 0) { - solo_cnt--; - } - } - } - update_monitor_state (); + _channels[chn]->soloed = solo; + /* update_monitor_state is called via the Changed signal */ } void