MidiVid Home 

Developing Plugins

At its core, MidiVid GPU is a system that triggers plugin functions when MIDI events are received. All of the effects that ship within the MidiVid package are actually written using the same plugin API that external plugins use.

MidiVid uses two different kinds of plugins. A source plugin (MVSourcePlug) is one that provides data to be displayed (or heard). The Framebuffer Loopback source is an example of a source plugin. An effect plugin (MVPlug) is one that can be assigned to a note in a patch, and is triggered by MIDI events. It usually takes data from a source and displays or manipulates it in some way, like the Display Source plugin, though some effect plugins don't display anything visible, like the SSC Robotics plugins.

Each of the two plugin types has a Descriptor Class that tells MidiVid about it. Source plugins use the MVSourcePlugDesc class, and effect plugins use the MVPlugDesc class.

Writing your first plugin

There are a few things to do before you get to the fun stuff. Figure out which classes you need to implement by deciding what type of plugin you'll be writing, then set up a project to contain it.

In order to simplify this process, there's a sample plugin project included in the SDK, called "Sample Plugin". The sample plugin project was created using Visual Studio .NET 2003, and is a complete working plugin, illustrating how to interface with MidiVid. It also demonstrates the use of basic vertex and pixel shaders to do color keying. Using this project as a template when creating new plugins will greatly speed development.

Choose a plugin type

The first thing you need to do is decide what type of plugin you want to write. If you are creating a plugin to read data from a file, or simply provide data for other plugins to manipulate, you'll need to implement an MVSourcePlugDesc object to describe your plugin, and an MVSourcePlug object that implements your plugin functionality. If you are creating a plugin to assign to a MIDI note, you'll need to implement an MVPlugDesc object to describe the plugin, and an MVPlug object that implements your effect.

Creating a DLL project

Now you'll need to create a project to contain your plugin. MidiVid uses standard Windows DLL files to contain its plugins. MidiVid GPU was created with Microsoft Visual C++ .NET 2003, and the DirectX 9.0c (Summer 2004) SDK. This is the reccommended environment for creating plugins, though others should work.

Your DLL project should be set up with the following options:

You will also need to implement and export three functions from your DLL:

The first two functions are pretty easy - Since this is your first plugin, you'll only have one plugin to export at the moment, and the other function simply returns the MVP_Header_Version constant, so MidiVid knows which version this plugin was compiled for.

The first two functions will therefore look like this:

MVExport long mvpGetVersion(void)
{
    return MVP_Header_Version;
}

MVExport long mvpGetNumPlugs(void)
{
    return 1;
}

Next step: The Basics


MidiVid GPU Version 1.0
Copyright (c) 2005 Jason Dorie and VUTAG
Generated on: Sun Jan 25 23:45:41 2009