fixed bug 2109 (#664)

This commit is contained in:
binarywisdom 2020-09-09 12:43:41 -04:00 committed by GitHub
parent 7e573b9b2f
commit 6e4f163317
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -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<PlayableTrack>();
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) {