diff --git a/src/Experimental.h b/src/Experimental.h index b960d607d..c761c158e 100644 --- a/src/Experimental.h +++ b/src/Experimental.h @@ -196,4 +196,8 @@ // Define for new noise reduction effect from Paul Licameli. #define EXPERIMENTAL_NOISE_REDUCTION + +// Define to enable Nyquist audio clip boundary control (Steve Daulton Dec 2014) +// #define EXPERIMENTAL_NYQUIST_SPLIT_CONTROL + #endif diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index ba0df2832..248c74e89 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -470,7 +470,15 @@ bool EffectNyquist::Process() this->CopyInputTracks(Track::All); SelectedTrackListOfKindIterator iter(Track::Wave, mOutputTracks); mCurTrack[0] = (WaveTrack *) iter.First(); +#if defined(EXPERIMENTAL_NYQUIST_SPLIT_CONTROL) + mT0 = mCurTrack[0]->LongSamplesToTime(mCurTrack[0]->TimeToLongSamples(mT0)); + mAlignedT1 = mCurTrack[0]->LongSamplesToTime(mCurTrack[0]->TimeToLongSamples(mT1)); mOutputTime = mT1 - mT0; + mRestoreClips = true; // Normally we want to preserve split lines, but not always. + mMergeClips = true; // Set to false to add split lines at selection ends. +#else + mOutputTime = mT1 - mT0; +#endif mCount = 0; mProgressIn = 0; mProgressOut = 0; @@ -1030,7 +1038,13 @@ bool EffectNyquist::ProcessOne() out = mOutputTrack[0]; } +#if defined(EXPERIMENTAL_NYQUIST_SPLIT_CONTROL) + mMergeClips = (mT0 + mOutputTime == mAlignedT1) ? true : false; + mCurTrack[i]->ClearAndPaste(mT0, mT1, out, mRestoreClips, mMergeClips); +#else mCurTrack[i]->ClearAndPaste(mT0, mT1, out, false, false); +#endif + // If we were first in the group adjust non-selected group tracks if (mFirstInGroup) { SyncLockedTracksIterator git(mOutputTracks); diff --git a/src/effects/nyquist/Nyquist.h b/src/effects/nyquist/Nyquist.h index e31d7f0bd..8c17d82b2 100644 --- a/src/effects/nyquist/Nyquist.h +++ b/src/effects/nyquist/Nyquist.h @@ -234,6 +234,11 @@ class AUDACITY_DLL_API EffectNyquist:public Effect wxArrayString mCategories; wxString mProps; +#if defined(EXPERIMENTAL_NYQUIST_SPLIT_CONTROL) + bool mRestoreClips; + bool mMergeClips; + double mAlignedT1; +#endif friend class NyquistDialog; };