1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-23 15:50:05 +02:00

Make Nyquist effects define their parameters.

This commit is contained in:
James Crook 2018-02-24 10:24:10 +00:00 committed by Paul Licameli
parent 12a2fbf489
commit 33daaafc59
2 changed files with 67 additions and 1 deletions

View File

@ -278,6 +278,70 @@ bool NyquistEffect::IsDefault()
}
// EffectClientInterface implementation
bool NyquistEffect::DefineParams( ShuttleParams & S )
{
// For now we assume Nyquist can do get and set better than DefineParams can,
// And so we ONLY use it for geting the signature.
auto pGa = dynamic_cast<ShuttleGetAutomation*>(&S);
if( pGa ){
GetAutomationParameters( *(pGa->mpEap) );
return true;
}
auto pSa = dynamic_cast<ShuttleSetAutomation*>(&S);
if( pSa ){
SetAutomationParameters( *(pSa->mpEap) );
return true;
}
auto pSd = dynamic_cast<ShuttleGetDefinition*>(&S);
if( pSd == nullptr )
return true;
//wxASSERT( pSd );
if (mExternal)
return true;
if (mIsPrompt)
{
S.Define( mInputCmd, KEY_Command, "" );
S.Define( mVersion, KEY_Version, 3 );
return true;
}
for (size_t c = 0, cnt = mControls.size(); c < cnt; c++)
{
NyqControl & ctrl = mControls[c];
double d = ctrl.val;
if (d == UNINITIALIZED_CONTROL && ctrl.type != NYQ_CTRL_STRING)
{
d = GetCtrlValue(ctrl.valStr);
}
if (ctrl.type == NYQ_CTRL_REAL || ctrl.type == NYQ_CTRL_FLOAT_TEXT)
{
S.Define( d, static_cast<const wxChar*>( ctrl.var.c_str() ), (double)0.0, ctrl.low, ctrl.high, 1.0);
}
else if (ctrl.type == NYQ_CTRL_INT || ctrl.type == NYQ_CTRL_INT_TEXT)
{
int x=d;
S.Define( x, static_cast<const wxChar*>( ctrl.var.c_str() ), 0, ctrl.low, ctrl.high, 1);
//parms.Write(ctrl.var, (int) d);
}
else if (ctrl.type == NYQ_CTRL_CHOICE)
{
wxArrayString choices = ParseChoice(ctrl);
int x=d;
//parms.WriteEnum(ctrl.var, (int) d, choices);
S.DefineEnum( x, static_cast<const wxChar*>( ctrl.var.c_str() ), 0, choices );
}
else if (ctrl.type == NYQ_CTRL_STRING)
{
S.Define( ctrl.valStr, ctrl.var, "" , ctrl.lowStr, ctrl.highStr );
//parms.Write(ctrl.var, ctrl.valStr);
}
}
return true;
}
bool NyquistEffect::GetAutomationParameters(CommandParameters & parms)
{
@ -493,6 +557,7 @@ bool NyquistEffect::CheckWhetherSkipEffect()
bool NyquistEffect::Process()
{
bool success = true;
mProjectChanged = false;
EffectManager & em = EffectManager::Get();
em.SetSkipStateFlag(false);
@ -781,7 +846,7 @@ _("Selection too long for Nyquist code.\nMaximum allowed selection is %ld sample
mT1 = mT0 + mOutputTime;
}
finish:
finish:
// Show debug window if trace set in plug-in header and something to show.
mDebug = (mTrace && !mDebugOutput.IsEmpty())? true : mDebug;

View File

@ -97,6 +97,7 @@ public:
// EffectClientInterface implementation
bool DefineParams( ShuttleParams & S ) override;
bool GetAutomationParameters(CommandParameters & parms) override;
bool SetAutomationParameters(CommandParameters & parms) override;