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

Allow generator effects to use preview without requiring a selection to be made.

Documentation: This does not affect any currently shipped effects. This will need documenting on the wiki for writing Nyquist plug-ins.
This commit is contained in:
stevethefiddle@gmail.com 2014-10-26 20:30:22 +00:00
parent 0a6685376e
commit 2abb46b83d
4 changed files with 16 additions and 2 deletions

View File

@ -1409,7 +1409,8 @@ void Effect::Preview(bool dryOnly)
if (t1 > mT1)
t1 = mT1;
if (t1 <= t0)
// Generators can run without a selection.
if (!GeneratorPreview() && (t1 <= t0))
return;
bool success = ::MixAndRender(mTracks, mFactory, rate, floatSample, t0, t1,

View File

@ -181,6 +181,12 @@ class AUDACITY_DLL_API Effect : public EffectHostInterface
return (mFlags & BUILTIN_EFFECT) != 0;
}
// Preview normally requires a selection, but INSERT_EFFECTs do not.
// Return true to override the need for a selection.
virtual bool GeneratorPreview(){
return false;
}
// Called to set or retrieve parameter values. Return true if successful.
virtual bool TransferParameters( Shuttle & WXUNUSED(shuttle) ) {
return true;

View File

@ -508,6 +508,12 @@ bool EffectNyquist::TransferParameters( Shuttle & shuttle )
return true;
}
bool EffectNyquist::GeneratorPreview()
{
// Enable Nyquist generator plug-ins to create preview without a selection
return (mEnablePreview && (GetEffectFlags() & INSERT_EFFECT));
}
bool EffectNyquist::PromptUser()
{
while (mInteractive) {

View File

@ -112,7 +112,8 @@ class AUDACITY_DLL_API EffectNyquist:public Effect
return mAction;
}
virtual bool PromptUser();
virtual bool GeneratorPreview();
virtual bool PromptUser();
virtual bool Process();