mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-13 14:13:32 +02:00
Bug2109 residual: apply fix also in case of import of MIDI...
... Muting the new track, in case any solo track already existed.
This commit is contained in:
@@ -975,7 +975,6 @@ ProjectFileManager::AddImportedTracks(const FilePath &fileName,
|
|||||||
auto &history = ProjectHistory::Get( project );
|
auto &history = ProjectHistory::Get( project );
|
||||||
auto &projectFileIO = ProjectFileIO::Get( project );
|
auto &projectFileIO = ProjectFileIO::Get( project );
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
const auto& playableTracks = tracks.Any<PlayableTrack>();
|
|
||||||
|
|
||||||
std::vector< std::shared_ptr< Track > > results;
|
std::vector< std::shared_ptr< Track > > results;
|
||||||
|
|
||||||
@@ -988,16 +987,11 @@ ProjectFileManager::AddImportedTracks(const FilePath &fileName,
|
|||||||
wxString trackNameBase = fn.GetName();
|
wxString trackNameBase = fn.GetName();
|
||||||
int i = -1;
|
int i = -1;
|
||||||
|
|
||||||
// Next for- and if-statements fix the bug 2109.
|
// Fix the bug 2109.
|
||||||
// In case the project had soloed tracks before importing,
|
// In case the project had soloed tracks before importing,
|
||||||
// all newly imported tracks are muted.
|
// all newly imported tracks are muted.
|
||||||
bool projectHasSolo{ false };
|
const bool projectHasSolo =
|
||||||
for (const auto& track : playableTracks)
|
!(tracks.Any<PlayableTrack>() + &PlayableTrack::GetSolo).empty();
|
||||||
{
|
|
||||||
if (track->GetSolo())
|
|
||||||
projectHasSolo = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (projectHasSolo)
|
if (projectHasSolo)
|
||||||
{
|
{
|
||||||
for (auto& track : newTracks)
|
for (auto& track : newTracks)
|
||||||
|
@@ -44,6 +44,14 @@ bool DoImportMIDI( AudacityProject &project, const FilePath &fileName )
|
|||||||
auto pTrack = tracks.Add( newTrack );
|
auto pTrack = tracks.Add( newTrack );
|
||||||
pTrack->SetSelected(true);
|
pTrack->SetSelected(true);
|
||||||
|
|
||||||
|
// Fix the bug 2109.
|
||||||
|
// In case the project had soloed tracks before importing,
|
||||||
|
// the newly imported track is muted.
|
||||||
|
const bool projectHasSolo =
|
||||||
|
!(tracks.Any<PlayableTrack>() + &PlayableTrack::GetSolo).empty();
|
||||||
|
if (projectHasSolo)
|
||||||
|
pTrack->SetMute(true);
|
||||||
|
|
||||||
ProjectHistory::Get( project )
|
ProjectHistory::Get( project )
|
||||||
.PushState(
|
.PushState(
|
||||||
XO("Imported MIDI from '%s'").Format( fileName ),
|
XO("Imported MIDI from '%s'").Format( fileName ),
|
||||||
|
Reference in New Issue
Block a user