Expose AudioParameterInt/Float member functions

Many times I’m passing the strongly typed parameter (AudioParameterInt/Float/etc) by reference to other classes/functions.

However, there are extremely useful member functions that are public in the AudioProcessorParameter base class, like getValue(), setValue(), getText(), etc, but are private in the concrete implementation. That means they require an ugly cast to the base class to be accessible.

Is there a reason why those aren’t public? I would like to avoid passing by the base class pointer, because then I’ll lose functions like get() that are very helpful.

1 Like

For AudioParameterFloat and the others, you can cast to the underlying type to get the value, and just call = to set the value.


Yes, I’m aware I can achieve this with either downcasting or upcasting, I’m just not sure it’s needed in this case.

I guess these are private because of the ambiguity that setValue/getValue access the normalized/stored values (0…1) .

That’s the thing, in many situations I think you need either, or both, on the same parameter.

For example many times in a processing function, I might want to do something like:

void someProcessFunc(AudioBuffer<float>& buffer, AudioParameterInt& param)
    //The minimum normalized value means no processing at all
    if (param.getValue() > 0.f)
        //processing function needs the real world value:
        actualProcess(buffer, param.get());
1 Like