COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 02-16-2018, 08:20 PM   #1
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default IPlug program structures

I've been coding some plugins that have various controls that don't interact with the DAW as standard parameters(ie. paramIdx==-1 when instantiating the control) because I don't want their state restored or automated by the DAW.
This means there's no OnParamterChange called when the control is touched. In one situation I tested a flag variable in ProcessReplacing to detect and respond to an event. The processing at this point was very light and everything works well.
In the current project a button opens a file dialog which suspends the thread which is obviously no good for ProcessReplacing.
So my question is how to detect and service events from non-DAW parameter controls?
Guod3 is offline   Reply With Quote
Old 02-19-2018, 01:12 PM   #2
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

I use private parameters for the controls that don't need to be visible to the host in that way. They should work as normal, but they won't appear in the automation list.

The only thing is I'm not sure where you should actually set them to your desired value on load. I'm currently doing it in MyPlug::SetGUILayout, which is ok for me as my plugin's mainly a visualiser, but this won't work right for parameters that affect the sound as this will only be called on load if the interface is open, and it doesn't work when loading presets.
Bobflip is offline   Reply With Quote
Old 02-19-2018, 04:57 PM   #3
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

Parameters that don't get automated or automatically saved/restored but still trigger OnParameterChange() would be ideal.
How is this implemented? (Like this?:https://forum.cockos.com/showpost.ph...8&postcount=15)

Would UnSerializeState() be good for loading initial values?
Guod3 is offline   Reply With Quote
Old 02-19-2018, 05:04 PM   #4
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Which framework are you using?
Bobflip is offline   Reply With Quote
Old 02-19-2018, 05:06 PM   #5
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

WDL-OL
Guod3 is offline   Reply With Quote
Old 02-19-2018, 05:13 PM   #6
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Ok, well, I saw this in the IPlugControls example, I think the last param is an example of a private param. Don't know about how to reset it though. I'm using WDL-Youlean, didn't personally get the reset to work with UnserializeParams.

Code:
enum EParams
{
  kISwitchControl_2,
  kISwitchControl_3,
  kIInvisibleSwitchControl,
  kIRadioButtonsControl_H,
  kIRadioButtonsControl_V,
  kIContactControl,
  kIFaderControl_Horiz,
  kIFaderControl_Vert,
  kIKnobLineControl_def,
  kIKnobLineControl_lo_gear,
  kIKnobRotaterControl_def,
  kIKnobRotaterControl_restrict,
  kIKnobMultiControl_def,
  kIKnobMultiControl_Horiz,
  kIKnobRotatingMaskControl,
  kICaptionControl,
  kNumParams,   // put any controls to be controlled from the plug but not
  kInvisibleSwitchIndicator   // the user after kNumParams so they get a param id
};
Bobflip is offline   Reply With Quote
Old 02-19-2018, 05:56 PM   #7
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

I'm getting a null pointer exception when calling GetParam() the the index after kNumParams.

The posting I linked to was from this thread:https://forum.cockos.com/showthread....348#post788348
It provides a recipe from a while back with someone having used it successfully just recently. Maybe Youlean has implemented support already?
Guod3 is offline   Reply With Quote
Old 02-19-2018, 06:08 PM   #8
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

From that error, you probably need to adjust a value called something like kNumParams (perhaps something else, not at computer atm) to match the number of parameters you're using. Have a look at the full example to confirm how it was done.

WDL-YOULEAN does have private parameters sorted as well though, that's the framework I'm using.
Bobflip is offline   Reply With Quote
Old 02-19-2018, 06:13 PM   #9
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

Yep, anything over kNumParams causes exception.
I guess I'll have a look at Youlean and the changes to WDL-OL and pick my poison!
May I ask what made you choose Youlean?

[edit]
Youlean has both the private params, and OnParameterChange source reporting, so I think I'll give it a try. The Cairo graphics looks interesting....

Last edited by Guod3; 02-19-2018 at 07:00 PM.
Guod3 is offline   Reply With Quote
Old 02-19-2018, 06:20 PM   #10
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

As I say though, check the example that code is from to see how it was done. I went for Youlean's branch for the Cairo graphics and GUI resizing, the latter of which was especially important for what I was building, the the former allowed for nice looking vector graphics to resize.
Bobflip is offline   Reply With Quote
Old 02-19-2018, 10:58 PM   #11
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

The graphics is an interesting benefit. I have an idea for editing synth patches or groups of patches where a small picture or glyph is automagically generated beside each patch in row. This way they are visually identifiable even if a group of them have the same patchname. In sound design its good to work with a bunch of variations even better if you don't have to keep "save as" new name all over the place.
The idea is to generate a glyph using the patch data to seed the algorithm. Also use major properties of the sound to influence graphic generation.e.g slow envelopes suggest pad which may give rise to soft rendered low saturation colors. It's a deep topic. I definitely would like to use kalideoscopic type generators to yield an aesthetic glyph from what is pseudo random data. At a minimum a crc on a patch dump would generate an entirely different number even if the whole patch changed by just 1 bit. Anyhow I've gone way OT, but more powerful graphics has its uses!
Guod3 is offline   Reply With Quote
Old 02-20-2018, 03:27 AM   #12
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Have a look here to learn about what can be done with Cairo:

https://cairographics.org/tutorial/

My plugin is here http://www.bogus-noise.co.uk/compere/
The logos, knobs, and buttons along the bottom are bitmaps, but everything else is Cairo. Nothing incredibly fancy, but it doesn't need to be!

Bobflip is offline   Reply With Quote
Old 02-20-2018, 02:27 PM   #13
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

The dynamic content (graphs) places a whole other level of demands on the available graphic capabilities of the framework. I think most would use Skinman to create their graphics but of course they'll be static.
Thinking about it more, GUI resizing opens the interesting design possibility of prioritising the visible controls and dynamically reorganising the layout to suite the size the user has dragged the window to.
Guod3 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 02:13 AM.


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