PDA

View Full Version : Just an idea


RRokkenAudio
03-01-2010, 12:04 AM
Is it possible to group these 3 items together, instead of having them spread out through the cpp?

IBitmap bitmap = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, 101);
pGraphics->AttachControl(new IKnobMultiControl(this, 168,336,kdethp, &bitmap));
GetParam(kdethp)->InitInt("Det Filter", 0, 0,1);
dethp = GetParam(kdethp)->Value();


With more complex project it seems to get confusing for me otherwize.

~Rob.

lorcan
03-01-2010, 03:13 AM
What I did was make a function doing this repetitive task. Agreed, the signature is a bit long ...

Soundbytes
03-01-2010, 08:19 AM
Yep, I already thought about using a dedicated parameter class that groups all the data that refers to a specific controler in one object.
The class would provide methods for gui, setup, parameter change and so on.
The overhead of this implementation is minimal because most of these functions are very short and can be inlined.
The parameter related stuff in the plugin constructor for example would then look like this:

(...)
for(int paramIdx=0 ; paramIdx<kNumParams ; ++paramIdx){
parameter[paramIdx].init();
(...)

OnParamChange() could be reduced to:

void IPlugExampleSynth::OnParamChange(int paramIdx)
{
iMutexLock lock(this);
parameter[paramIdx].set();
}

Adding/removing/modifying parameters will also be much easier and less error prone when done this way. I will definitely go that route once I have made myself a bit more familiar with the IPlug framework.

Andreas