Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix automation track unmute bugs #6550

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions src/core/Track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,37 +582,39 @@ void Track::toggleSolo()
{
const TrackContainer::TrackList & tl = m_trackContainer->tracks();

bool soloBefore = false;
bool otherTrackAlreadySolo = false;
for (const auto& track : tl)
{
if (track != this)
{
if (track->m_soloModel.value())
{
soloBefore = true;
otherTrackAlreadySolo = true;
break;
}
}
}

const bool solo = m_soloModel.value();
const bool soloEnabled = m_soloModel.value();
// Should we use the new behavior of solo or the older/legacy one?
// Legacy: soloing a track mutes all other tracks including automation tracks
// New: soloing a track leaves other automation tracks in pre-solo state
const bool soloLegacyBehavior = ConfigManager::inst()->value("app", "sololegacybehavior", "0").toInt();

for (const auto& track : tl)
{
if (solo)
if (soloEnabled)
{
// save mute-state in case no track was solo before
if (!soloBefore)
// Save mute-states in case no track was solo before
if (!otherTrackAlreadySolo)
{
track->m_mutedBeforeSolo = track->isMuted();
}
// Don't mute AutomationTracks (keep their original state) unless we are on the sololegacybehavior mode
if (track == this)
{
track->setMuted(false);
}
// Don't mute AutomationTracks (keep their original state) unless we are on the soloLegacyBehavior mode
else if (soloLegacyBehavior || track->type() != AutomationTrack)
{
track->setMuted(true);
Expand All @@ -622,14 +624,10 @@ void Track::toggleSolo()
track->m_soloModel.setValue(false);
}
}
else if (!soloBefore)
// Revert all tracks to pre-solo values
else if (!otherTrackAlreadySolo)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking out loud:

soloEnabled is true if this track is solo . otherTrackAlreadySolo is true if any track is solo. At first glance it seems like this function is only called when the solo LED is clicked. So you may think that if you uncheck the solo LED of a track, then otherTrackAlreadySolo must be false. But this function also calls itself through this line:

track->m_soloModel.setValue(false);

And in that case a solo LED is unchecked while another solo LED is active. A bit confusing and ineffective but probably the simplest solution.

TL;DR there is nothing wrong here.

{
// Unless we are on the sololegacybehavior mode, only restores the
// mute state if the track isn't an Automation Track
if (soloLegacyBehavior || track->type() != AutomationTrack)
{
track->setMuted(track->m_mutedBeforeSolo);
}
track->setMuted(track->m_mutedBeforeSolo);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More thinking out loud:

If soloLegacyBehavior is false, then the automation track is not muted, and "restoring" it will just unmute it (no change). So the if statement is not needed. This is correct.

(And for 1.2 projects m_mutedBeforeSolo defaults to false)

}
}
}
Expand Down