diff --git a/include/MixerChannelView.h b/include/MixerChannelView.h index 8d2306f91..86c7f247d 100644 --- a/include/MixerChannelView.h +++ b/include/MixerChannelView.h @@ -97,6 +97,7 @@ namespace lmms::gui void removeUnusedChannels(); void moveChannelLeft(); void moveChannelRight(); + void toggledMute(); private: QString elideName(const QString& name); diff --git a/include/MixerView.h b/include/MixerView.h index bc99a3340..251becb27 100644 --- a/include/MixerView.h +++ b/include/MixerView.h @@ -98,7 +98,6 @@ protected: private slots: void updateFaders(); void toggledSolo(); - void toggledMute(); private: void updateAllMixerChannels(); diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index cbd9019f1..a2edc5c5f 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -104,7 +104,7 @@ namespace lmms::gui m_muteButton->setInactiveGraphic(embed::getIconPixmap("led_green")); m_muteButton->setCheckable(true); m_muteButton->setToolTip(tr("Mute this channel")); - connect(&mixerChannel->m_muteModel, &BoolModel::dataChanged, mixerView, &MixerView::toggledMute, Qt::DirectConnection); + connect(&mixerChannel->m_muteModel, &BoolModel::dataChanged, this, &MixerChannelView::toggledMute, Qt::DirectConnection); m_soloButton = new PixmapButton(this, tr("Solo")); m_soloButton->setModel(&mixerChannel->m_soloModel); @@ -274,11 +274,24 @@ namespace lmms::gui void MixerChannelView::setChannelIndex(int index) { + // First disconnect the signals of the previous mixer channel + auto * currentMixerChannel = Engine::mixer()->mixerChannel(m_channelIndex); + disconnect(¤tMixerChannel->m_muteModel, &BoolModel::dataChanged, this, &MixerChannelView::toggledMute); + disconnect(¤tMixerChannel->m_soloModel, &BoolModel::dataChanged, m_mixerView, &MixerView::toggledSolo); + MixerChannel* mixerChannel = Engine::mixer()->mixerChannel(index); m_fader->setModel(&mixerChannel->m_volumeModel); - m_muteButton->setModel(&mixerChannel->m_muteModel); - m_soloButton->setModel(&mixerChannel->m_soloModel); + + auto * muteModel = &mixerChannel->m_muteModel; + m_muteButton->setModel(muteModel); + connect(muteModel, &BoolModel::dataChanged, this, &MixerChannelView::toggledMute, Qt::DirectConnection); + + auto * soloModel = &mixerChannel->m_soloModel; + m_soloButton->setModel(soloModel); + connect(soloModel, &BoolModel::dataChanged, m_mixerView, &MixerView::toggledSolo, Qt::DirectConnection); + m_effectRackView->setModel(&mixerChannel->m_fxChain); + m_channelIndex = index; } @@ -437,6 +450,11 @@ namespace lmms::gui mix->moveChannelRight(m_channelIndex); } + void MixerChannelView::toggledMute() + { + update(); + } + QString MixerChannelView::elideName(const QString& name) { const auto maxTextHeight = m_renameLineEdit->width(); diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index ea6a28948..62d436fed 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -288,11 +288,6 @@ void MixerView::toggledSolo() } -void MixerView::toggledMute() -{ - updateAllMixerChannels(); -} - void MixerView::updateAllMixerChannels() { for (int i = 0; i < m_mixerChannelViews.size(); ++i)