Bug 231 - Cut Preview should play all selected/sync-locked tracks, respecting Mute/Solo during preview

This commit is contained in:
James Crook 2018-09-10 16:57:36 +01:00
parent 8e089f4141
commit 1deff18c15
1 changed files with 18 additions and 22 deletions

View File

@ -1399,6 +1399,7 @@ void ControlToolBar::SetupCutPreviewTracks(double WXUNUSED(playStart), double cu
ClearCutPreviewTracks();
AudacityProject *p = GetActiveProject();
if (p) {
mCutPreviewTracks = TrackList::Create();
// Find first selected track (stereo or mono) and duplicate it
const Track *track1 = NULL, *track2 = NULL;
TrackListIterator it(p->GetTracks());
@ -1413,30 +1414,25 @@ void ControlToolBar::SetupCutPreviewTracks(double WXUNUSED(playStart), double cu
{
track1 = t;
track2 = t->GetLink();
break;
// Duplicate and change tracks
// Clear has a very small chance of throwing
auto new1 = track1->Duplicate();
new1->Clear(cutStart, cutEnd);
decltype(new1) new2{};
if (track2)
{
new2 = track2->Duplicate();
new2->Clear(cutStart, cutEnd);
}
// use NOTHROW-GUARANTEE:
mCutPreviewTracks->Add(std::move(new1));
if (track2)
mCutPreviewTracks->Add(std::move(new2));
}
}
if (track1)
{
// Duplicate and change tracks
// Clear has a very small chance of throwing
auto new1 = track1->Duplicate();
new1->Clear(cutStart, cutEnd);
decltype(new1) new2{};
if (track2)
{
new2 = track2->Duplicate();
new2->Clear(cutStart, cutEnd);
}
// use NOTHROW-GUARANTEE:
mCutPreviewTracks = TrackList::Create();
mCutPreviewTracks->Add(std::move(new1));
if (track2)
mCutPreviewTracks->Add(std::move(new2));
}
if( !track1 )
ClearCutPreviewTracks();
}
}