Pass array and count separately to read/write/define enum
This commit is contained in:
parent
180cf92790
commit
81dd580c57
|
@ -161,7 +161,8 @@ public:
|
|||
// list of non-obsolete names.
|
||||
using ObsoleteMap = std::pair< wxString, size_t >;
|
||||
|
||||
bool ReadEnum(const wxString & key, int *pi, const wxArrayString & choices,
|
||||
bool ReadEnum(const wxString & key, int *pi,
|
||||
const wxString choices[], size_t nChoices,
|
||||
const ObsoleteMap obsoletes[] = nullptr,
|
||||
size_t nObsoletes = 0) const
|
||||
{
|
||||
|
@ -170,7 +171,10 @@ public:
|
|||
{
|
||||
return false;
|
||||
}
|
||||
*pi = choices.Index(s);
|
||||
*pi = std::find( choices, choices + nChoices,
|
||||
s ) - choices;
|
||||
if (*pi == nChoices)
|
||||
*pi = -1;
|
||||
if (*pi < 0 && obsoletes) {
|
||||
auto index = std::find_if(obsoletes, obsoletes + nObsoletes,
|
||||
[&](const ObsoleteMap &entry){
|
||||
|
@ -183,20 +187,21 @@ public:
|
|||
}
|
||||
|
||||
bool ReadEnum(const wxString & key, int *pi, int defVal,
|
||||
const wxArrayString & choices,
|
||||
const wxString choices[], size_t nChoices,
|
||||
const ObsoleteMap obsoletes[] = nullptr,
|
||||
size_t nObsoletes = 0) const
|
||||
{
|
||||
if (!ReadEnum(key, pi, choices, obsoletes, nObsoletes))
|
||||
if (!ReadEnum(key, pi, choices, nChoices, obsoletes, nObsoletes))
|
||||
{
|
||||
*pi = defVal;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WriteEnum(const wxString & key, int value, const wxArrayString & choices)
|
||||
bool WriteEnum(const wxString & key, int value,
|
||||
const wxString choices[], size_t nChoices)
|
||||
{
|
||||
if (value < 0 || value >= (int) choices.GetCount())
|
||||
if (value < 0 || value >= nChoices)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -241,11 +246,11 @@ public:
|
|||
}
|
||||
|
||||
bool ReadAndVerify(const wxString & key, int *val, int defVal,
|
||||
const wxArrayString & choices,
|
||||
const wxString choices[], size_t nChoices,
|
||||
const ObsoleteMap obsoletes[] = nullptr,
|
||||
size_t nObsoletes = 0) const
|
||||
{
|
||||
ReadEnum(key, val, defVal, choices, obsoletes, nObsoletes);
|
||||
ReadEnum(key, val, defVal, choices, nChoices, obsoletes, nObsoletes);
|
||||
return (*val != wxNOT_FOUND);
|
||||
}
|
||||
|
||||
|
|
|
@ -343,12 +343,12 @@ void ShuttleParams::Define( float & var, const wxChar * key, const float vdef
|
|||
void ShuttleParams::Define( double & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl ){;};
|
||||
void ShuttleParams::Define( double & var, const wxChar * key, const double vdefault, const double vmin, const double vmax, const double vscl ){;};
|
||||
void ShuttleParams::Define( wxString &var, const wxChar * key, const wxString vdefault, const wxString vmin, const wxString vmax, const wxString vscl ){;};
|
||||
void ShuttleParams::DefineEnum( int &var, const wxChar * key, const int vdefault, wxArrayString strings ){;};
|
||||
void ShuttleParams::DefineEnum( int &var, const wxChar * key, const int vdefault, const wxString strings[], size_t nStrings ){;};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
void ShuttleParams::DefineEnum( int &var, const wxChar * key, const int vdefault, wxArrayString strings )
|
||||
void ShuttleParams::DefineEnum( int &var, const wxChar * key, const int vdefault, const IdentInterfaceSymbol strings[], size_t nStrings )
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
@ -402,7 +402,8 @@ void ShuttleGetAutomation::Define( wxString &var, const wxChar * key, const wxSt
|
|||
mpEap->Write(key, var);
|
||||
}
|
||||
|
||||
void ShuttleGetAutomation::DefineEnum( int &var, const wxChar * key, const int vdefault, wxArrayString strings )
|
||||
|
||||
void ShuttleGetAutomation::DefineEnum( int &var, const wxChar * key, const int vdefault, const wxString strings[], size_t nStrings )
|
||||
{
|
||||
if( !ShouldSet() ) return;
|
||||
mpEap->Write(key, strings[var]);
|
||||
|
@ -512,13 +513,13 @@ void ShuttleSetAutomation::Define( wxString &var, const wxChar * key, const wxSt
|
|||
}
|
||||
|
||||
|
||||
void ShuttleSetAutomation::DefineEnum( int &var, const wxChar * key, const int vdefault, wxArrayString strings )
|
||||
void ShuttleSetAutomation::DefineEnum( int &var, const wxChar * key, const int vdefault, const wxString strings[], size_t nStrings )
|
||||
{
|
||||
CouldGet( key );
|
||||
if( !bOK )
|
||||
return;
|
||||
int temp = var;
|
||||
bOK = mpEap->ReadAndVerify(key, &temp, vdefault, strings);
|
||||
bOK = mpEap->ReadAndVerify(key, &temp, vdefault, strings, nStrings);
|
||||
if( bWrite && bOK)
|
||||
var = temp;
|
||||
}
|
||||
|
@ -627,7 +628,9 @@ void ShuttleGetDefinition::Define( wxString &var, const wxChar * key, const wxSt
|
|||
}
|
||||
|
||||
|
||||
void ShuttleGetDefinition::DefineEnum( int&var, const wxChar * key, const int vdefault, wxArrayString strings )
|
||||
void ShuttleGetDefinition::DefineEnum( int &var,
|
||||
const wxChar * key, const int vdefault,
|
||||
const wxString strings[], size_t nStrings )
|
||||
{
|
||||
StartStruct();
|
||||
AddItem( wxString(key), "key" );
|
||||
|
@ -638,7 +641,7 @@ void ShuttleGetDefinition::DefineEnum( int&var, const wxChar * key, const int vd
|
|||
AddItem( strings[vdefault], "default" );
|
||||
StartField( "enum" );
|
||||
StartArray();
|
||||
for( size_t i=0;i<strings.Count(); i++ )
|
||||
for( size_t i = 0; i < nStrings; i++ )
|
||||
AddItem( strings[i] );
|
||||
EndArray();
|
||||
EndField();
|
||||
|
|
|
@ -75,7 +75,8 @@ public:
|
|||
virtual void Define( double & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl=1.0f );
|
||||
virtual void Define( double & var, const wxChar * key, const double vdefault, const double vmin, const double vmax, const double vscl=1.0f );
|
||||
virtual void Define( wxString &var, const wxChar * key, const wxString vdefault, const wxString vmin="", const wxString vmax="", const wxString vscl="" );
|
||||
virtual void DefineEnum( int &var, const wxChar * key, const int vdefault, wxArrayString strings );
|
||||
virtual void DefineEnum( int &var, const wxChar * key, const int vdefault,
|
||||
const wxString strings[], size_t nStrings );
|
||||
};
|
||||
|
||||
/**************************************************************************//**
|
||||
|
@ -92,7 +93,8 @@ public:
|
|||
void Define( double & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl ) override;
|
||||
void Define( double & var, const wxChar * key, const double vdefault, const double vmin, const double vmax, const double vscl ) override;
|
||||
void Define( wxString &var, const wxChar * key, const wxString vdefault, const wxString vmin, const wxString vmax, const wxString vscl ) override;
|
||||
void DefineEnum( int &var, const wxChar * key, const int vdefault, wxArrayString strings )override;
|
||||
void DefineEnum( int &var, const wxChar * key, const int vdefault,
|
||||
const wxString strings[], size_t nStrings ) override;
|
||||
};
|
||||
|
||||
/**************************************************************************//**
|
||||
|
@ -115,7 +117,8 @@ public:
|
|||
void Define( double & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl ) override;
|
||||
void Define( double & var, const wxChar * key, const double vdefault, const double vmin, const double vmax, const double vscl ) override;
|
||||
void Define( wxString &var, const wxChar * key, const wxString vdefault, const wxString vmin, const wxString vmax, const wxString vscl ) override;
|
||||
void DefineEnum( int &var, const wxChar * key, const int vdefault, wxArrayString strings )override;
|
||||
void DefineEnum( int &var, const wxChar * key, const int vdefault,
|
||||
const wxString strings[], size_t nStrings ) override;
|
||||
};
|
||||
|
||||
/**************************************************************************//**
|
||||
|
@ -135,7 +138,8 @@ public:
|
|||
void Define( double & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl ) override;
|
||||
void Define( double & var, const wxChar * key, const double vdefault, const double vmin, const double vmax, const double vscl ) override;
|
||||
void Define( wxString &var, const wxChar * key, const wxString vdefault, const wxString vmin, const wxString vmax, const wxString vscl ) override;
|
||||
void DefineEnum( int &var, const wxChar * key, const int vdefault, wxArrayString strings )override;
|
||||
void DefineEnum( int &var, const wxChar * key, const int vdefault,
|
||||
const wxString strings[], size_t nStrings ) override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -171,8 +175,8 @@ public:
|
|||
void Define( wxString &var, const wxChar * WXUNUSED(key), const wxString vdefault,
|
||||
const wxString WXUNUSED(vmin), const wxString WXUNUSED(vmax), const wxString WXUNUSED(vscl) )
|
||||
override { var = vdefault;};
|
||||
void DefineEnum( int &var, const wxChar * WXUNUSED(key), const int vdefault,
|
||||
wxArrayString WXUNUSED(strings) )
|
||||
void DefineEnum( int &var, const wxChar * WXUNUSED(key), const int vdefault,
|
||||
const wxString WXUNUSED(strings) [], size_t WXUNUSED( nStrings ) )
|
||||
override { var = vdefault;};
|
||||
};
|
||||
|
||||
|
@ -184,7 +188,7 @@ public:
|
|||
#define SHUTTLE_PARAM( var, name ) \
|
||||
Define( var, KEY_ ## name, DEF_ ## name, MIN_ ## name, MAX_ ## name, SCL_ ## name )
|
||||
|
||||
#define SHUTTLE_ENUM_PARAM( var, name, strings ) \
|
||||
DefineEnum( var, KEY_ ## name, DEF_ ## name, strings )
|
||||
#define SHUTTLE_ENUM_PARAM( var, name, strings, nStrings ) \
|
||||
DefineEnum( var, KEY_ ## name, DEF_ ## name, strings, nStrings )
|
||||
|
||||
#endif
|
||||
|
|
|
@ -48,14 +48,13 @@ static const wxString kCoordTypeStrings[nCoordTypes] =
|
|||
|
||||
|
||||
bool DragCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString coords( nCoordTypes, kCoordTypeStrings );
|
||||
S.OptionalN( bHasId ).Define( mId, wxT("Id"), 11000.0, -100000.0, 1000000.0);
|
||||
S.OptionalY( bHasWinName ).Define( mWinName, wxT("Window"), "Timeline");
|
||||
S.OptionalY( bHasFromX ).Define( mFromX, wxT("FromX"), 200.0, 0.0, 1000000.0);
|
||||
S.OptionalY( bHasFromY ).Define( mFromY, wxT("FromY"), 10.0, 0.0, 1000000.0);
|
||||
S.OptionalN( bHasToX ).Define( mToX, wxT("ToX"), 400.0, 0.0, 1000000.0);
|
||||
S.OptionalN( bHasToY ).Define( mToY, wxT("ToY"), 10.0, 0.0, 1000000.0);
|
||||
S.OptionalN( bHasRelativeTo ).DefineEnum( mRelativeTo, wxT("RelativeTo"), kPanel, coords );
|
||||
S.OptionalN( bHasRelativeTo ).DefineEnum( mRelativeTo, wxT("RelativeTo"), kPanel, kCoordTypeStrings, nCoordTypes );
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
|
@ -85,10 +85,8 @@ static const wxString kFormats[nFormats] =
|
|||
|
||||
|
||||
bool GetInfoCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString types( nTypes, kTypes );
|
||||
wxArrayString formats( nFormats, kFormats );
|
||||
S.DefineEnum( mInfoType, wxT("Type"), 0, types );
|
||||
S.DefineEnum( mFormat, wxT("Format"), 0, formats );
|
||||
S.DefineEnum( mInfoType, wxT("Type"), 0, kTypes, nTypes );
|
||||
S.DefineEnum( mFormat, wxT("Format"), 0, kFormats, nFormats );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,7 @@ GetTrackInfoCommand::GetTrackInfoCommand()
|
|||
}
|
||||
|
||||
bool GetTrackInfoCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString types( nTypes, kTypes );
|
||||
S.DefineEnum( mInfoType, wxT("Type"), 0, types );
|
||||
S.DefineEnum( mInfoType, wxT("Type"), 0, kTypes, nTypes );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -92,11 +92,9 @@ static const wxString kBackgroundStrings[ ScreenshotCommand::nBackgrounds ] =
|
|||
|
||||
|
||||
bool ScreenshotCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString whats(nCaptureWhats, kCaptureWhatStrings);
|
||||
wxArrayString backs(nBackgrounds, kBackgroundStrings);
|
||||
S.Define( mPath, wxT("Path"), wxT(""));
|
||||
S.DefineEnum( mWhat, wxT("CaptureWhat"), kwindow, whats );
|
||||
S.OptionalN(bHasBackground).DefineEnum( mBack, wxT("Background"), kNone, backs );
|
||||
S.DefineEnum( mWhat, wxT("CaptureWhat"), kwindow,kCaptureWhatStrings, nCaptureWhats );
|
||||
S.OptionalN(bHasBackground).DefineEnum( mBack, wxT("Background"), kNone, kBackgroundStrings, nBackgrounds );
|
||||
S.OptionalN(bHasBringToTop).Define( mbBringToTop, wxT("ToTop"), true );
|
||||
return true;
|
||||
};
|
||||
|
|
|
@ -55,12 +55,11 @@ static const wxString kRelativeTo[nRelativeTos] =
|
|||
};
|
||||
|
||||
bool SelectTimeCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString relativeSpec( nRelativeTos, kRelativeTo );
|
||||
// Allow selection down to -ve 100seconds.
|
||||
// Typically used to expand/contract selections by a small amount.
|
||||
S.OptionalY( bHasT0 ).Define( mT0, wxT("Start"), 0.0, -100.0, (double)FLT_MAX);
|
||||
S.OptionalY( bHasT1 ).Define( mT1, wxT("End"), 0.0, -100.0, (double)FLT_MAX);
|
||||
S.OptionalN( bHasRelativeSpec ).DefineEnum( mRelativeTo, wxT("RelativeTo"), 0, relativeSpec );
|
||||
S.OptionalN( bHasRelativeSpec ).DefineEnum( mRelativeTo, wxT("RelativeTo"), 0, kRelativeTo, nRelativeTos );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -177,10 +176,9 @@ static const wxString kModes[nModes] =
|
|||
};
|
||||
|
||||
bool SelectTracksCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString modes( nModes, kModes );
|
||||
S.OptionalN( bHasFirstTrack).Define( mFirstTrack, wxT("Track"), 0.0, 0.0, 100.0);
|
||||
S.OptionalN( bHasNumTracks ).Define( mNumTracks, wxT("TrackCount"), 1.0, 0.0, 100.0);
|
||||
S.OptionalY( bHasMode ).DefineEnum( mMode, wxT("Mode"), 0, modes );
|
||||
S.OptionalY( bHasMode ).DefineEnum( mMode, wxT("Mode"), 0, kModes, nModes );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -48,9 +48,8 @@ static const wxString kColourStrings[nColours] =
|
|||
|
||||
|
||||
bool SetClipCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString colours( nColours, kColourStrings );
|
||||
S.OptionalY( bHasContainsTime ).Define( mContainsTime, wxT("At"), 0.0, 0.0, 100000.0 );
|
||||
S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, colours );
|
||||
S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, kColourStrings, nColours );
|
||||
// Allowing a negative start time is not a mistake.
|
||||
// It will be used in demonstrating time before zero.
|
||||
S.OptionalN( bHasT0 ).Define( mT0, wxT("Start"), 0.0, -5.0, 1000000.0);
|
||||
|
|
|
@ -287,17 +287,12 @@ static const wxString kZoomTypeStrings[nZoomTypes] =
|
|||
};
|
||||
|
||||
bool SetTrackVisualsCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString colours( nColours, kColourStrings );
|
||||
wxArrayString displays( nDisplayTypes, kDisplayTypeStrings );
|
||||
wxArrayString scales( nScaleTypes, kScaleTypeStrings );
|
||||
wxArrayString vzooms( nZoomTypes, kZoomTypeStrings );
|
||||
|
||||
SetTrackBase::DefineParams( S );
|
||||
S.OptionalN( bHasHeight ).Define( mHeight, wxT("Height"), 120, 44, 700 );
|
||||
S.OptionalN( bHasDisplayType ).DefineEnum( mDisplayType, wxT("Display"), kWaveform, displays );
|
||||
S.OptionalN( bHasScaleType ).DefineEnum( mScaleType, wxT("Scale"), kLinear, scales );
|
||||
S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, colours );
|
||||
S.OptionalN( bHasVZoom ).DefineEnum( mVZoom, wxT("VZoom"), kReset, vzooms );
|
||||
S.OptionalN( bHasDisplayType ).DefineEnum( mDisplayType, wxT("Display"), kWaveform, kDisplayTypeStrings, nDisplayTypes );
|
||||
S.OptionalN( bHasScaleType ).DefineEnum( mScaleType, wxT("Scale"), kLinear, kScaleTypeStrings, nScaleTypes );
|
||||
S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, kColourStrings, nColours );
|
||||
S.OptionalN( bHasVZoom ).DefineEnum( mVZoom, wxT("VZoom"), kReset, kZoomTypeStrings, nZoomTypes );
|
||||
|
||||
S.OptionalN( bHasUseSpecPrefs ).Define( bUseSpecPrefs, wxT("SpecPrefs"), false );
|
||||
S.OptionalN( bHasSpectralSelect ).Define( bSpectralSelect, wxT("SpectralSel"),true );
|
||||
|
|
|
@ -280,8 +280,8 @@ size_t EffectDistortion::RealtimeProcess(int group,
|
|||
return InstanceProcess(mSlaves[group], inbuf, outbuf, numSamples);
|
||||
}
|
||||
bool EffectDistortion::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString tables( nTableTypes, kTableTypeStrings );
|
||||
S.SHUTTLE_ENUM_PARAM( mParams.mTableChoiceIndx, TableTypeIndx, tables );
|
||||
S.SHUTTLE_ENUM_PARAM( mParams.mTableChoiceIndx, TableTypeIndx,
|
||||
kTableTypeStrings, nTableTypes );
|
||||
S.SHUTTLE_PARAM( mParams.mDCBlock, DCBlock );
|
||||
S.SHUTTLE_PARAM( mParams.mThreshold_dB, Threshold_dB );
|
||||
S.SHUTTLE_PARAM( mParams.mNoiseFloor, NoiseFloor );
|
||||
|
@ -306,7 +306,7 @@ bool EffectDistortion::GetAutomationParameters(CommandParameters & parms)
|
|||
|
||||
bool EffectDistortion::SetAutomationParameters(CommandParameters & parms)
|
||||
{
|
||||
ReadAndVerifyEnum(TableTypeIndx, wxArrayString(nTableTypes, kTableTypeStrings));
|
||||
ReadAndVerifyEnum(TableTypeIndx, kTableTypeStrings, nTableTypes);
|
||||
ReadAndVerifyBool(DCBlock);
|
||||
ReadAndVerifyDouble(Threshold_dB);
|
||||
ReadAndVerifyDouble(NoiseFloor);
|
||||
|
|
|
@ -787,15 +787,15 @@ inline long TrapLong(long x, long min, long max)
|
|||
if (!parms.ReadAndVerify(KEY_ ## name, &name, DEF_ ## name)) \
|
||||
return false;
|
||||
|
||||
#define ReadAndVerifyEnum(name, list) \
|
||||
#define ReadAndVerifyEnum(name, list, listSize) \
|
||||
int name; \
|
||||
if (!parms.ReadAndVerify(KEY_ ## name, &name, DEF_ ## name, list)) \
|
||||
if (!parms.ReadAndVerify(KEY_ ## name, &name, DEF_ ## name, list, listSize)) \
|
||||
return false;
|
||||
|
||||
#define ReadAndVerifyEnumWithObsoletes(name, list, obsoleteList, nObsolete) \
|
||||
#define ReadAndVerifyEnumWithObsoletes(name, list, listSize, obsoleteList, nObsolete) \
|
||||
int name; \
|
||||
if (!parms.ReadAndVerify(KEY_ ## name, &name, DEF_ ## name, \
|
||||
list, obsoleteList, nObsolete)) \
|
||||
list, listSize, obsoleteList, nObsolete)) \
|
||||
return false;
|
||||
|
||||
#define ReadAndVerifyInt(name) ReadParam(int, name)
|
||||
|
|
|
@ -309,11 +309,10 @@ EffectType EffectEqualization::GetType()
|
|||
|
||||
// EffectClientInterface implementation
|
||||
bool EffectEqualization::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString interp(nInterpolations, kInterpStrings);
|
||||
S.SHUTTLE_PARAM( mM, FilterLength );
|
||||
S.SHUTTLE_PARAM( mCurveName, CurveName);
|
||||
S.SHUTTLE_PARAM( mLin, InterpLin);
|
||||
S.SHUTTLE_ENUM_PARAM( mInterp, InterpMeth, interp );
|
||||
S.SHUTTLE_ENUM_PARAM( mInterp, InterpMeth, kInterpStrings, nInterpolations );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -323,7 +322,7 @@ bool EffectEqualization::GetAutomationParameters(CommandParameters & parms)
|
|||
parms.Write(KEY_FilterLength, (unsigned long)mM);
|
||||
parms.Write(KEY_CurveName, mCurveName);
|
||||
parms.Write(KEY_InterpLin, mLin);
|
||||
parms.WriteEnum(KEY_InterpMeth, mInterp, wxArrayString(nInterpolations, kInterpStrings));
|
||||
parms.WriteEnum(KEY_InterpMeth, mInterp, kInterpStrings, nInterpolations);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -341,7 +340,7 @@ bool EffectEqualization::SetAutomationParameters(CommandParameters & parms)
|
|||
ReadAndVerifyInt(FilterLength);
|
||||
ReadAndVerifyString(CurveName);
|
||||
ReadAndVerifyBool(InterpLin);
|
||||
ReadAndVerifyEnum(InterpMeth, interpolations);
|
||||
ReadAndVerifyEnum(InterpMeth, kInterpStrings, nInterpolations);
|
||||
|
||||
mM = FilterLength;
|
||||
mCurveName = CurveName;
|
||||
|
|
|
@ -35,7 +35,7 @@ enum kTypes
|
|||
nTypes
|
||||
};
|
||||
|
||||
static const wxChar *kTypeStrings[nTypes] =
|
||||
static const wxString kTypeStrings[nTypes] =
|
||||
{
|
||||
XO("White"),
|
||||
XO("Pink"),
|
||||
|
@ -162,8 +162,7 @@ size_t EffectNoise::ProcessBlock(float **WXUNUSED(inbuf), float **outbuf, size_t
|
|||
return size;
|
||||
}
|
||||
bool EffectNoise::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString types( nTypes, kTypeStrings );
|
||||
S.SHUTTLE_ENUM_PARAM( mType, Type, types );
|
||||
S.SHUTTLE_ENUM_PARAM( mType, Type, kTypeStrings, nTypes );
|
||||
S.SHUTTLE_PARAM( mAmp, Amp );
|
||||
return true;
|
||||
}
|
||||
|
@ -178,7 +177,7 @@ bool EffectNoise::GetAutomationParameters(CommandParameters & parms)
|
|||
|
||||
bool EffectNoise::SetAutomationParameters(CommandParameters & parms)
|
||||
{
|
||||
ReadAndVerifyEnum(Type, wxArrayString(nTypes, kTypeStrings));
|
||||
ReadAndVerifyEnum(Type, kTypeStrings, nTypes);
|
||||
ReadAndVerifyDouble(Amp);
|
||||
|
||||
mType = Type;
|
||||
|
|
|
@ -86,7 +86,7 @@ enum kTypes
|
|||
nTypes
|
||||
};
|
||||
|
||||
static const wxChar *kTypeStrings[nTypes] =
|
||||
static const wxString kTypeStrings[nTypes] =
|
||||
{
|
||||
/*i18n-hint: Butterworth is the name of the person after whom the filter type is named.*/
|
||||
XO("Butterworth"),
|
||||
|
@ -103,7 +103,7 @@ enum kSubTypes
|
|||
nSubTypes
|
||||
};
|
||||
|
||||
static const wxChar *kSubTypeStrings[nSubTypes] =
|
||||
static const wxString kSubTypeStrings[nSubTypes] =
|
||||
{
|
||||
XO("Lowpass"),
|
||||
XO("Highpass")
|
||||
|
@ -241,10 +241,8 @@ size_t EffectScienFilter::ProcessBlock(float **inBlock, float **outBlock, size_t
|
|||
return blockLen;
|
||||
}
|
||||
bool EffectScienFilter::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString filters( nTypes, kTypeStrings );
|
||||
wxArrayString subtypes( nSubTypes, kSubTypeStrings );
|
||||
S.SHUTTLE_ENUM_PARAM( mFilterType, Type, filters );
|
||||
S.SHUTTLE_ENUM_PARAM( mFilterSubtype, Subtype, subtypes );
|
||||
S.SHUTTLE_ENUM_PARAM( mFilterType, Type, kTypeStrings, nTypes );
|
||||
S.SHUTTLE_ENUM_PARAM( mFilterSubtype, Subtype, kSubTypeStrings, nSubTypes );
|
||||
S.SHUTTLE_PARAM( mOrder, Order );
|
||||
S.SHUTTLE_PARAM( mCutoff, Cutoff );
|
||||
S.SHUTTLE_PARAM( mRipple, Passband );
|
||||
|
@ -266,8 +264,8 @@ bool EffectScienFilter::GetAutomationParameters(CommandParameters & parms)
|
|||
|
||||
bool EffectScienFilter::SetAutomationParameters(CommandParameters & parms)
|
||||
{
|
||||
ReadAndVerifyEnum(Type, wxArrayString(nTypes, kTypeStrings));
|
||||
ReadAndVerifyEnum(Subtype, wxArrayString(nSubTypes, kSubTypeStrings));
|
||||
ReadAndVerifyEnum(Type, kTypeStrings, nTypes);
|
||||
ReadAndVerifyEnum(Subtype, kSubTypeStrings, nSubTypes);
|
||||
ReadAndVerifyInt(Order);
|
||||
ReadAndVerifyFloat(Cutoff);
|
||||
ReadAndVerifyFloat(Passband);
|
||||
|
|
|
@ -267,10 +267,8 @@ bool EffectToneGen::DefineParams( ShuttleParams & S ){
|
|||
mFrequency[1] = mFrequency[0];
|
||||
mAmplitude[1] = mAmplitude[0];
|
||||
}
|
||||
wxArrayString waves( nWaveforms, kWaveStrings );
|
||||
wxArrayString interps( nInterpolations ,kInterStrings );
|
||||
S.SHUTTLE_ENUM_PARAM( mWaveform, Waveform, waves );
|
||||
S.SHUTTLE_ENUM_PARAM( mInterpolation, Interp, interps );
|
||||
S.SHUTTLE_ENUM_PARAM( mWaveform, Waveform, kWaveStrings, nWaveforms );
|
||||
S.SHUTTLE_ENUM_PARAM( mInterpolation, Interp, kInterStrings, nInterpolations );
|
||||
|
||||
|
||||
// double freqMax = (GetActiveProject() ? GetActiveProject()->GetRate() : 44100.0) / 2.0;
|
||||
|
@ -303,8 +301,8 @@ bool EffectToneGen::GetAutomationParameters(CommandParameters & parms)
|
|||
|
||||
bool EffectToneGen::SetAutomationParameters(CommandParameters & parms)
|
||||
{
|
||||
ReadAndVerifyEnum(Waveform, wxArrayString(nWaveforms, kWaveStrings));
|
||||
ReadAndVerifyEnum(Interp, wxArrayString(nInterpolations, kInterStrings));
|
||||
ReadAndVerifyEnum(Waveform, kWaveStrings, nWaveforms);
|
||||
ReadAndVerifyEnum(Interp, kInterStrings, nInterpolations);
|
||||
if (mChirp)
|
||||
{
|
||||
ReadAndVerifyDouble(StartFreq);
|
||||
|
|
|
@ -77,7 +77,7 @@ enum kActions
|
|||
nActions
|
||||
};
|
||||
|
||||
static const wxChar *kActionStrings[nActions] =
|
||||
static const wxString kActionStrings[nActions] =
|
||||
{
|
||||
XO("Truncate Detected Silence"),
|
||||
XO("Compress Excess Silence")
|
||||
|
@ -176,10 +176,9 @@ EffectType EffectTruncSilence::GetType()
|
|||
// EffectClientInterface implementation
|
||||
|
||||
bool EffectTruncSilence::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString actions(nActions, kActionStrings);
|
||||
|
||||
S.SHUTTLE_ENUM_PARAM( mTruncDbChoiceIndex, DbIndex, mDbChoices );
|
||||
S.SHUTTLE_ENUM_PARAM( mActionIndex, ActIndex, actions );
|
||||
S.SHUTTLE_ENUM_PARAM( mTruncDbChoiceIndex, DbIndex,
|
||||
Enums::DbChoices, Enums::NumDbChoices );
|
||||
S.SHUTTLE_ENUM_PARAM( mActionIndex, ActIndex, kActionStrings, nActions );
|
||||
S.SHUTTLE_PARAM( mInitialAllowedSilence, Minimum );
|
||||
S.SHUTTLE_PARAM( mTruncLongestAllowedSilence, Truncate );
|
||||
S.SHUTTLE_PARAM( mSilenceCompressPercent, Compress );
|
||||
|
@ -201,13 +200,11 @@ bool EffectTruncSilence::GetAutomationParameters(CommandParameters & parms)
|
|||
|
||||
bool EffectTruncSilence::SetAutomationParameters(CommandParameters & parms)
|
||||
{
|
||||
wxArrayString actions(nActions, kActionStrings);
|
||||
|
||||
ReadAndVerifyDouble(Minimum);
|
||||
ReadAndVerifyDouble(Truncate);
|
||||
ReadAndVerifyDouble(Compress);
|
||||
ReadAndVerifyEnum(DbIndex, mDbChoices);
|
||||
ReadAndVerifyEnumWithObsoletes(ActIndex, actions,
|
||||
ReadAndVerifyEnum(DbIndex, Enums::DbChoices, Enums::NumDbChoices);
|
||||
ReadAndVerifyEnumWithObsoletes(ActIndex, kActionStrings, nActions,
|
||||
kObsoleteActions, nObsoleteActions);
|
||||
ReadAndVerifyBool(Independent);
|
||||
|
||||
|
|
|
@ -338,10 +338,10 @@ bool NyquistEffect::DefineParams( ShuttleParams & S )
|
|||
else if (ctrl.type == NYQ_CTRL_CHOICE)
|
||||
{
|
||||
// untranslated
|
||||
const wxArrayString &choices = ctrl.choices;
|
||||
int x=d;
|
||||
//parms.WriteEnum(ctrl.var, (int) d, choices);
|
||||
S.DefineEnum( x, static_cast<const wxChar*>( ctrl.var.c_str() ), 0, choices );
|
||||
S.DefineEnum( x, static_cast<const wxChar*>( ctrl.var.c_str() ), 0,
|
||||
&ctrl.choices[0], ctrl.choices.size() );
|
||||
}
|
||||
else if (ctrl.type == NYQ_CTRL_STRING)
|
||||
{
|
||||
|
@ -388,8 +388,8 @@ bool NyquistEffect::GetAutomationParameters(CommandParameters & parms)
|
|||
else if (ctrl.type == NYQ_CTRL_CHOICE)
|
||||
{
|
||||
// untranslated
|
||||
const wxArrayString &choices = ctrl.choices;
|
||||
parms.WriteEnum(ctrl.var, (int) d, choices);
|
||||
parms.WriteEnum(ctrl.var, (int) d,
|
||||
&ctrl.choices[0], ctrl.choices.size());
|
||||
}
|
||||
else if (ctrl.type == NYQ_CTRL_STRING)
|
||||
{
|
||||
|
@ -439,8 +439,8 @@ bool NyquistEffect::SetAutomationParameters(CommandParameters & parms)
|
|||
{
|
||||
int val;
|
||||
// untranslated
|
||||
const wxArrayString &choices = ctrl.choices;
|
||||
good = parms.ReadEnum(ctrl.var, &val, choices) &&
|
||||
good = parms.ReadEnum(ctrl.var, &val,
|
||||
&ctrl.choices[0], ctrl.choices.size()) &&
|
||||
val != wxNOT_FOUND;
|
||||
}
|
||||
else if (ctrl.type == NYQ_CTRL_STRING)
|
||||
|
@ -480,8 +480,8 @@ bool NyquistEffect::SetAutomationParameters(CommandParameters & parms)
|
|||
{
|
||||
int val {0};
|
||||
// untranslated
|
||||
const wxArrayString &choices = ctrl.choices;
|
||||
parms.ReadEnum(ctrl.var, &val, choices);
|
||||
parms.ReadEnum(ctrl.var, &val,
|
||||
&ctrl.choices[0], ctrl.choices.size());
|
||||
ctrl.val = (double) val;
|
||||
}
|
||||
else if (ctrl.type == NYQ_CTRL_STRING)
|
||||
|
|
|
@ -190,10 +190,10 @@ bool VampEffect::GetAutomationParameters(CommandParameters & parms)
|
|||
{
|
||||
val = i;
|
||||
}
|
||||
choices.Add(choice);
|
||||
choices.push_back(choice);
|
||||
}
|
||||
|
||||
parms.WriteEnum(key, val, choices);
|
||||
parms.WriteEnum(key, val, &choices[0], choices.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -233,10 +233,10 @@ bool VampEffect::SetAutomationParameters(CommandParameters & parms)
|
|||
for (size_t i = 0, cnt = mParameters[p].valueNames.size(); i < cnt; i++)
|
||||
{
|
||||
wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str());
|
||||
choices.Add(choice);
|
||||
choices.push_back(choice);
|
||||
}
|
||||
|
||||
good = parms.ReadEnum(key, &val, choices) && val != wxNOT_FOUND;
|
||||
good = parms.ReadEnum(key, &val, &choices[0], choices.size()) && val != wxNOT_FOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -279,10 +279,10 @@ bool VampEffect::SetAutomationParameters(CommandParameters & parms)
|
|||
for (size_t i = 0, cnt = mParameters[p].valueNames.size(); i < cnt; i++)
|
||||
{
|
||||
wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str());
|
||||
choices.Add(choice);
|
||||
choices.push_back(choice);
|
||||
}
|
||||
|
||||
parms.ReadEnum(key, &val, choices);
|
||||
parms.ReadEnum(key, &val, &choices[0], choices.size());
|
||||
|
||||
mPlugin->setParameter(mParameters[p].identifier, (float) val);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue