Heyy, so I've got some buttons (IContactControl) in my GUI that currently trigger effects when clicked, and deactivate upon release. The basic code for the parameter change looks like this:
Code:
void GubGlitch::OnParamChange(int paramIdx) {
IMutexLock lock(this);
switch (paramIdx) {
case kChop_2nd:
if (GetParam(kChop_2nd)->Value()) chopper.setChopper(2.0);
else chopper.setActive(false);
break;
// other parameters etc etc
}
}
Thing is, I'm having a hell of a time trying to get these effects triggered-- and the buttons to appear pressed-- using MIDI input.
Was able to find that calling SetParameterfromGUI(kChop_2nd) does trigger the effect... but if I just throw it in ProcessDoubleReplacing() it gets called every frame and thus doesn't work as intended (since it's a rhythmic effect). Additionally, the button itself doesn't appear pressed when I trigger the parameter directly like this, so I'm not sure what to do in that regard.
To make matters more complex, I have a separate .h/.cpp file for handling MIDI. I'd like to trigger the effect from there, but I can't call either SetParameterFromGUI() or the direct effect, chopper.setChopper() since they're part of the main cpp file. Optimally I'd like to be able to call it from the NoteOn/NoteOff messages I'm processing in my MIDI queue, since those are only fired once per key press as opposed to every frame it's held down, but for the life of me I cannot figure out how.