Update text on changed value in audio processor

Hi there,

I’m trying to create a basic plugin that displays the peak frequency of a signal as text. I’m not sure how to implement the update of the displayed text. In my current version, I don’t use any types of callbacks, which causes the plugin to only update values during loading.

My original thought was to use an AudioProcessorValueTreeState parmeter that is updated by the processor and linked to a juce::Label. Unfortunately, I’m now a little puzzled on how to connect the Label to the ValueTree, since there is no such thing as a LabelAttachment.

What would be the standard procedure to implement this behavior (AudioProcessor sets value for text)?

All topics I found that seemed similar to this were describing how to do it the other way 'round (Text/Slider/Button sets value for audioProcessor).

thanks in advance!

in the PluginProcessor did the trick.

I know this is an old post, but if you’re still working on this project, I would suggest using some kind of lock-free queue to communicate from the processor to the editor. You definitely don’t want to be calling any of the editor’s methods from the processor, and especially not on the audio thread.

The basic layout I would suggest is this:

  • Your processor should have some kind of FIFO object as a public member.
  • In your processBlock(), if you want to update the label value, push() a message into your FIFO
  • In the editor’s paint() or timerCallback(), check to see if the FIFO has any available messages, and if it does, perform necessary actions for each

Here’s my basic implementation of a message FIFO. There are many others available:

@benvining thanks for the suggestion and explanation! I’ll probably work that in some time!