VST Code Generator
Introduction
The following is a set of instructions that describe how to setup a free development environment for building VST plugins and how to generate the framework code for a new plugin using my DevExtra code generator.
Primarily these instructions apply to Microsoft's free Visual C++ Express, though similar steps can be used for Visual Studio 2005. I've also included some notes on using the open source MinGW/MSYS as an alternative development environment.
I've tested these instructions on a clean installation of Windows XP and even inexperienced developers should be able to get this up and running without too much trouble. If you encounter problems, please Contact Me
Installing Tools and SDKs
These are the tools and software development kits (SDKs) you're going to need if you want to use Visual C++ Express. Feel free to change installation folders but note that the rest of these instructions assume the defaults.
The Microsoft downloads/installs are quite large. If you can't wait or don't have the bandwidth, try the MinGW/MSYS approach described below. Note however that the Visual C++ Express IDE (editor/debugger) is first class. If you're brand new to all this I thoroughly recommend the Microsoft route.
- Install Microsoft Visual C++ Express - Web Install or Downloadable Install
- Install DevExtra - Info or Download
- Install Platform SDK - Web Install and Minimum Install Details.
- Install VST SDK - License Agreement and Download
You'll also need a VST host - of course I recommend Cantabile.
Integrate SDKs with Visual C++ Express:
In order for Visual C++ Express to work with the Platform SDK and VST SDK you need to integrate it by following these steps:
- Locate the file C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults\corewin3_express.vsprops and open it in a text editor
- Change the string that reads AdditionalDependencies="kernel32.lib" to AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"
- Close and save the file. (or here's one I prepared earlier - corewin_express.zip)
- If you plan to build other projects types you should follow the other instructions here.
- Start Visual C++ Express
- From the Tools menu, select Options
- Browse the tree on the left and locate Projects and Solutions -> VC++ Directories
- In "Show Directories for", select "Include Files"
- Add a new entry for C:\Program Files\Microsoft Platform SDK\Include (assuming you installed to the default location)
- Add a second new entry that points to the directory where you extracted the VST SDK. The path entered should be the folder containing the public.sdk folder.
- In "Show Directories for", select "Library Files"
- Add a new entry for C:\Program Files\Microsoft Platform SDK\Lib
- Press OK to close the options dialog.
Generating Your Plugin
DevExtra is a code generation tool that can generate an framework VST project.
- Start DevExtra - Start menu -> All Programs -> DevExtra Code Generator 8.0
- Select the VST category on the left
- Select the VST Plugin entry on the right
- Press OK
- Enter a name for your plugin and choose a directory for it (My Documents\Visual Studio 2005\Projects is a good choice)
- Press OK
- Fill out additional settings for your plugin and press OK
- DevExtra will generate the project and launch Explorer showing the generated files
- Double click on the .vcproj file to open it in Visual C++ Express
- Press F7 to build it
Running and Debugging
Once you've generated and built your plugin you'll want to be able to run it and debug it from Visual C++ Express:
- With project open in Visual C++ Express, select Properties from the Project menu.
- In the tree on the left navigate to Configuration Properties -> Debugging
- In the properties list on the right, for "Command" enter the full path to your favorite host application (did I mention Cantabile?)
- Press OK to close properties
- Press Ctrl+F5 to run host application without debugging.
- To debug, press F9 on line of code to set break point.
- Press F5 to run host application in debugger.
Using MinGW/MSYS
MinGW/MSYS is a development environment for building Windows applications and DLL's (and therefore VST plugins) using open source development tools such as GCC.
The original makefile this system uses was generously contributed by KVR Audio member bluebyte who also has more complete instructions here: http://schmid.dk/wiki/index.php/VST_Plug-ins.
To setup the development environment you'll need to:
- Install MinGW and MSYS - Info or Download
- Install DevExtra - Info or Download
- Install VST SDK - License Agreement and Download
To generate the plugin:
- Follow the same steps as described above for "Generating You're Plugin". The template generates both a Visual C++ project file and a makefile for MinGW/MSYS - there's no options to change.
- Open the generated makefile in a text editor and modify the line VSTSDKDIR to specify the location of VST SDK folder.
- Optionally change the line VSTPLUGINS to specify an output directory for the resulting .dll file.
- Save the makefile
- Start a MSYS console
- Change to the project directory
- Type 'make' to build the plugin
SimpleLib
The code generated by DevExtra's VST template is deliberately configured to not require any additional libraries or dependencies. Once you start getting serious with you're plugin though you're going to need some additional libraries for things like strings and collections.
STL is a popular choice but for a very lightweight, easy to use and easy to read alternative you might like to try SimpleLib. You only need to include one header file, you don't need to link to any libraries and you get comprehensive support for strings, vectors, maps, ring buffers, linked lists and more.
Notes
- The template currently only generates a project for use in Microsoft C++ Express, Visual Studio 2005 and MinGW/MSYS. It should be trivial to make changes to support other platforms however I've not done it. If someone would like to send me an updated template with support for other platforms, I'll happily include those changes here for all to use.
- Because I'm not a plugin developer myself, the code in the template may not represent best practices and probably contains bugs. If you have suggestions for improvements to the template please send them through.
- If I've missed any steps or if something is unclear, please let me know.
