[Feature Request] getRawParameterValueUnmapped

Hey All,

I’ve seen this come up in a few places, but I’m hoping to give it one more bump.

this function in the AudioProcessorValueTreeState is extremely useful:

float* AudioProcessorValueTreeState::getRawParameterValue

I use it often, however, it returns mapped values of the parameters. The issue i’m having is that I often obtain this value and then apply modulation. It’s much easier to manage modulation on a 0-1 level before applying range mappings.

What i’m having to do is first, normalize the value from that pointer, and then apply modulation, and then remap it : /

It would be great to have the option to obtain pointers to both the unmapped & mapped parameter values. To me it seems sensible that you should always be able to obtain either the mapped or unmapped value.

Thoughts?

Cheers,

J

If you need the value to be on a 0-1 scale, the easiest way would be to initialize the parameter with a NormalisableRange<float>(0.0f, 1.0f) and then set the value/text conversion lambdas to handle mapped values. A quick example for a trim parameter:

parameters.createAndAddParameter(
    "Gain",
    "Gain",
    "dB",
    NormalisableRange<float>(0.0f, 1.0f),
    1.0f,
    [](float value) { return String(Decibels::gainToDecibels(value)) + "dB"; },
    [](const String &text) { return Decibels::decibelsToGain(text.getFloatValue()); }
);

Perhaps, however ideally i’d be able to use:

AudioProcessorValueTreeState::getParameterRange(StringRef *parameterID*)const

to obtain the mapping functions in a clean manner, however that would break the pattern and I’d have to manage the true parameter normalizeableRange objects separately. : /

Perhaps I am being whiney over a few lines of code : D lol

I suppose a larger question is, with the audio graph & parameter value tree objects, how are people handing modulation?

You can call getValue() to get the normalised value :

AudioProcessorParameterWithID* param = processorValueTreeState.createAndAddParameter (...);
float normalisedValue = param->getValue();

Thanks lalala,

The pointer which is always up to date without having to make any functional calls is quite nice, but I suppose if there’s no interest this one will suffice.

: )