The Problem:
The documentation of AudioProcessorParameter::isDiscrete()
states:
/** Returns whether the parameter uses discrete values, based on the result of
getNumSteps, or allows the host to select values continuously. */
Source: juce_AudioProcessorParameter.h:179
However the implementationdoesn’t do that:
bool AudioProcessorParameter::isDiscrete() const { return false; }
Source: juce_AudioProcessor.cpp:1600
Also neither AudioParameterInt, AudioParameterFloat nor RangedAudioParameter override this method. It’s currently only overriden for AudioParameterBool and AudioParameterChoice.
The Solution ?:
Now it would be easy enough to change the implementation to:
bool AudioProcessorParameter::isDiscrete() const { return getNumSteps() != AudioProcessor::getDefaultNumParameterSteps(); }
or
bool AudioProcessorParameter::isDiscrete() const { return getNumSteps() < 100 /*or whatever*/ ; }
So that it actually matches the documentation.
The Question:
This brings to mind the following quote:
When code and comments disagree, both are probably wrong.
– Norm Schryer
So which one is correct? The comment, the code or neither? What’s the all-DAW proof solution ?
Thanks!