When is textToValue function really used?


#1

Hi,

This probably sounds stupid, but I can’t really figure out when the textToValue function declared with createAndAddParameter() is supposed to be used. The valueToText direction seems obvious so the host can display a readable and meaningful representation of a normalized value, but when does the other way happen? Would the host actually send a string back to the plugin? And why?

Until now, I’ve been writing those required bijective functions, but some enlightenment about one of the two would be intellectually satisfying :smiley:

Thanks!


#2

This question is not stupid at all, since there are also inconsistencies amongst hosts.

It is meant to be called, whenever the host displays the value. Most notably on the automation lane. They might, if they offer a generic editor (like Logic). They don’t use the function in your AudioProcessorEditor, there you need to take care of the conversion yourself (e.g. in the slider class).

But I noticed, that FinalCut e.g. seems not to call it, even though the same code does work in Logic…

HTH


#3

@daniel I think you’re thinking about the valueToText function. @sigmate is talking about the reverse. Is there a host that allows you to enter a string, so this function might get called to translate it back?


#4

Ah sorry, I always think of them in pairs…
Good question, I don’t know…


#5

Could be useful for own controls


#6

Ok, after further investigation (digging into JUCE source code, AU/VST SDK documentation, forums, etc) it seems that text-to-value functions are used when the host provides the user the ability to enter a value by manually typing it. Cubase/Nuendo seem(ed?) to allow that (haven’t used any of the two for years). Of course, in this case, it seems obvious that the plugin has to use its own logic to check if the user input is correct and can be mapped to a normalized value.

I couldn’t find any other use case.