MCPcopy Create free account
hub / github.com/audacity/audacity / DoTrackMute

Method DoTrackMute

src/TrackUtilities.cpp:59–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59void TrackUtilities::DoTrackMute(
60 AudacityProject &project, Track &track, bool exclusive)
61{
62 auto &tracks = TrackList::Get(project);
63
64 // "exclusive" mute means mute the chosen track and unmute all others.
65 if (exclusive) {
66 for (auto playable : tracks.Any<PlayableTrack>()) {
67 bool chosen = (&track == playable);
68 playable->SetMute(chosen);
69 playable->SetSolo(false);
70 }
71 }
72 else {
73 // Normal click toggles this track.
74 auto pt = dynamic_cast<PlayableTrack *>(&track);
75 if (!pt)
76 return;
77
78 bool wasMute = pt->GetMute();
79 pt->SetMute(!wasMute);
80
81 if (auto value = TracksBehaviorsSolo.ReadEnum();
82 value == SoloBehaviorSimple)
83 {
84 // We also set a solo indicator if we have just one track / stereo pair playing.
85 // in a group of more than one playable tracks.
86 // otherwise clear solo on everything.
87
88 auto range = tracks.Any<PlayableTrack>();
89 auto nPlayableTracks = range.size();
90 auto nPlaying = (range - &PlayableTrack::GetMute).size();
91 for (auto track : range)
92 track->SetSolo((nPlaying == 1) &&
93 (nPlayableTracks > 1) && !track->GetMute());
94 }
95 }
96 ProjectHistory::Get( project ).ModifyState(true);
97
98 TrackFocus::Get( project ).UpdateAccessibility();
99}
100
101void TrackUtilities::DoTrackSolo(
102 AudacityProject &project, Track &track, bool exclusive)

Callers

nothing calls this directly

Calls 8

GetFunction · 0.85
SetMuteMethod · 0.80
SetSoloMethod · 0.80
ReadEnumMethod · 0.80
GetMuteMethod · 0.45
sizeMethod · 0.45
ModifyStateMethod · 0.45
UpdateAccessibilityMethod · 0.45

Tested by

no test coverage detected