1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-19 09:30:06 +02:00

Nyquist can now make a selection and not have it overwritten by Effect.

This commit is contained in:
James Crook 2018-02-14 18:28:36 +00:00 committed by Paul Licameli
parent 3d0d28eb03
commit 57c50ff9ac
4 changed files with 15 additions and 2 deletions

View File

@ -61,6 +61,10 @@ bool SelectTimeCommand::Apply(const CommandContext & context){
if( !bHasT0 && !bHasT1 )
return true;
// Count selection as a do-nothing effect.
// Used to invalidate cached selection and tracks.
Effect::IncEffectCounter();
if( mFromEnd ){
double TEnd = context.GetProject()->GetTracks()->GetEndTime();
context.GetProject()->mViewInfo.selectedRegion.setTimes(TEnd - mT0, TEnd - mT1);
@ -110,6 +114,11 @@ bool SelectTracksCommand::Apply(const CommandContext &context)
{
if( !bHasFirstTrack && !bHasLastTrack )
return true;
// Count selection as a do-nothing effect.
// Used to invalidate cached selection and tracks.
Effect::IncEffectCounter();
int index = 0;
TrackList *tracks = context.GetProject()->GetTracks();
int last = wxMax( mFirstTrack, mLastTrack );

View File

@ -1266,7 +1266,7 @@ bool Effect::DoEffect(wxWindow *parent,
returnVal = Process();
}
if (returnVal)
if (returnVal && (mT1 >= mT0 ))
{
selectedRegion->setTimes(mT0, mT1);
}

View File

@ -269,6 +269,8 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
long style = DefaultMessageBoxStyle,
const wxString& titleStr = wxString{});
static void IncEffectCounter(){ nEffectsDone++;};
//
// protected virtual methods
//

View File

@ -859,8 +859,10 @@ _("Selection too long for Nyquist code.\nMaximum allowed selection is %ld sample
// Has rug been pulled from under us by some effect done within Nyquist??
if( nEffectsSoFar == nEffectsDone )
ReplaceProcessedTracks(success);
else
else{
ReplaceProcessedTracks(false); // Do not use the results.
mT1 = mT0 - 1.0;// And don't use the times either, in resetting the selection (make them bogus).
}
if (!mProjectChanged)
em.SetSkipStateFlag(true);