Page 1 of 1

Audio-IN, MIDI-OUT

Posted: Mon May 07, 2018 4:42 am
by iriyama
Hello.
I'd like to make a VST3 Plugin which has "Audio-IN" and "MIDI-OUT".
I'm trying ;
(1) Base on "ADelay" example (in VST3-SDK 3.6.9) for "Audio-IN".
(2) Changing IDs in "adelayids.h".
(3) Adding APIs for "MIDI-OUT".
(3-1) addEventOutput() on "Processor::initialize".
(3-2) ...(?)

I couldn't find any APIs for writing "MIDI-OUT" in process().
# for example "NOTE-ON (0x90 0x40 0x7F)"

Re: Audio-IN, MIDI-OUT

Posted: Mon May 07, 2018 9:34 am
by Arne Scheffler
Hi,
in your process function you get ProcessData which has the optional member outputEvents which is a IEventList. This can be used to add events like note on and off.

Cheers,
Arne

Re: Audio-IN, MIDI-OUT

Posted: Tue May 08, 2018 9:19 am
by iriyama
Thanks!
I'll try. ;)

Re: Audio-IN, MIDI-OUT

Posted: Wed May 30, 2018 7:51 am
by iriyama
I wrote a code with "IEventList".
And, it works. Thanks.

It isn't perfect but I wrote is;

Code: Select all

//-----------------------
//   processor.cpp
//-----------------------

//.....

//(added)
#include "pluginterfaces/vst/ivstevents.h"

//.....

tresult PLUGIN_API Utnspl41Processor::process (ProcessData& data)

//.....

	//note-on (added)
	if (true) {
		// --- get the event list for output
		IEventList*  mylist = data.outputEvents;
		if (mylist)
		{
			Event midiEvent = { 0 };
			midiEvent.busIndex = 0;
			midiEvent.sampleOffset = 0; // location
			midiEvent.type = Event::kNoteOnEvent;

			// --- set the channel/note/vel
			midiEvent.noteOn.channel = 0;

			midiEvent.noteOn.pitch = 60; // MIDI note nume
			midiEvent.noteOn.velocity = 0.40; // VEL=50; in velocity [0,1]
			midiEvent.noteOn.noteId = 60;

			mylist->addEvent(midiEvent);
		}
	}

//.....