mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 08:29:27 +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:
parent
0a6685376e
commit
2abb46b83d
@ -1409,7 +1409,8 @@ void Effect::Preview(bool dryOnly)
|
|||||||
if (t1 > mT1)
|
if (t1 > mT1)
|
||||||
t1 = mT1;
|
t1 = mT1;
|
||||||
|
|
||||||
if (t1 <= t0)
|
// Generators can run without a selection.
|
||||||
|
if (!GeneratorPreview() && (t1 <= t0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool success = ::MixAndRender(mTracks, mFactory, rate, floatSample, t0, t1,
|
bool success = ::MixAndRender(mTracks, mFactory, rate, floatSample, t0, t1,
|
||||||
|
@ -181,6 +181,12 @@ class AUDACITY_DLL_API Effect : public EffectHostInterface
|
|||||||
return (mFlags & BUILTIN_EFFECT) != 0;
|
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.
|
// Called to set or retrieve parameter values. Return true if successful.
|
||||||
virtual bool TransferParameters( Shuttle & WXUNUSED(shuttle) ) {
|
virtual bool TransferParameters( Shuttle & WXUNUSED(shuttle) ) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -508,6 +508,12 @@ bool EffectNyquist::TransferParameters( Shuttle & shuttle )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EffectNyquist::GeneratorPreview()
|
||||||
|
{
|
||||||
|
// Enable Nyquist generator plug-ins to create preview without a selection
|
||||||
|
return (mEnablePreview && (GetEffectFlags() & INSERT_EFFECT));
|
||||||
|
}
|
||||||
|
|
||||||
bool EffectNyquist::PromptUser()
|
bool EffectNyquist::PromptUser()
|
||||||
{
|
{
|
||||||
while (mInteractive) {
|
while (mInteractive) {
|
||||||
|
@ -112,7 +112,8 @@ class AUDACITY_DLL_API EffectNyquist:public Effect
|
|||||||
return mAction;
|
return mAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool PromptUser();
|
virtual bool GeneratorPreview();
|
||||||
|
virtual bool PromptUser();
|
||||||
|
|
||||||
virtual bool Process();
|
virtual bool Process();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user