void myplugin::ProcessMidiMsg(const IMidiMsg& msg)
{
int status = msg.StatusMsg();
IMidiMsg trns;
switch (status)
{
case IMidiMsg::kNoteOn:
SendControlValueFromDelegate(1, msg.NoteNumber()); // or SMMFD
break;
...
...
handle:
SendMidiMsg(trns);
SendControlValueFromDelegate(1, msg.NoteNumber()); // or SMMFD
}
Both codes won’t work as I expected.
Will calling functions inside ProcessMidiMsg be ignored?
You shouldn’t do this because ProcessMidiMsg() is called on the realtime thread. That being said, not sure why you wouldn’t see anything happening.
The IPlugControls example has something that should help…
{
GetUI()->GetControlWithTag(kCtrlTagBlueLED)->As<ILEDControl>()->TriggerWithDecay(1000);
}
void IPlugControls::OnMidiMsgUI(const IMidiMsg& msg)
{
if(GetUI())
{
switch (msg.StatusMsg()) {
case iplug::IMidiMsg::kNoteOn:
FlashBlueLED();
break;
default:
break;
}
}
}
void IPlugControls::OnUIClose()
{
// store the background pattern. No modifications to other controls are stored, and this would also need to be serialized in plugin state, for recall!
Thanks for your replying.
UI updating should be happened real time for accuracy.
But sending message inside a function that called from ProcessMidiMsg() won’t work.
So, I’ll consider another approach.
Thanks.
The “realtime” thread is the high priority audio thread. OnMidiMsgUI() is a method you can override to do something (in realtime) but on the main thread
1 Like
Thank you very much olilarkin!!
That is simple and working like a charm!
Now the problems was solved.