1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-28 15:38:48 +01:00

A means to specify legacy values of effect choice controls...

... For Truncate Silence only now, perhaps it will find more future use
This commit is contained in:
Paul Licameli
2018-03-26 10:44:34 -04:00
parent cb8e35574d
commit 170f92c181
3 changed files with 50 additions and 12 deletions

View File

@@ -792,6 +792,12 @@ inline long TrapLong(long x, long min, long max)
if (!parms.ReadAndVerify(KEY_ ## name, &name, DEF_ ## name, list)) \
return false;
#define ReadAndVerifyEnumWithObsoletes(name, list, obsoleteList, nObsolete) \
int name; \
if (!parms.ReadAndVerify(KEY_ ## name, &name, DEF_ ## name, \
list, obsoleteList, nObsolete)) \
return false;
#define ReadAndVerifyInt(name) ReadParam(int, name)
#define ReadAndVerifyDouble(name) ReadParam(double, name)
#define ReadAndVerifyFloat(name) ReadParam(float, name)

View File

@@ -50,6 +50,14 @@ static const wxChar *kActionStrings[nActions] =
XO("Compress Excess Silence")
};
static CommandParameters::ObsoleteMap kObsoleteActions[] = {
// Compatible with 2.1.0 and before
{ wxT("0"), 0 }, // Remap to Truncate Detected Silence
{ wxT("1"), 1 }, // Remap to Compress Excess Silence
};
static const size_t nObsoleteActions = WXSIZEOF( kObsoleteActions );
// Define defaults, minimums, and maximums for each parameter
#define DefaultAndLimits(name, def, min, max) \
static const double DEF_ ## name = (def); \
@@ -136,8 +144,6 @@ EffectType EffectTruncSilence::GetType()
bool EffectTruncSilence::DefineParams( ShuttleParams & S ){
wxArrayString actions(nActions, kActionStrings);
//actions.Insert(wxT("0"), 0); // Compatible with 2.1.0 and before
//actions.Insert(wxT("1"), 1); // Compatible with 2.1.0 and before
S.SHUTTLE_ENUM_PARAM( mTruncDbChoiceIndex, DbIndex, mDbChoices );
S.SHUTTLE_ENUM_PARAM( mActionIndex, ActIndex, actions );
@@ -163,14 +169,13 @@ bool EffectTruncSilence::GetAutomationParameters(CommandParameters & parms)
bool EffectTruncSilence::SetAutomationParameters(CommandParameters & parms)
{
wxArrayString actions(nActions, kActionStrings);
actions.Insert(wxT("0"), 0); // Compatible with 2.1.0 and before
actions.Insert(wxT("1"), 1); // Compatible with 2.1.0 and before
ReadAndVerifyDouble(Minimum);
ReadAndVerifyDouble(Truncate);
ReadAndVerifyDouble(Compress);
ReadAndVerifyEnum(DbIndex, mDbChoices);
ReadAndVerifyEnum(ActIndex, actions);
ReadAndVerifyEnumWithObsoletes(ActIndex, actions,
kObsoleteActions, nObsoleteActions);
ReadAndVerifyBool(Independent);
mInitialAllowedSilence = Minimum;