Recursively unmute channels when soloing in the mixer (#6746)
* unmute related FX channels When soled one FX channel, unmute send and receive channels, to allow complex FX channel routing (BUS, SENDs, etc.) * Comment change * SEND channels Activate also SEND channels recursively * Remove unnecessary whitespace * Encapsulate mixer channel index Make the mixer channel index `m_channelIndex` private and add getters and setters. Also add a method to determine if the channel is the master channel. Move `m_channelIndex` to the end of the initialization list of the `MixerChannel` constructor because it is now the last member in the header. Adjust all clients to make use of the new methods. * Replace const int& getIndex() with int index() const * Format changes --------- Co-authored-by: Michael Gregorius <michael.gregorius.git@arcor.de> Co-authored-by: Sotonye Atemie <sakertooth@gmail.com>
This commit is contained in:
@@ -44,7 +44,7 @@ MixerRoute::MixerRoute( MixerChannel * from, MixerChannel * to, float amount ) :
|
||||
m_from( from ),
|
||||
m_to( to ),
|
||||
m_amount(amount, 0, 1, 0.001f, nullptr,
|
||||
tr("Amount to send from channel %1 to channel %2").arg(m_from->m_channelIndex).arg(m_to->m_channelIndex))
|
||||
tr("Amount to send from channel %1 to channel %2").arg(m_from->index()).arg(m_to->index()))
|
||||
{
|
||||
//qDebug( "created: %d to %d", m_from->m_channelIndex, m_to->m_channelIndex );
|
||||
// create send amount model
|
||||
@@ -54,7 +54,7 @@ MixerRoute::MixerRoute( MixerChannel * from, MixerChannel * to, float amount ) :
|
||||
void MixerRoute::updateName()
|
||||
{
|
||||
m_amount.setDisplayName(
|
||||
tr( "Amount to send from channel %1 to channel %2" ).arg( m_from->m_channelIndex ).arg( m_to->m_channelIndex ) );
|
||||
tr("Amount to send from channel %1 to channel %2").arg(m_from->index()).arg(m_to->index()));
|
||||
}
|
||||
|
||||
|
||||
@@ -70,9 +70,9 @@ MixerChannel::MixerChannel( int idx, Model * _parent ) :
|
||||
m_volumeModel(1.f, 0.f, 2.f, 0.001f, _parent),
|
||||
m_name(),
|
||||
m_lock(),
|
||||
m_channelIndex( idx ),
|
||||
m_queued( false ),
|
||||
m_dependenciesMet(0)
|
||||
m_dependenciesMet(0),
|
||||
m_channelIndex(idx)
|
||||
{
|
||||
zeroSampleFrames(m_buffer, Engine::audioEngine()->framesPerPeriod());
|
||||
}
|
||||
@@ -109,8 +109,55 @@ void MixerChannel::incrementDeps()
|
||||
|
||||
void MixerChannel::unmuteForSolo()
|
||||
{
|
||||
//TODO: Recursively activate every channel, this channel sends to
|
||||
m_muteModel.setValue(false);
|
||||
|
||||
// if channel is not master, unmute also every channel it sends to/receives from
|
||||
if (!isMaster())
|
||||
{
|
||||
for (const MixerRoute* sendsRoute : m_sends)
|
||||
{
|
||||
sendsRoute->receiver()->unmuteSenderForSolo();
|
||||
}
|
||||
|
||||
for (const MixerRoute* receiverRoute : m_receives)
|
||||
{
|
||||
receiverRoute->sender()->unmuteReceiverForSolo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MixerChannel::unmuteSenderForSolo()
|
||||
{
|
||||
m_muteModel.setValue(false);
|
||||
|
||||
// if channel is not master, unmute every channel it sends to
|
||||
if (!isMaster())
|
||||
{
|
||||
for (const MixerRoute* sendsRoute : m_sends)
|
||||
{
|
||||
sendsRoute->receiver()->unmuteSenderForSolo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MixerChannel::unmuteReceiverForSolo()
|
||||
{
|
||||
m_muteModel.setValue(false);
|
||||
|
||||
// if channel is not master, unmute every channel it receives from, and of those, unmute the channels they send to
|
||||
if (!isMaster())
|
||||
{
|
||||
for (const MixerRoute* receiverRoute : m_receives)
|
||||
{
|
||||
receiverRoute->sender()->unmuteReceiverForSolo();
|
||||
}
|
||||
|
||||
for (const MixerRoute* sendsRoute : m_sends)
|
||||
{
|
||||
sendsRoute->receiver()->unmuteSenderForSolo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -275,7 +322,7 @@ void Mixer::toggledSolo()
|
||||
} else {
|
||||
activateSolo();
|
||||
}
|
||||
// unmute the soloed chan and every channel it sends to
|
||||
// unmute the soloed chan and every channel it sends to/receives from
|
||||
m_mixerChannels[soloedChan]->unmuteForSolo();
|
||||
} else {
|
||||
deactivateSolo();
|
||||
@@ -360,7 +407,7 @@ void Mixer::deleteChannel( int index )
|
||||
validateChannelName( i, i + 1 );
|
||||
|
||||
// set correct channel index
|
||||
m_mixerChannels[i]->m_channelIndex = i;
|
||||
m_mixerChannels[i]->setIndex(i);
|
||||
|
||||
// now check all routes and update names of the send models
|
||||
for( MixerRoute * r : m_mixerChannels[i]->m_sends )
|
||||
@@ -433,8 +480,8 @@ void Mixer::moveChannelLeft( int index )
|
||||
qSwap(m_mixerChannels[index], m_mixerChannels[index - 1]);
|
||||
|
||||
// Update m_channelIndex of both channels
|
||||
m_mixerChannels[index]->m_channelIndex = index;
|
||||
m_mixerChannels[index - 1]->m_channelIndex = index -1;
|
||||
m_mixerChannels[index]->setIndex(index);
|
||||
m_mixerChannels[index - 1]->setIndex(index - 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -385,8 +385,8 @@ QMenu * InstrumentTrackView::createMixerMenu(QString title, QString newMixerLabe
|
||||
|
||||
if ( currentChannel != mixerChannel )
|
||||
{
|
||||
auto index = currentChannel->m_channelIndex;
|
||||
QString label = tr( "%1: %2" ).arg( currentChannel->m_channelIndex ).arg( currentChannel->m_name );
|
||||
auto index = currentChannel->index();
|
||||
QString label = tr( "%1: %2" ).arg(index).arg(currentChannel->m_name);
|
||||
mixerMenu->addAction(label, [this, index](){
|
||||
assignMixerLine(index);
|
||||
});
|
||||
|
||||
@@ -155,8 +155,8 @@ QMenu * SampleTrackView::createMixerMenu(QString title, QString newMixerLabel)
|
||||
|
||||
if (currentChannel != mixerChannel)
|
||||
{
|
||||
const auto index = currentChannel->m_channelIndex;
|
||||
QString label = tr("%1: %2").arg(currentChannel->m_channelIndex).arg(currentChannel->m_name);
|
||||
const auto index = currentChannel->index();
|
||||
QString label = tr("%1: %2").arg(index).arg(currentChannel->m_name);
|
||||
mixerMenu->addAction(label, [this, index](){
|
||||
assignMixerLine(index);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user