AudioProcessorValueTreeState Parameter Text Conversion Still Not Working


#1

Just as a preface: I have looked for several days through similar forum posts about this issue, and none of the answers solved my issue. No matter what I do I cannot get my host (Ableton) to display automation values as anything other than the default floating point with a range of 0.0f to 1.0f. I would really ideally want to change my togglebutton parameters to be either binary “On”/“Off” strings since it would be confusing for a user to have a continuous automation envelope for a binary switch.

I’ve tried numerous ways of writing to parameter text conversion functions, all to no avail. I’ve tried using lambdas (I am building with C++ 11, so that should work). I have tried writing the functions as class methods of my PluginProcessor, and I have tried writing them as static functions. No matter what I do, my host only displays the parameters on the automation envelope as being between 0 and 1. I have tested this both with the VST I created as well as the AU and neither seem to behave properly.

Just in case this helps, here is an example of my code within my PluginProcessor constructor. The below parameter is controlled by a ToggleButton.

parameters.createAndAddParameter("randomParamID", "Random", String(),
                                 NormalisableRange<float> (0.0f, 1.0f, 1.0f), 0.0f,
                                 [](float v) -> String { return v < 0.5f ? "Off" : "On";},
                                 [](const String& s) -> float { if (s == "Off"){return 0.0f;} if(s =="On"){return 1.0f;}return 0.0f;} );

Any thoughts would be highly appreciated!


#2

Here are a bunch of variations of parameter types that I use in my plugin. I don’t know about Ableton, but I know these work in Logic and others. Hope this helps.

// integer - 3 values [0, 1, 2]
parms.createAndAddParameter("toneID",
                            "Tone",
                            String(),
                            NormalisableRange<float> (0.0f, 2.0f, 1.0f),
                            1.0f,
                            [](float value)
                            {
                                if(value == 0.0f) return "Dark";
                                if(value == 1.0f) return "Normal";
                                if(value == 2.0f) return "Bright";
                                return "";
                            },
                            [](const String& text)
                            {
                                if(text == "Dark") return 0.0f;
                                if(text == "Normal") return 1.0f;
                                if(text == "Bright") return 2.0f;
                                return 0.0f;
                            });

// boolean - 2 values [0, 1]
parms.createAndAddParameter("syncID",
                            "Sync",
                            String(),
                            NormalisableRange<float> (0.0f, 1.0f, 1.0f),
                            1.0f,
                            [](float value)
                            {
                                return value < 0.5 ? "Off" : "On";
                            },
                            [](const String& text)
                            {
                                if (text == "Off") return 0.0f;
                                if (text == "On") return 1.0f;
                                return 0.0f;
                            });

// float - [0, 100]
parms.createAndAddParameter("glideID",
                            "Glide",
                            String(),
                            NormalisableRange<float> (0.0f, 1.0f),
                            0.0f,
                            [](float value)
                            {
                                return String(value * 100.f, 1);
                            },
                            [](const String& text)
                            {
                                return text.getFloatValue() / 100.0f;
                            });

// float - [-12, 12]
parms.createAndAddParameter("tuningID",
                            "Tuning",
                            String(),
                            NormalisableRange<float> (-12.0f, 12.0f),
                            0.0f,
                            [](float value)
                            {
                                value = ((int)(value * 24.0f) - 12.0f);
                                if(value > 0.0f)
                                    return String("+") + String(value, 1);
                                return String(value, 1);
                            },
                            [](const String& text)
                            {
                                return (text.getFloatValue() + 12.0f) / 24.f;
                            });

AudioProcessorValueTreeState and parameter range
#3

Thanks for the quick reply! I using your boolean text-to-value and value-to-text functions exactly as you had written them, but still no luck. Should I be worried if my PluginEditor implements Button::Listener or if it implements Timer? I’m leaning towards this issue being a side-effect of Ableton, but I find that a bit hard to believe.


#4

Are there other plug-ins which display non floating point automation values?


#5

Ableton Live is my main testing platform, and as far as I’ve seen:

  • the values in the plugin “UI-less” view are correctly translated using the valuetotext juce lambda
  • the values in the automation lane seem to be 0.0–>1.0 always and forever…tested with lot of plugins…but wait a minute : tried with a very recent plugin I just got (https://www.surrealmachines.com, plugin name is DIFFUSE) and that shows %, Hz etc correctly in the automation lane! get a demo and try it for yourself.

Definitely planning to ask these guys what framework they are using :slight_smile:


#6

Yeah, I’ve seen it on most plugins that have a binary switch. They only allow automation envelopes draw at either a value of “on” or “off”.


#7

Without looking at it, but can it be that VST2 is able to only translate the current value to text, while for example VST3 has support for translating other values, so it’s possible to translate values in the automation lane