mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-31 07:59:27 +02:00
Add all user parameters to Compressor2 effect.
Don't do anything with them yet. Signed-off-by: Max Maisel <max.maisel@posteo.de>
This commit is contained in:
parent
e5a6585a12
commit
6395c8470b
@ -33,6 +33,49 @@
|
||||
|
||||
#include "LoadEffects.h"
|
||||
|
||||
enum kAlgorithms
|
||||
{
|
||||
kExpFit,
|
||||
kEnvPT1,
|
||||
nAlgos
|
||||
};
|
||||
|
||||
static const ComponentInterfaceSymbol kAlgorithmStrings[nAlgos] =
|
||||
{
|
||||
{ XO("Exponential-Fit") },
|
||||
{ XO("Analog Model (PT1)") }
|
||||
};
|
||||
|
||||
enum kCompressBy
|
||||
{
|
||||
kAmplitude,
|
||||
kRMS,
|
||||
nBy
|
||||
};
|
||||
|
||||
static const ComponentInterfaceSymbol kCompressByStrings[nBy] =
|
||||
{
|
||||
{ XO("peak amplitude") },
|
||||
{ XO("RMS") }
|
||||
};
|
||||
|
||||
// Define keys, defaults, minimums, and maximums for the effect parameters
|
||||
//
|
||||
// Name Type Key Def Min Max Scale
|
||||
Param( Algorithm, int, wxT("Algorithm"), kEnvPT1, 0, nAlgos-1, 1 );
|
||||
Param( CompressBy, int, wxT("CompressBy"), kAmplitude, 0, nBy-1, 1 );
|
||||
Param( StereoInd, bool, wxT("StereoIndependent"), false, false, true, 1 );
|
||||
|
||||
Param( Threshold, double, wxT("Threshold"), -12.0, -60.0, -1.0, 1.0 );
|
||||
Param( Ratio, double, wxT("Ratio"), 2.0, 1.1, 100.0, 10.0 );
|
||||
Param( KneeWidth, double, wxT("KneeWidth"), 10.0, 0.0, 20.0, 10.0 );
|
||||
Param( AttackTime, double, wxT("AttackTime"), 0.2, 0.00001, 30.0, 20000.0 );
|
||||
Param( ReleaseTime, double, wxT("ReleaseTime"), 1.0, 0.00001, 30.0, 20000.0 );
|
||||
Param( LookaheadTime, double, wxT("LookaheadTime"), 0.0, 0.0, 10.0, 200.0 );
|
||||
Param( LookbehindTime, double, wxT("LookbehindTime"), 0.1, 0.0, 10.0, 200.0 );
|
||||
Param( MakeupGain, double, wxT("MakeupGain"), 0.0, 0.0, 100.0, 1.0 );
|
||||
Param( DryWet, double, wxT("DryWet"), 100.0, 0.0, 100.0, 1.0 );
|
||||
|
||||
BEGIN_EVENT_TABLE(EffectCompressor2, wxEvtHandler)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
@ -43,6 +86,20 @@ namespace{ BuiltinEffectsModule::Registration< EffectCompressor2 > reg; }
|
||||
|
||||
EffectCompressor2::EffectCompressor2()
|
||||
{
|
||||
mAlgorithm = DEF_Algorithm;
|
||||
mCompressBy = DEF_CompressBy;
|
||||
mStereoInd = DEF_StereoInd;
|
||||
|
||||
mThresholdDB = DEF_Threshold;
|
||||
mRatio = DEF_Ratio; // positive number > 1.0
|
||||
mKneeWidthDB = DEF_KneeWidth;
|
||||
mAttackTime = DEF_AttackTime; // seconds
|
||||
mReleaseTime = DEF_ReleaseTime; // seconds
|
||||
mLookaheadTime = DEF_LookaheadTime;
|
||||
mLookbehindTime = DEF_LookbehindTime;
|
||||
mMakeupGainPct = DEF_MakeupGain;
|
||||
mDryWetPct = DEF_DryWet;
|
||||
|
||||
SetLinearEffectFlag(false);
|
||||
}
|
||||
|
||||
@ -77,16 +134,71 @@ EffectType EffectCompressor2::GetType()
|
||||
// EffectClientInterface implementation
|
||||
bool EffectCompressor2::DefineParams( ShuttleParams & S )
|
||||
{
|
||||
S.SHUTTLE_PARAM(mAlgorithm, Algorithm);
|
||||
S.SHUTTLE_PARAM(mCompressBy, CompressBy);
|
||||
S.SHUTTLE_PARAM(mStereoInd, StereoInd);
|
||||
|
||||
S.SHUTTLE_PARAM(mThresholdDB, Threshold);
|
||||
S.SHUTTLE_PARAM(mRatio, Ratio);
|
||||
S.SHUTTLE_PARAM(mKneeWidthDB, KneeWidth);
|
||||
S.SHUTTLE_PARAM(mAttackTime, AttackTime);
|
||||
S.SHUTTLE_PARAM(mReleaseTime, ReleaseTime);
|
||||
S.SHUTTLE_PARAM(mLookaheadTime, LookaheadTime);
|
||||
S.SHUTTLE_PARAM(mLookbehindTime, LookbehindTime);
|
||||
S.SHUTTLE_PARAM(mMakeupGainPct, MakeupGain);
|
||||
S.SHUTTLE_PARAM(mDryWetPct, DryWet);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EffectCompressor2::GetAutomationParameters(CommandParameters & parms)
|
||||
{
|
||||
parms.Write(KEY_Algorithm, mAlgorithm);
|
||||
parms.Write(KEY_CompressBy, mCompressBy);
|
||||
parms.Write(KEY_StereoInd, mStereoInd);
|
||||
|
||||
parms.Write(KEY_Threshold, mThresholdDB);
|
||||
parms.Write(KEY_Ratio, mRatio);
|
||||
parms.Write(KEY_KneeWidth, mKneeWidthDB);
|
||||
parms.Write(KEY_AttackTime, mAttackTime);
|
||||
parms.Write(KEY_ReleaseTime, mReleaseTime);
|
||||
parms.Write(KEY_LookaheadTime, mLookaheadTime);
|
||||
parms.Write(KEY_LookbehindTime, mLookbehindTime);
|
||||
parms.Write(KEY_MakeupGain, mMakeupGainPct);
|
||||
parms.Write(KEY_DryWet, mDryWetPct);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EffectCompressor2::SetAutomationParameters(CommandParameters & parms)
|
||||
{
|
||||
ReadAndVerifyInt(Algorithm);
|
||||
ReadAndVerifyInt(CompressBy);
|
||||
ReadAndVerifyBool(StereoInd);
|
||||
|
||||
ReadAndVerifyDouble(Threshold);
|
||||
ReadAndVerifyDouble(Ratio);
|
||||
ReadAndVerifyDouble(KneeWidth);
|
||||
ReadAndVerifyDouble(AttackTime);
|
||||
ReadAndVerifyDouble(ReleaseTime);
|
||||
ReadAndVerifyDouble(LookaheadTime);
|
||||
ReadAndVerifyDouble(LookbehindTime);
|
||||
ReadAndVerifyDouble(MakeupGain);
|
||||
ReadAndVerifyDouble(DryWet);
|
||||
|
||||
mAlgorithm = Algorithm;
|
||||
mCompressBy = CompressBy;
|
||||
mStereoInd = StereoInd;
|
||||
|
||||
mThresholdDB = Threshold;
|
||||
mRatio = Ratio;
|
||||
mKneeWidthDB = KneeWidth;
|
||||
mAttackTime = AttackTime;
|
||||
mReleaseTime = ReleaseTime;
|
||||
mLookaheadTime = LookaheadTime;
|
||||
mLookbehindTime = LookbehindTime;
|
||||
mMakeupGainPct = MakeupGain;
|
||||
mDryWetPct = DryWet;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -103,6 +215,20 @@ bool EffectCompressor2::Startup()
|
||||
// Load the old "current" settings
|
||||
if (gPrefs->Exists(base))
|
||||
{
|
||||
mAlgorithm = DEF_Algorithm;
|
||||
mCompressBy = DEF_CompressBy;
|
||||
mStereoInd = DEF_StereoInd;
|
||||
|
||||
mThresholdDB = DEF_Threshold;
|
||||
mRatio = DEF_Ratio; // positive number > 1.0
|
||||
mKneeWidthDB = DEF_KneeWidth;
|
||||
mAttackTime = DEF_AttackTime; // seconds
|
||||
mReleaseTime = DEF_ReleaseTime; // seconds
|
||||
mLookaheadTime = DEF_LookaheadTime;
|
||||
mLookbehindTime = DEF_LookbehindTime;
|
||||
mMakeupGainPct = DEF_MakeupGain;
|
||||
mDryWetPct = DEF_DryWet;
|
||||
|
||||
SaveUserPreset(GetCurrentSettingsGroup());
|
||||
|
||||
gPrefs->Flush();
|
||||
|
@ -63,6 +63,19 @@ private:
|
||||
void UpdateUI();
|
||||
|
||||
private:
|
||||
int mAlgorithm;
|
||||
int mCompressBy;
|
||||
bool mStereoInd;
|
||||
|
||||
double mThresholdDB;
|
||||
double mRatio;
|
||||
double mKneeWidthDB;
|
||||
double mAttackTime;
|
||||
double mReleaseTime;
|
||||
double mLookaheadTime;
|
||||
double mLookbehindTime;
|
||||
double mMakeupGainPct;
|
||||
double mDryWetPct;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user