How to make a component with flexible parameter types?

i made a component called ModuleComponent for my plugin-gui-template i’m working on. in my imagination it should be like this: whenever i wanna make another parameter i give it a new ModuleComponent-Object and specify its name and its parameter type along with the range of the parameter (default: 0 to 1). but how can i let my module be that flexible? do i have to add one instance of all parameter-types to the object to do that? i feel like that might be kinda bad for the performance… there is a smarter way to do that, isn’t it?

There is the GenericAudioPluginEditor, that does exactly that. You can get inspiration from their code in juce_processors/processors/juce_GenericAudioProcessorEditor.cpp.

Basically you traverse the getParameterTree() and try to cast the parameters to the specific types.
Since it is within your plugin, this will work, whereas when you host a plugin, it is more complicated, because the parameters are no longer polymorphic.

That is the way I do it in my generic GUI module PluginGuiMagic

2 Likes

oh wow nice! you even brought examples :slight_smile: man, i already love this forum. it’s so different than most other coding forums. i’ll check out your ressources very soon.

btw nice delay plugin you got on your page. i like the fact that there will be a section where the user can select which effect should be in the feedback-loop. i see you also love flexible things

i’m not sure tho but i think we mean slightly different things. your pluginGuiMagic-examples let people add sliders etc. from that menue on the left while using the plugin. so you interpret “parameter flexibility” as a realtime thing for the end-user. i was on a much more basic level with my idea. i just want to write a method that i can use in all of my plugins to make parameter-types that can all be part of a specific gui component, but i only want this flexibility in my code, not in an actual gui-menue. but i must say, you made some pretty cool stuff there