AudioProcessorValueTreeState::SliderAttachment removes parameter from host?


#1

I’ve got a plugin for which I’m playing with translating the connection between GUI elements and the processor params to AudioProcessorValueTreeState::SliderAttachment objects. Everything works great, except that when I create the SliderAttachment, it removes the associated parameter from the list of Controls in Logic (the only host I’ve got available to test AU with), as well as the list of automate-able parameters.

Is this intentional? If so, what can I do to work around this? It seems that I’d need to implement AudioProcessorValueTreeState::Listener for my editor class and perform the updates this way, but that totally removes the convenience of the SliderAttachment class…

Any thoughts/advice would be greatly appreciated!


#2

Works over here, so it’s probably something on your end! The listener I believe should go in your Processor class, and not the editor? Maybe that’s it?


#3

Well, this is embarassing.

I should have walked my code better before I started to blame things.

When I went to implement the SliderAttachments, I had the sense to move all of my parameter IDs to #define statements, but in my tired state I accidentally made 2 macros point to the same string, like so:

// inside the AudioProcessor constructor

c1x = params.createAndAddParameter(CONTROL_POINT_1X, "Control 1 X", "X", zeroToOneByThousandths, 0.0, nullptr, nullptr);
c2x = params.createAndAddParameter(CONTROL_POINT_1Y, "Control 1 Y", "Y", zeroToOneByThousandths, 0.0, nullptr, nullptr);
/* etc, etc... */

// where my #defines were...
#define CONTROL_POINT_1X "ctrl_y1" // same as below, should be 'ctrl_x1'
#define CONTROL_POINT_1Y "ctrl_y1"
#define CONTROL_POINT_2X "ctrl_x2"
/* etc, etc... */

I ended up adding more than one parameter with the same ID to the AudioProcessorValueTreeState object. Referencing them for binding to a SliderAttachment returned the parameter I meant to create as CONTROL_POINT_1X (probably because it was the first with the given ID encountered), but the host only saw one parameter with ID "ctrl_y1" and so I only saw "Control 1 Y" in the host parameters.

Very silly of me, and entirely my fault.