COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 03-01-2010, 12:04 AM   #1
RRokkenAudio
Human being with feelings
 
RRokkenAudio's Avatar
 
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
Default Just an idea

Is it possible to group these 3 items together, instead of having them spread out through the cpp?
Code:
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.
RRokkenAudio is offline   Reply With Quote
Old 03-01-2010, 03:13 AM   #2
lorcan
Human being with feelings
 
lorcan's Avatar
 
Join Date: Sep 2009
Location: France
Posts: 18
Default

What I did was make a function doing this repetitive task. Agreed, the signature is a bit long ...
lorcan is offline   Reply With Quote
Old 03-01-2010, 08:19 AM   #3
Soundbytes
Human being with feelings
 
Soundbytes's Avatar
 
Join Date: May 2006
Posts: 58
Default

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:
Code:
(...)
for(int paramIdx=0 ; paramIdx<kNumParams ; ++paramIdx){
    parameter[paramIdx].init();
(...)
OnParamChange() could be reduced to:
Code:
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
Soundbytes is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:01 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.