Im working on a project that loads a VST plugin into my JUCE application as an AudioProcessorGraph node. I would like to make a custom GUI for this plugin. I have access to the parameters through processor->getParameters() however their type is AudioProcessorParameter and a SliderAttachment needs a RangedAudioParameter to attach itself.
How can I connect this existing AudioProcessorParameter to my Slider? Do i need to create a new apvts and syncronize it to the existing processor? Or can I somehow extract the existing apvts from the AudioProcessorGraph processor?
Any ideas or examples would be greatly appreciated.
I’m not certain, but you might be able to cast your AudioProcessorParameters* that you get from getParameters() to RangedAudioParameters* and pass them into a ParameterAttachment.
The other option might be to, as you say, create an APVTS in your processor, assign it the parameters and pass it to SliderAttachment. I’ve only ever done this with vanilla plugins, though, never in an application context.
I am not sure whether dynamic_cast will work since SliderAttachment will call convertFrom0to1, convertTo0to1, etc. I would suggest passing a reference of APVTS to your component.
Yeah, I’m not really sure outside of a plugin, but I just saw in the docs that all the parameter classes above and including RangedAudioParameter are abstract so I guessed we might be dealing with an AudioParameterFloat or something in disguise.
Generally you should NOT create any APVTS within your GUI code. As I said before, you may pass a reference of APVTS to your component. The constructor may look like this:
I have made a mistake (I thought plugin host can access the APVTS, but it can’t).
I have just gone through some code. It seems that the host can only access the normalized parameter, i.e., the AudioProcessorParameter. Therefore, I am afraid that you have to write your own attachment instead of using SliderAttachment (by using getCurrentValueAsText)
Just messing around in Plugin Host, this seemed promising:
auto hosted = dynamic_cast<HostedAudioProcessorParameter*>(processor->getParameters()[0]);
auto minVal = 1.0f;
auto maxVal = 10.f;
auto defVal = 5.f;
AudioParameterFloat floated {hosted->getParameterID(), hosted->getName(20), minVal, maxVal, defVal};
I’ve no idea how you decent values for min, max, default, but it seems I was able to create an AudioParameterFloat.
I also don’t know how catastrophic it would be to have 2 instances of a JUCE parameter object speaking to the plugin interface…
Basically, I’m hoping if I keep replying with bad information eventually someone will get riled up enough that they want to reply with the right information.