Page 1 of 1

Sending MIDI Notes/Events

Posted: Thu Jan 16, 2020 5:58 pm
by Ygreneb
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;
}

Re: Sending MIDI Notes/Events

Posted: Wed Jan 29, 2020 9:26 am
by Chris T
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

Re: Sending MIDI Notes/Events

Posted: Wed Jan 29, 2020 10:08 am
by Chris T
Here is a simple code that sends midi out. It works for me it seems..

viewtopic.php?f=4&t=554

Still wondering how to read a sustain pedal event..