ButtonAttachment questions


#1

AudioProcessorValueTreeState::ButtonAttachment's documentation says:
“During the lifetime of this SliderAttachment object”.
That’s probably a typo/pasto?

Also, wouldn’t button.getToggleStateValue().referTo (state.getParameterAsValue (paramId)) work? Why is the button attachment class needed?


#2

Hi yairadix,

Thanks for the heads up, the documentation is fixed in develop now.

Ed


#3

Cool, and do you have any insight on my second question:

Why is the button attachment class needed?
Wouldn’t just button.getToggleStateValue().referTo (state.getParameterAsValue (paramId)) work?


#4

That would work, yeah. The ButtonAttachment and ComboBoxAttachment classes are more there for continuity with the SliderAttachment class, which adds some functionality for gesture detection when changing audio parameters with a slider that isn’t possible using the Value::referTo() method.

Hope that answers your question,

Ed


#5

But it looks like unlike the slider attachment, the button and combo-box ones do not set the parameter gestures.

I don’t know if JUCE agrees with the Zen of Python’s “There should be one - and preferably only one - obvious way to do it”, but redundant classes/code are a pet peeve of mine…


#6

It would be good if the ButtonAttachment and ComboBoxAttachment classes did register the gesture start and end. Otherwise these changes can’t be recorded as automation (in some hosts).


#7

Thanks for the suggestion Martin, I’ve added those changes to the develop branch.

Ed


#8

Just a quick heads-up that this fails if more than one ComboBox or Button is attached to the same parameter since they both do a begin gesture then their end gesture (resulting in an assertion in a debug build).