Setting exact parameters value in a host (e.g. 440 Hz, not 0.0197)

Hey! I’m writing a plugin host using JUCE, currently focusing on AUv2 plugins, using juce_audio_processors_headless. In my custom UI I’d like to show plugin parameters, to allow users to edit them. Ideally, users should have some custom elements (e.g. sliders) for plugins, but also allow to enter values explicitly, as text.

I faced a few issues with this. Let’s say you have a frequency parameter, in Hz. For this parameter, I’d like to use log scale on a slider, and I’d like user to be able to enter exact Hz value (442 is not the same as 400).

But all values exposed are in [0,1] range, AND host doesn’t know min and max values, I can’t find any public API to access it (what I do is dynamic_cast to HostedAudioProcessorParameter). It seems there is no good way to convert 440 to [0,1] range, using plugin parameter specific logic. There are also some ancient topics on forum, like How get range of parameter from host? .

There is also getValueForText("440") API, but it requires kAudioUnitParameterFlag_ValuesHaveStrings, and none of Apple built-in plugins do it. And as a fallback, it just returns 440.0, which is wrong. It’s also a weird API for this use case.

It seems it’d be best to have the parameters readable as NormalisableRange, so that I can receive 440, then call param.convertTo0to1(440.0f) , and set this value to plugin.

I have an internal fix for this, for AUv2 (AU: Expose a hosted parameter's range in the plugin's own units · kmike/JUCE@8fc55fe · GitHub) - JUCE already has all this informtion, it’s just not exposed. But I wonder if there is a known workaround. If not, should I open a feature request for it? Of course, it’s possible to just use JUCE fork, but it’d be great to have upstream solution.

1 Like