Updating GP widgets from JUCE plugin state change

I’m developing a looper plugin in JUCE. Its state can change from internal processes, not just widget clicks. For example, in PLAY mode, clicking the ONCE button will stop playback at the end of the loop. So its state changes from PLAYING to STOPPED. Currently in this scenario, the connected GP widgets will not update from this change. I am looking into making this work. From what I can tell, I need to use the JUCE function setValueNotifyingHost() to send a signal to GP to update its widgets.

My question is aimed at JUCE-knowledgeable folks: is this all that’s necessary? Is GP set up to listen to this signal and update itself? Is there a better way, a JUCEier way that works with GP?

If it works in GP is there a good chance it will work in other DAWs? I also use Studio One.

Lastly, does that same function also send the change to MIDI controllers, so they can update their state?

Thanks in advance for any guidance!

Yes, as long as you have defined your host automation parameters properly, that’s all you should need to do. And that will work with other DAWs.

setValueNotifyingHost() has nothing to do with MIDI controllers.

1 Like

that’s all you should need to do

I found that I had to wrap setValueNotifyingHost() with beginChangeGesture() / endChangeGesture() to get it to work. After that, it all works as expected!

You can use attachments to link gui elements and parameters. Then all that is done automagically.

I had that at one point in development but it didn’t work at the time. I’ve been through several iterations at this point so I’ll definitely revisit it in a refactor.