Shouldn't AudioParameterInt::isDiscrete() return true?

isDiscrete() is described as “Returns whether the parameter uses discrete values…” and integers, by definition, are discrete values, so shouldn’t AudioParameterInt::isDiscrete() return true? It doesn’t.

Could you provide an example? Been using it without any trouble so far.

What do you mean by example? It’s just wrong. Currently it’s semantically more like isNumber.

I think it is good to leave it configurable.

The isDiscrete() flag is used to signal to a host if it can ramp over the values.

AudioParameterBool sets it true, because ramping makes no sense.
AudioParameterChoice sets it, because if you have 5 choices you usually don’t want to ramp through the values.

For int there is no definite choice, in some use cases it makes sense to ramp over the int values, and sometimes it doesn’t.

You should be able to set it in the latest develop using the RangedAudioParameterAttributes i.e. AudioParameterIntAttributes(), but I am missing the withDiscreteFlag()…
I don’t know if it was a deliberate omission.

1 Like

It’s not configurable. That’s part of the problem. There is no flag. isDiscrete() is a function inherited directly from the base class; the base implementation always returns false. The only way (that I know of) to alter this behavior is to subclass AudioParameterInt, which is what I did, but I still maintain that it’s wrong. You are correct that it should be configurable, at the very least.

I prefer not to use the development branch for products; there’s no need to create any more moving targets for myself than necessary. :slight_smile:

Also, the docs for isDiscrete() say “This information may or may not be used, depending on the host.” This is somewhat misleading because AudioProcessorParameter::getAllValueStrings() calls it. This is how we bumped into the problem; getAllValueStrings() calls isDiscrete(). If false is returned, getAllValueStrings() returns an empty array. We were puzzled that we were ending up with an empty array even though the AudioParameterInt in question does generate value strings correctly.

maybe personal preference, but i think only bool params should be steppy. everything else should be handled non-discrete. you might not be able to ramp through choices in terms of sound, but workflow-wise ramping through choices would still enable you to go through all choices in a specific amount of time with only 2 automation points (or even only one in case of bezier).