I want to develop a plugin that filters & modifies incoming MIDI events (not CC events) and forwards them afterwards. For the first step I focus on the forwarding part only. In my code below I receive events over the input bus and try to send copies of them on the output bus, but this doesn’t work. I can confirm that the incoming events are received, but every instrument connected to the output bus won’t receive events. Does anybody know a reason and/or solution for this?
tresult PLUGIN_API PlugProcessor::initialize (FUnknown* context)
{
// ...
addEventInput(STR16("Event In"), 1);
addEventOutput(STR16("Event Out"), 1);
return kResultTrue;
}
tresult PLUGIN_API PlugProcessor::process (Vst::ProcessData& data)
{
// ...
if (data.inputEvents && data.outputEvents)
{
int32 eventCount = data.inputEvents->getEventCount();
Vst::Event in, out;
for (int32 i = 0; i < eventCount; ++i)
{
data.inputEvents->getEvent(i, in);
std::memcpy(&out, &in, sizeof(Vst::Event));
data.outputEvents->addEvent(out);
}
}
return kResultOk;
}