| 57 | } |
| 58 | |
| 59 | void 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 | |
| 101 | void TrackUtilities::DoTrackSolo( |
| 102 | AudacityProject &project, Track &track, bool exclusive) |
nothing calls this directly
no test coverage detected