Hello, I am trying to make a mid/side plugin where I have a combobox I’ve created within a treestate and I’m trying to get the values for the process block so that I can do a certain process if selection 1 or 2 are made in the combobox but I don’t know how to get the index values to use in an if statement for the processblock.
I am not answering your question, but it is best practice to not rely on the index (in case the order of your menu changes), but instead use the Id value (these start at 1, not 0) that you set when adding the item to the menu. Make these a set of constants.
Instead of getting the combo box value/index/ID value directly, I’d recommend creating some kind of parameter in your processor that can be linked to the ComboBox – probably either an AudioParameterInt or AudioParameterChoice.
Then use a ComboboxAttachment to link the GUI component to the processor parameter.
@benvining got there more quickly than me, but if you’re using the AudioProcessorValueTreeState, and you’ve attached the combo box using a ComboBoxAttachment, you can retrieve the parameter’s value using
Yeah was trying to refer to those, still really new to Juce so not all there with the names for everything
I have set it with an AudioParameterChoice, I thought I had to somehow get the values back by using the parameterChanged function but didnt know how
Would I do that by using the variable Ive created on the editor.cpp to read the values of the box?
It may help you to take a look at SourceControl/Tools/JUCE/examples/Plugins/AudioPluginDemo.h.
I havent been able to deduct much from that example but watching a video tutorial that explained the valuetree functions I got that I needed to reference my AudioProcessorValueTreeState name (treeState) in the processblock with the getRawParameterValue, and have implemented it the way that it was shown but now I get an error (code C2280) saying I cant get a reference to the atomic float,
the code I have put in is:
auto InputMode = *treeState.getRawParameterValue (“inputmode”);
and its the * that gives me the error.
inputmode is the name of the AudioParameterChoice function