Bool parameters With AudioProcessorValueTreeState

Yes, absolutely. Here’s a template using lambdas for the valueToText and textToValue functions:

state.createAndAddParameter("filterModID",
                            "Filter Mod",
                            String(),
                            NormalisableRange<float> (0.0f, 1.0f, 1.0f),
                            0.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;
                                }
				            false, true, true);
7 Likes