Sending MIDI Notes/Events

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;
}

Hey Ygreneb,

I am interested in sending midi notes as well. Have you found a solution? I was able to build a simple synth out of the Adelay example. So I can handle audio IO and midi in by now. I am having a hard time with the documentation. Is there a list of instructions somewhere? Also I am trying to read the sustain pedal. What event type would that be and where is this documented?

Thanks for your help.
Chris

Here is a simple code that sends midi out. It works for me it seems…

Still wondering how to read a sustain pedal event…