1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-03 22:19:07 +02:00

Small optimization - non-linear preview copies only selected tracks by default.

This commit is contained in:
Steve Daulton 2015-05-15 16:57:29 +01:00
parent d9f3c432d4
commit fbaab8702e
2 changed files with 18 additions and 6 deletions

@ -92,6 +92,7 @@ Effect::Effect()
mT1 = 0.0; mT1 = 0.0;
mDuration = 0.0; mDuration = 0.0;
mIsLinearEffect = false; mIsLinearEffect = false;
mPreviewWithNotSelected = false;
mNumTracks = 0; mNumTracks = 0;
mNumGroups = 0; mNumGroups = 0;
mProgress = NULL; mProgress = NULL;
@ -1938,6 +1939,11 @@ void Effect::SetLinearEffectFlag(bool linearEffectFlag)
mIsLinearEffect = linearEffectFlag; mIsLinearEffect = linearEffectFlag;
} }
void Effect::IncludeNotSelectedPreviewTracks(bool includeNotSelected)
{
mPreviewWithNotSelected = includeNotSelected;
}
bool Effect::TotalProgress(double frac) bool Effect::TotalProgress(double frac)
{ {
int updateResult = (mProgress ? int updateResult = (mProgress ?
@ -2432,17 +2438,17 @@ void Effect::Preview(bool dryOnly)
t1 = mixLeft->GetEndTime(); t1 = mixLeft->GetEndTime();
} }
else { else {
// Copy all tracks as 'some' effects (AutoDuck) may require non-selected tracks.
TrackListOfKindIterator iter(Track::Wave, saveTracks); TrackListOfKindIterator iter(Track::Wave, saveTracks);
WaveTrack *src = (WaveTrack *) iter.First(); WaveTrack *src = (WaveTrack *) iter.First();
while (src) while (src)
{ {
WaveTrack *dest; WaveTrack *dest;
src->Copy(t0, t1, (Track **) &dest); if (src->GetSelected() || mPreviewWithNotSelected) {
dest->SetSelected(src->GetSelected()); src->Copy(t0, t1, (Track **) &dest);
dest->SetDisplay(WaveTrack::NoDisplay); dest->SetSelected(src->GetSelected());
mTracks->Add(dest); dest->SetDisplay(WaveTrack::NoDisplay);
mTracks->Add(dest);
}
src = (WaveTrack *) iter.Next(); src = (WaveTrack *) iter.Next();
} }
} }

@ -321,6 +321,11 @@ protected:
// To allow pre-mixing before Preview, set linearEffectFlag to true. // To allow pre-mixing before Preview, set linearEffectFlag to true.
void SetLinearEffectFlag(bool linearEffectFlag); void SetLinearEffectFlag(bool linearEffectFlag);
// Most effects only require selected tracks to be copied for Preview.
// If IncludeNotSelectedPreviewTracks(true), then non-linear effects have
// preview copies of all wave tracks.
void IncludeNotSelectedPreviewTracks(bool includeNotSelected);
// Use these two methods to copy the input tracks to mOutputTracks, if // Use these two methods to copy the input tracks to mOutputTracks, if
// doing the processing on them, and replacing the originals only on success (and not cancel). // doing the processing on them, and replacing the originals only on success (and not cancel).
void CopyInputTracks(int trackType = Track::Wave); void CopyInputTracks(int trackType = Track::Wave);
@ -394,6 +399,7 @@ private:
bool mIsBatch; bool mIsBatch;
bool mIsLinearEffect; bool mIsLinearEffect;
bool mPreviewWithNotSelected;
double mDuration; double mDuration;
// mSetDuration should ONLY be set when SetDuration() is called. // mSetDuration should ONLY be set when SetDuration() is called.