Hello,
I’m a beginner at module development. I’ve successfully taken the PLAY module by Clément Foulc and added some new inputs and added some functionality. The PLAY module uses Next and Previous buttons to select the active sample slot. I’d like to change how that works. I’d like to have the following:
- Three LEDBezelLights (green), similar to the Fundamental/Mute module. Clicking on one of the three lights selects the corresponding sample slot (0,1, or 2). They’ll act like radio buttons in HTML.
What I’ve got done so far looks like this:
enum ParamIds {
PREV_PARAM,
NEXT_PARAM,
LSPEED_PARAM,
SAMPLE_SELECT_PARAM,
NUM_PARAMS
};
enum LightIds {
SAMPLE_SELECT_LIGHT,
NUM_LIGHTS
};
// Later in the code...
// You might notice that I haven't created my 3 lights yet. I started with just one light, and since it's not responding to mouse clicks, I'm trying to get that working before adding the additional two lights.
addParam(createParam<LEDBezel>(Vec(52, 69), module, Bsampler::SAMPLE_SELECT_PARAM));
addChild(createLight<LEDBezelLight<GreenLight>>(Vec(53, 70), module, Bsampler::SAMPLE_SELECT_LIGHT));
This is very similar to what the Mutes module does. That’s where I start getting confused. In the Mutes module, these lines of code appear to be responsible for handling the mouse-click event on the mute buttons:
if (muteTrigger[i].process(params[MUTE_PARAM + i].getValue() > 0.f))
state[i] ^= true;
In English, this appears to be saying, “Hey muteTrigger input, please check the value of the mute parameter and if it’s ON, then toggle the mute status.”
This is really strange to me and I’m pretty confused. What is the muteTrigger[i].process(…) doing? Where is the code that looks for a mouse click? What if I don’t have a CV input that corresponds to the parameter?
Let me rephrase my question, just in case my description above is confusing. I’d like to have a radio button group with three buttons that respond to mouse clicks. That’s basically it!
Thanks! Bret