Updating enum params dynamically

is there a way to update an enum param dynamically, including changing the number of entries?

I’ve currently hacked around it by adding this to IParam:

 void PrepareEnumUpdate (int total_entries)
   {
   mDisplayTexts.Resize(0, true);
   mMax = total_entries-1;
   }

usage:

param->PrepareToUpdateEnum(total);

for(unsigned p=0; p<total; p++)
	param->SetDisplayText(p, entry_string[p]);

is there a better way?

hmmm, i’m not sure i’d recommend modifying parameters like this. It probably won’t register on the host side, depending on the plug-in format, DAW etc

this is for a custom preset system, where as I enumerate the preset files on disk, and as the user saves new ones, I need to update the list selection dynamically.

can you think of another way?

And you use a plug-in parameter to choose the preset? seems strange

You can make a list in an IControl without a parameter, check out these controls:

it’s only strange if you understand the internals. using an enum param seemed the way to go, as it already has the functionality I need (along with caption controls).

you obviously intimately know your codebase and how DAWs and platforms respond. after a few weeks’ intense (mostly custom GUI) work on my first full plugin I’m only slowly getting a good feel for it. there’s still quite a lot that is far from intuitive, for example the many ways you can set parameter values programmatically - many of the related calls are only used internally, but this isn’t clear from the documentation which documents the internals the same as the more likely calls a plugin dev should use.

the other big thing I struggled with is how the delegate works to pass values between DSP and UI. the word ‘Delegate’ used in calls for example is far from intuitive, especially as the delegate is explained as passing parameters in either direction - so where is a SomethingDelegate() call sending something? and why are the DSP->GUI calls (as I understand it) labelled ‘API’? Why not simply use DSP and GUI/Editor in the names?

these aren’t knocks, just a reminder that a lot is quite opaque, especially at the beginning.

but thanks for the pointer, sounds like a better way to go.

didn’t meant to offend. I just meant the parameter is probably not the best choice to control preset selection.

There is definitely a lot of complexity, which mainly stems from the “distributed” setup for web audio modules, whilst also staying backwards compatible. I tried to explain the IEditorDelegate in the docs here. Delegate is not the perfect name, especially since there is an established delegation pattern.

edit → started some explanation here

no worries Oli, thanks for the writeup, and it’s a great framework. the delegate thing sure is a complex system though.

my issue was needing to set parameters programmatically from my own preset system on the UI side. what are the correct calls to set the params, dirty all connected controls, and send the values to the DSP side?

I’d find it more intuitive to use ‘ToDSP’ or ‘ToUI’ in those calls rather than mention the delegate or API, I don’t think a plugin dev needs to know about those internals right?

also do you have a writeup explaining exactly what each thread type is supposed to do? the real-time thread is obviously the processing thread, but what is the ‘main’ thread for? the UI? anything else? (sorry if this is documented somewhere, but I haven’t found it yet).