mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-19 01:20:04 +02:00
Protect Nyquist against effect-within-effect
The Effect code makes temporary copies of wavetracks. If Nyquist invokes another effect, its temporary copy is no longer valid. My solution is to NOT apply the Nyquist effect results IF some other effect was successfully invoked in creating them. I do this by counting the effect invocations. If it has changed, then Nyquist output Is not applied back to the track. The net result is that Nyquist prompt can invoke other effects, or process the audio itself, but it cannot do both.
This commit is contained in:
parent
15aad64f7b
commit
b93a2e53cc
@ -71,6 +71,9 @@ greater use in future.
|
||||
#include <unordered_map>
|
||||
#endif
|
||||
|
||||
// Effect application counter
|
||||
int Effect::nEffectsDone=0;
|
||||
|
||||
static const int kDummyID = 20000;
|
||||
static const int kSaveAsID = 20001;
|
||||
static const int kImportID = 20002;
|
||||
@ -2267,6 +2270,7 @@ void Effect::ReplaceProcessedTracks(const bool bGoodResult)
|
||||
// The output list is no longer needed
|
||||
mOutputTracks.reset();
|
||||
mOutputTracksType = Track::None;
|
||||
nEffectsDone++;
|
||||
}
|
||||
|
||||
void Effect::CountWaveTracks()
|
||||
|
@ -340,7 +340,6 @@ protected:
|
||||
bool TrackGroupProgress(int whichGroup, double frac, const wxString & = wxEmptyString);
|
||||
|
||||
int GetNumWaveTracks() { return mNumTracks; }
|
||||
|
||||
int GetNumWaveGroups() { return mNumGroups; }
|
||||
|
||||
// Calculates the start time and selection length in samples
|
||||
@ -369,6 +368,9 @@ protected:
|
||||
void CopyInputTracks(); // trackType = Track::Wave
|
||||
void CopyInputTracks(int trackType);
|
||||
|
||||
// A global counter of all the successful Effect invocations.
|
||||
static int nEffectsDone;
|
||||
|
||||
// For the use of analyzers, which don't need to make output wave tracks,
|
||||
// but may need to add label tracks.
|
||||
class AddedAnalysisTrack {
|
||||
|
@ -488,6 +488,8 @@ bool NyquistEffect::CheckWhetherSkipEffect()
|
||||
bool NyquistEffect::Process()
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
int nEffectsSoFar = nEffectsDone;
|
||||
mProjectChanged = false;
|
||||
EffectManager & em = EffectManager::Get();
|
||||
em.SetSkipStateFlag(false);
|
||||
@ -790,7 +792,11 @@ _("Selection too long for Nyquist code.\nMaximum allowed selection is %ld sample
|
||||
dlog.ShowModal();
|
||||
}
|
||||
|
||||
ReplaceProcessedTracks(success);
|
||||
// Has rug been pulled from under us by some effect done within Nyquist??
|
||||
if( nEffectsSoFar == nEffectsDone )
|
||||
ReplaceProcessedTracks(success);
|
||||
else
|
||||
ReplaceProcessedTracks(false); // Do not use the results.
|
||||
|
||||
if (!mProjectChanged)
|
||||
em.SetSkipStateFlag(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user