Proper usage of AudioParameterInt

I was wondering how to utilize the AudioParameterInt class.

        AudioParameterInt intParam("testInt", "IntParam", 0, 200, 100);
        int val1 = intParam.get(); // Returns 100

        intParam.setValueNotifyingHost(50);
        int val2 = intParam.get(); // Returns 200

        intParam.setValueNotifyingHost(0.25f);
        int val3 = intParam.get(); // Returns 50

In this code the value returned after calling set() is 200 because set() is expecting to be called with a scaled float value not a value between the min:0 and max:200. I don’t see this class in any of the juce example code. Obviously I can just scale the values but I would like to know what I am missing.

Update: I get that it’s meant to be used by UI components that provide values between 0 and 1. But getValue is private so I can’t get the scaled value to update the UI. I was using this class for an internal AudioProcessor not a plugin.

They are too clever with those parameter classes, they can be used like :

int val = *intparam; // gets the non normalized value
*intparam = 200; // sets non normalized value

Note that this assumes the parameters are handled as pointers (which they should be and your code does not appear to be doing it like that).

AudioParameterInt* intParam= new AudioParameterInt("testInt", "IntParam", 0, 200, 100);

Thanks for the reply. Not a fan of clever code. That was totally non-obvious, though I suppose it would have been a non-issue if I was developing a plugin. I was using a pointer in my app, that was just sample code. To be fair the = operator is documented as the way to set the value. I was just expecting a corresponding method.