1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-16 16:47:41 +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 ) if( !bHasT0 && !bHasT1 )
return true; return true;
// Count selection as a do-nothing effect.
// Used to invalidate cached selection and tracks.
Effect::IncEffectCounter();
if( mFromEnd ){ if( mFromEnd ){
double TEnd = context.GetProject()->GetTracks()->GetEndTime(); double TEnd = context.GetProject()->GetTracks()->GetEndTime();
context.GetProject()->mViewInfo.selectedRegion.setTimes(TEnd - mT0, TEnd - mT1); context.GetProject()->mViewInfo.selectedRegion.setTimes(TEnd - mT0, TEnd - mT1);
@ -110,6 +114,11 @@ bool SelectTracksCommand::Apply(const CommandContext &context)
{ {
if( !bHasFirstTrack && !bHasLastTrack ) if( !bHasFirstTrack && !bHasLastTrack )
return true; return true;
// Count selection as a do-nothing effect.
// Used to invalidate cached selection and tracks.
Effect::IncEffectCounter();
int index = 0; int index = 0;
TrackList *tracks = context.GetProject()->GetTracks(); TrackList *tracks = context.GetProject()->GetTracks();
int last = wxMax( mFirstTrack, mLastTrack ); int last = wxMax( mFirstTrack, mLastTrack );

View File

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

View File

@ -269,6 +269,8 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
long style = DefaultMessageBoxStyle, long style = DefaultMessageBoxStyle,
const wxString& titleStr = wxString{}); const wxString& titleStr = wxString{});
static void IncEffectCounter(){ nEffectsDone++;};
// //
// protected virtual methods // 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?? // Has rug been pulled from under us by some effect done within Nyquist??
if( nEffectsSoFar == nEffectsDone ) if( nEffectsSoFar == nEffectsDone )
ReplaceProcessedTracks(success); ReplaceProcessedTracks(success);
else else{
ReplaceProcessedTracks(false); // Do not use the results. 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) if (!mProjectChanged)
em.SetSkipStateFlag(true); em.SetSkipStateFlag(true);