Text Parameter

Hi, completely new here, completely new to Juce, completely new to C++, completely new to VST development, so please by kind with me :blush:. Thank you.

I searched and tried out several tutorials, but cannot find any solution for a particular requirement:
I need the plugin to have a text editor and a text parameter representing the text editor value.

I found a way that an editor saves its value into a valueTreeState:

textEditor.getTextValue().referTo(valueTreeState.state.getPropertyAsValue("noteText", nullptr));
textEditor.onTextChange = [&] {
           valueTreeState.state.setProperty("noteText", textEditor.getTextValue(), nullptr);    };

But now I don’t know how to implement any mechanism to inform the host that the text has changed and user should save the DAW project.

Thank you in advance for pointing me somewhere.

You can store anything in your getStateInformation()/setStateInformation().
Only to have parameters automated you need the AudioProcessorParameter classes.
A string is not very useful for several reasons:

  • the host automation is not able to use strings
  • strings are not easily exchanged in a thread safe way

If you need text to change via automation, you should create a dictionary mapping an integer value to strings. But ideally have all in numbers and only display a text derived from the number in the GUI.

Hope that helps

If you are lucky, the updateHostDisplay method will inform the host that the plugin’s state has changed, so it can store the change in its undo history and mark the host project dirty to be saved. However, it’s been often found updateHostDisplay does not actually work in various hosts.

This of course won’t work for things like user browsed file names, formulas/script code, comments etc entered by the user. Seems like the original poster was asking about a thing like that.

Yes, exactly. I implement a plugin cappable of saving track info, so absolutely user-custom text.

And how does the plugin-host communication work in case of parameters?
How does AudioProcessorValueTreeState - or who / what exactly - inform the DAW that something has changed?

Maybe I’ll need to dive into juce objects code.

The wrapper (plugin API abstraction) is an AudioProcessorListener.
When a parameter is changed, the audioProcessorParameterChanged() callback is called and the wrapper communicates that to the host.
Same for updateHostDisplay() which calls audioProcessorChanged() with the appropriate ChangeDetails flags.

Try first if updateHostDisplay() works for you, it did for me, but I know there were reports that some hosts didn’t respond to updateHostDisplay(), so people added fake parameters to trigger the change.