From 6e4f16331780317fea64e9dbfa06539891ed844f Mon Sep 17 00:00:00 2001 From: binarywisdom <8314460+binarywisdom@users.noreply.github.com> Date: Wed, 9 Sep 2020 12:43:41 -0400 Subject: [PATCH] fixed bug 2109 (#664) --- src/ProjectFileManager.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/ProjectFileManager.cpp b/src/ProjectFileManager.cpp index 77837214e..4ee730457 100644 --- a/src/ProjectFileManager.cpp +++ b/src/ProjectFileManager.cpp @@ -958,6 +958,7 @@ ProjectFileManager::AddImportedTracks(const FilePath &fileName, auto &history = ProjectHistory::Get( project ); auto &projectFileIO = ProjectFileIO::Get( project ); auto &tracks = TrackList::Get( project ); + const auto& playableTracks = tracks.Any(); std::vector< std::shared_ptr< Track > > results; @@ -969,6 +970,23 @@ ProjectFileManager::AddImportedTracks(const FilePath &fileName, double newRate = 0; wxString trackNameBase = fn.GetName(); int i = -1; + + // Next for- and if-statements fix the bug 2109. + // In case the project had soloed tracks before importing, + // all newly imported tracks are muted. + bool projectHasSolo{ false }; + for (const auto& track : playableTracks) + { + if (track->GetSolo()) + projectHasSolo = true; + } + + if (projectHasSolo) + { + for (auto& track : newTracks) + for (auto& channel : track) + channel->SetMute(true); + } // Must add all tracks first (before using Track::IsLeader) for (auto &group : newTracks) {