Sending MIDI Notes/Events

SDK for VST 3 audio plug-in and host development.
Post Reply
Ygreneb
Posts: 4
Joined: Wed Jan 15, 2020 10:21 am

Sending MIDI Notes/Events

Post by Ygreneb » Thu Jan 16, 2020 5:58 pm

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?

Code: Select all

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

Post Reply