I was wondering how many folks round these parts use C++, as opposed to C to write their plugins.
The SDK doesn't really encourage C++ coding, as much of the example projects are still mostly C, with the odd bit using C++ (like acquiring suites; although there's a new way to do this, as I've just posted about here: Using the new AEFX_SuiteScoper Template Class ).
After seeing just how much code repetition you can avoid (the arbitrary parameter handler was a big eye-opener for me), I've recently begun to rewrite bits of my new plugin using classes.
In particular I've written a parameter checkout class that goes from (as an extreme example):
PF_ParamDef my_param;
AEFX_CLR_STRUCT(my_param);
ERR(PF_CHECKOUT_PARAM(in_data, MY_PARAM, in_data->current_time, in_data->time_step, in_data->time_scale, &my_param));
PF_AngleParamSuite1 *apsP = NULL;
ERR(AEFX_AcquireSuite(in_data, out_data, kPFAngleParamSuite, kPFAngleParamSuiteVersion1, "Couldn't load suite", (void**)&apsP));
PF_FpLong angleF;
ERR(apsP->PF_GetFloatingPointValueFromPointDef(in_data->effect_ref, &my_param, &angleF));
ERR2(AEFX_ReleaseSuite(in_data, out_data, kPFAngleParamSuite, kPFAngleParamSuiteVersion1, "Couldn't release suite"));
ERR2(PF_CHECKIN_PARAM(in_data, &my_param));
To:
// This stores the pointer to in_data, and acquires pointers to the param suites - pass into all ParamHandler objects
ParamContext param_ctx(in_data);
ParamHandler my_param(param_ctx, MY_PARAM);
PF_FpLong angleF = my_param.AngleValue();
// No need to release anything as it's done in the class destructors
I'd be interested in hearing about your approaches to C++ifying things like this, and your general approach to coding.