Idea Of Vst Plugin Sending Midi Commands

Hi,

I started working on my first VST plugin and for now its compiling (under the Linux at least), showing in Renoise plugin list and even loading and showing simple gui. And it was pretty easy.

But with rest I need a bit help ;) Few words introduction - I always missed very nice “glitch” plugin by VST under the Linux. So I decided to write something similar, but using native Renoise effect. The first thing which comes to me mind - write a sequencer ala glitch (in terms of user interface) and send from it midi commands to internal effects in renoise. In that way I will be able automatise few effects at once (more than one output from plugin and also hydra device) and draw automatisation for longer parts than pattern.

So, my qustion is - how I can receive midi commands from inside plugin?

Cheers