[Old bug-already fixed] SliderAttachment doesn't update when text is edited

If you use the AudioProcessorValueTreeState parameters and the SliderAttachment, the updates from the textbox are not properly propagated:

Type in the textbox and hit either enter or tab -> the slider is updated properly
Close the PluginEditor and open again -> the slider is back to the old value

The Juce Demo Plugin doesn’t suffer of that, because it implements the the slider and textbox callbacks manually.

I verified that with Logic and ProTools (12.4).
Built with the latest develop of this morning

Can you reproduce this with the tutorial code: https://www.juce.com/doc/tutorial_audio_processor_value_tree_state ?

I’ve just had a go and I don’t see the same. When the slider is updated, does the parameter value change alongside the GUI?

I double checked, my code is identical to the tutorial, except for the getStateInformation and setStateInformation, here I use

void FSCompressorProcessor::getStateInformation (MemoryBlock& destData)
    MemoryOutputStream stream(destData, false);
    treeState.state.writeToStream (stream);
void FSCompressorProcessor::setStateInformation (const void* data, int sizeInBytes)
    ValueTree tree = ValueTree::readFromData (data, sizeInBytes);
    if (tree.isValid() && tree.hasType ("MyPlugin")) {
        treeState.state = tree;

That shouldn’t make a difference.
Next I checked was the workflow with the edit window open, so I could see the automation line jump, and suddenly it worked.
But when I try it more often, it fails several times. So it is a non deterministic bug :frowning:

But it happens more than every second time for me, I try to do a video of it.

If I open the editor and head stright away to the textbox, enter a number and hit tab key, only the slider is updated. The automation line in the background doesn’t move.

After I move the editor or touch any slider, it works as expected. You can see the automation line in the background moving as well.

Here is a video:

I have nothing fancy in my code, only two timers for repainting the level meters. If needed I can PM the code, but the GUI part is really minimal, and the parameter setup is identical to the tutorial.

1 Like

Do you see the same behaviour if you use the AudioProcessorValueTreeState tutorial code without any modification? It’s working fine for me, so testing exactly the same code on your side would help narrow down the problem.

Ok, I’ll be happy to try…
Can I download the project as zip file or do I have to copy the text bits out of the webpage?
I didn’t see a download link…

It’s on there: https://www.juce.com/doc/projects/tutorial_audio_processor_value_tree_state.zip

I’m using the develop tip.

So do I…

So far it works. I am trying to add the possible things, that are different:
I added a second dummy slider, so that tab sequence is the same, but it still works.
I added gainSlider.setTaxtValueSuffix (" dB"); it still works.
…will keep trying…

It’s really strange, because it is really only createAndAddParameter and creating a SliderAttachment.
“What possibly could go wrong…?”

Sorry @t0m, I realised, I am not using the latest tip. I accidently referenced an old copy of the modules.
Now I tried again with the latest tip, and all works fine.
Sorry again for wasting your time and thanks for testing with me.