Here is simple code change that will allow you to add new parameters in the future versions of the plugin without braking the plugin. You can also remove parameters. NOTE: If you want to add new parameter you need to put it to the end of enum.
Also this is not well tested, so test it before use.
IPlugBase.cpp
Code:
bool IPlugBase::SerializeParams(ByteChunk* pChunk)
{
TRACE;
WDL_MutexLock lock(&mMutex);
bool savedOK = true;
int i, n = mParams.GetSize();
// Save number of parameters. Do this so you can add parameters in the future versions without braking the plugin.
// NOTE: Add new parameters at the end.
pChunk->Put(&n);
for (i = 0; i < n && savedOK; ++i)
{
IParam* pParam = mParams.Get(i);
Trace(TRACELOC, "%d %s %f", i, pParam->GetNameForHost(), pParam->Value());
double v = pParam->Value();
savedOK &= (pChunk->Put(&v) > 0);
}
return savedOK;
}
int IPlugBase::UnserializeParams(ByteChunk* pChunk, int startPos)
{
TRACE;
WDL_MutexLock lock(&mMutex);
int i, n = mParams.GetSize(), pos = startPos;
// Use last saved parameter number.
pos = pChunk->Get(&n, pos);
n = IPMIN(n, mParams.GetSize());
for (int i = 0; i < n && pos >= 0; ++i)
{
IParam* pParam = mParams.Get(i);
double v = 0.0;
Trace(TRACELOC, "%d %s %f", i, pParam->GetNameForHost(), pParam->Value());
pos = pChunk->Get(&v, pos);
pParam->Set(v);
}
OnParamReset();
return pos;
}