I’m trying out the AudioProcessorParameter system of classes. I want to make a DecibelParameter class, such that on change of the (linear) value in decibels (say a range of -36 to +6) is processed only once into the float ‘gain’ that can be used in multiplication. So I figured I would derive from AudioProcessorFloat, and just override setValue to also do that computation, and add a getGainValue method that always just directly returns the ‘internal’ gain value.
Calling the parent’s setValue is illegal in this case, since it’s also private. I see the following solutions;
- derive from
AudioProcessorParameterinstead and copy most ofAudioProcessorFloat - edit juce class to have
setValueandvalueprotected - have
getGainValueusegetValueinstead, doing log computation every call (ie at least once every block)
The cons for the 3 solutions are in my opinion well clear. I’m curious if anybody here can think of a better solution. Maybe I’m thinking the wrong way about it, and the gain value should not be stored in the Parameter, but more internally to the processor. Then still, can I find a way to notify my processor, and through aUIUpdateFlagmechanism the GUI? Obviously I want the slider to show the decibel value, not the computed gain value.
