Hello all,
In my plugin I have a choice parameter which allows the user to choose the base wave shape (sin, sawtooth etc). Now that I’ve moved onto creating the actual editor, I would like to create a custom component that is not a dropdown to allow the user to interact with the parameter.
What I want is a 2x2 grid of buttons, styled to look like pads from a drum machine/launchpad type thing. I’ve got a very rough prototype working where the buttons are provided a callback that looks something like
button.onClick = [&choiceParameter, buttonIndex](){ choiceParameter = trySetChoiceIndex(buttonIndex) };
I also have an object that is a listener to the parameter as a member of the component, who’s callback looks like
for(size_t i = 0; i < numButtons; i++){
auto& button = buttons.at(i);
if(approximatelyEqual(newValue, i)){
button.setColour(button.buttonColourId, Colours::green);
} else {
button.setColour(button.buttonColourId, Colours::transparentBlack);
}
}
This all functions fine. But I’m wondering if there’s any ways to improve the idea. It would be great if we could use the Button Parameter attachments and specify the value submitted when the button is pressed, but as far as I’m aware theres no way to do that. Has anyone done this before? Or have any ideas on a more elegant way to do what I want?