3: GUIs and VST instruments

In this tutorial I will show you how to build the ADelay effect and then how to build the Surrounddelay effect which inherits from the ADelay class and has a custom GUI. Once you have this down, you will be able to start making some really cool looking stuff. The demo skin looks a little ugly but there are some super cool tools online (KnobMan, SkinMan) which enable you to make excellent looking plugins without needing huge graphic design knowledge.

The ADelay and surround delay plugins both reside within the ADelay folder in the VST SDK. I suggest you copy this folder to your development folder and in the root directory of this copy, make a blank text file with no extension called “SConstruct_ADELAY”. To build ADelay examine the following script and paste it into the text file which you just created. The Glob command is something new here and just allows you to make lists using wild cards. Run the script by navigating your console application to the ADelay copy in your develpment deriectory and issuing the command “scons -f SConstruct_ADELAY” without the quotation marks. The -f flag directs scons to the build script you wish to use.

vstPlugName = 'adelay'
vstBaseDir = 'C:\\vstsdk2.4'

vstSdkDir = vstBaseDir+'\\public.sdk\\source\\vst2.x\\'

env = Environment(CPPPATH= [vstBaseDir, vstSdkDir], tools=['mingw'])
env['CCFLAGS'] = ['-Wall-O3']
env.SharedLibrary(vstPlugName,  Glob('ad*.cpp')+

Once this is complete, drag and drop the .dll into your VST host and have a play with the effect. No GUI yet but this is coming up.


Building the surround delay demo caused me some headache to begin with but hopefully this part of the tutorial will save some other newcomers the frustration! The surround delay demo requires the inclusion of some sources in the vstgui source forge project, but thankfully this is included in the vst sdk 2.4 download. It can be found in the sf.vstgui folder.

TOP TIP: To find which files need to be included it is a good idea to look at the visual C project file included with this demo (found in the win folder). This is a plain text file which you can drag into your text editor for inspection. This tip is useful when trying to build any source which comes with a vcproj file. Look near the end of the file, around line 330, and you will see a list of files with the extension .cpp. PLease excuse the incorrect line numbers in the following code snippet. I haven’t worked out how to correct this in the wordpress code widget yet 🙂

Name="Source Files"

We do not need to worry about the header files as the source will find them just fine as we will add some directories to the CPP path in the scons script. We only need to take note of the .cpp files. Once we’ve added the additional sources to the build list there are just a couple more things to worry about. Firstly the GUI needs some graphical resources which are in the editor folder. Mingw is able to compile windows resource files and this is what the env.RES command is all about in the following scons script. This command will make an object file from the bitmap files in the resources folder. This object file is then added to the list of sources. Finally there are some windows libraries which need to be bundled in to get everything working with the GUI. Have a good look at the following script and then save it as something like SConstruct_SURROUND and run it like the example given above for adelay with the -f flag.

vstPlugName = 'surrounddelay'
vstBaseDir = 'C:\\vstsdk2.4'

vstGuiDir = vstBaseDir+'\\vstgui.sf\\vstgui\\'
vstSdkDir = vstBaseDir+'\\public.sdk\\source\\vst2.x\\'

env = Environment(CPPPATH= [vstBaseDir, vstGuiDir, vstSdkDir, 'editor\\resources'], tools=['mingw'])
env['CCFLAGS'] = ['-Wall-O3']
env['LIBS'] = ['ole32','kernel32','gdi32','uuid','user32']
env.SharedLibrary(vstPlugName,  [vstPlugName+'.cpp', 'adelay.cpp', 'editor\\sdeditor.cpp', 'editor\\resources\\'+vstPlugName+'.o']+
								[vstGuiDir+'vstcontrols.cpp', vstGuiDir+'vstgui.cpp', vstGuiDir+'aeffguieditor.cpp'  ])

Make sure you thoroughly examine the script above and understand why each stage is included. Try removing bits and looking at the resulting build errors. Once this builds, load it up and admire your flashy new GUI. If you’re using the free VSThost then click the knob which will be lit up in the surrounddelay module to view the GUI.


Now you know how to build this example, it is very easy to build the VST instrument included in the examples with the sdk. Again, copy the example to your development directory, look at the vcproj file to see what is needed and make an SConstruct file containing the following.

vstPlugName = 'vstxsynth'
vstBaseDir = 'C:\\vstsdk2.4'

vstGuiDir = vstBaseDir+'\\vstgui.sf\\vstgui\\'
vstSdkDir = vstBaseDir+'\\public.sdk\\source\\vst2.x\\'

env = Environment(CPPPATH= [vstBaseDir, vstGuiDir, vstSdkDir],
				  tools = [ 'mingw' ])
env['CCFLAGS'] = ['-Wall-O3']
env.SharedLibrary(vstPlugName,  Glob('source\\*.cpp')+
								#[vstGuiDir+'vstcontrols.cpp', vstGuiDir+'vstgui.cpp', vstGuiDir+'aeffguieditor.cpp'  ])

Build this as normal with the scons command and then you should end up with a vst instrument which you can play using a midi device.


Now you have everything in place to make some cool plugins. Try and understand all of the source in the examples and you’ll know how to do a lot more than me! Many thanks to the kind folk on the KVR forums who helped me get this up and running initially (namely mystran and gnjp). All the best and have fun pluginning . . .

  1. Ares
    February 28, 2009 at 13:40

    Thanks for your effort! A very good starting point for people wanting to have a go at VST – programming.

  2. bmoviehorror
    March 10, 2009 at 14:51

    Thanks for the comment! Hopefully I’ll have some more stuff up here soon.

  3. March 11, 2009 at 00:44

    Good stuff, let me just add that, especially if you want to roll your own VSTGUI controls, you really want to get VSTGUI v3.5 (http://vstgui.sourceforge.net/) – particularly the mouse handling is much better, and in 3.0 it would freeze some hosts as far as I remember.

  4. RaiulBaztepo
    March 31, 2009 at 14:50

    Very Interesting post! Thank you for such interesting resource!
    PS: Sorry for my bad english, I’v just started to learn this language 😉
    See you!
    Your, Raiul Baztepo

  5. SZU
    April 6, 2009 at 15:08

    Could You help me with making a *.dll file??
    Cause I did all job from tutorial 1.
    And checked if it works (in the console “gcc -v” and “scons -v”)
    Both screens after these cmnds were exactly the same like in the tutorial 1.
    But when it comes to AGain. Console shows “no SConstrucy file found….” after scons is written.

    • April 6, 2009 at 20:25

      Make sure you put my script in a file called SConstruct in the AGain folder and then run scons from !!within!! that directory and all should work fine. If you got the same output as tutorial 1 then you are just giving the scons command from the wrong directory or you have misspelt SConstruct. Another common error happens because windows hides file extensions by default and you may have left a .txt on your SConstruct file by accident. Best of luck with your plugin!

  6. April 8, 2009 at 08:39

    Really GREAT idea to create a blog on VST plugin dev! I always had in mind some cool VST I would like to have, you just made me realize I could just develop them on my own!
    For sure, I’ll follow your next posts 😉

    • April 8, 2009 at 10:34

      Many thanks for the complements! I’m working hard on my python interface as I love interpreted languages. I’ll get some simple DSP effects tutorials up as soon as I can. Thanks again.

  7. tronhead
    May 8, 2009 at 00:27

    this is the most helpful post on VST programming i’ve come accross. I’ve been learning C++ to design some of my own. just having a bit of a problem getting scons to build the dll. got the SConstruct file written but i keep getting this below instead of a DLL. any idea what i’m doing wrong?

    C:\My Applications\VST Plugins\again>scons
    scons: Reading SConscript files …
    scons: done reading SConscript files.
    scons: Building targets …
    g++ -o again.o -c “-Wall -O3” -IC:\vstsdk2.4 again.cpp
    ‘g++’ is not recognized as an internal or external command,
    operable program or batch file.
    scons: *** [again.o] Error 1
    scons: building terminated because of errors.
    C:\My Applications\VST Plugins\again>


    • May 18, 2009 at 15:24

      You haven’t added mingw compiler to your path correctly. Check the instructions in the first tutorial again thoroughly. Scons is working fine but it cannot find g++.

  8. Gonzalo
    June 11, 2009 at 13:15

    tronhead, I was having the same problem. You have to put the SConstruct file inside the source folder where again.cpp and again.h are.

    Hope it helps.

    (bmoviehorror, your tutorial rules!…thanks a lot)

  9. June 16, 2009 at 11:37

    Hey Gonzalo. Thanks for clearing that up and thanks also for the kind comments.

  10. AL
    June 29, 2009 at 10:03


  11. June 29, 2009 at 11:06

    No problem. Happy to help.

  12. February 12, 2010 at 16:31

    Brilliant blog getting me started but when i try to compile the xsynth I get a linking error that I cannot solve, any ideas, all previous examples worked fine

    Creating library file: libvstxsynth.a
    C:\vstsdk2.4\public.sdk\source\vst2.x\vstplugmain.o:vstplugmain.cpp:(.text+0x4f): undefined reference to `createEffectInstance(int (*)(AEffect*, int, int, int,
    void*, float))’
    collect2: ld returned 1 exit status
    scons: *** [vstxsynth.dll] Error 1
    scons: building terminated because of errors.

    thanks again

  13. Owen
    February 27, 2010 at 03:00


    Just compiled the ‘adelay’ example.

    Compiled fine, but does not actually work properly in Renoise.

    I am getting two main issues;

    1. The volume control does not do anything! The feedback seems to be more of a volume control.

    2. The delay causes an increasing amount of, well, delay, at the start of the sample when adjusted. When the delay is at 0, the sample plays immediately upon triggering. When it is increased, the sample doesn’t start playing for a while, then kicks in.

    Almost as if there is no delay compensation built in, but this is nothing I have ever experienced with a delay plug in.

    I know the errors could be at a number of locations, so I will have a look through and see what I can find. If you find out a solution in the meantime, let us know!!


    • March 5, 2010 at 11:36

      I’m guessing this is something to do with whether you have set the effect to be in an FX loop or if you have set it to be an insert in your host?

    • March 5, 2010 at 11:36

      I’m guessing this is something to do with whether you have set the effect to be in an FX loop or if you have set it to be an insert in your host?

  14. Alex
    June 10, 2010 at 04:48

    Having the same problems as Owen 😦

  15. December 13, 2011 at 11:52

    Great tutorial and a great starting point for me as a complete newbie

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: