Property kAudioUnitProperty_ParameterStringFromValue requests zero length

Hi JUCE team (and others that might see this issue),

Using the built-in AudioParameteFloat class resuls in values not being shown in automation curves in Logic X at least. The values aren't shown in the generic "Controls" version of the UI in Logic either.

Tested using the GainPlugin example.



In the AU warpper the getter for kAudioUnitProperty_ParameterStringFromValue in GetProperty() requests a zero length string:


case kAudioUnitProperty_ParameterStringFromValue:
    if (AudioUnitParameterStringFromValue* pv = (AudioUnitParameterStringFromValue*) outData)
        if (juceFilter != nullptr)
            const float value = (float) *(pv->inValue);
            String text;

            if (AudioProcessorParameter* param = juceFilter->getParameters() [(int) pv->inParamID])
                text = param->getText ((float) *(pv->inValue), 0);  /// <<< here
                text = String (value);

            pv->outString = text.toCFString();
            return noErr;


And in AudioParameteFloat this results in an empty string due to String::substring (0,0) being called


String AudioParameterFloat::getText (float v, int length) const          { return String (range.convertFrom0to1 (v), 2).substring (0, length); }


Should the wrapper be calling with a length > 0 or perhpas the parameter not calling String::substring() if the requested length is zero?



Hi Martin,

Thank you for spotting this. That is in deed very strange. It seems also that Jules intended to get rid of the length parameter as it is commented out in juce_AudioProcessorParameter.h. Additionally the parameter is only used in AudioParameterFloat. AudioParameterInt, AudioParameterBool and AudioParameterChoice seem to be ignoring it. I'll ask Jules to clarify.


Thanks guys - the length is intended as a hint from the host to allow the plugin to return shorter strings for displaying in places like hardware controller displays, etc. I didn't realise it could be zero, I'll tweak the code so that it handles that.