Search This Blog

Thursday, April 28, 2011

VST 2.x effect development in XCode

Even though there are some tutorials (and even templates) out there explaining how to set up an XCode project to develop a VST 2.x plug-in, I didn't succeed following their instructions (although they did help me a lot). I decided to write my own tutorial and template. Btw, I developed everything using XCode 3.2 on OS X 10.6.

The instructions
  1. Open XCode and create an empty project
  2. Add a new target: Cocoa -> Loadable Bundle. You can name it however you like, but I recommend using you plugin's name. This should also create a plist file named <yourpluginname>-Info.plist
  3. Double click on the newly created plist file. This will open the plist editor. Using this editor add the following entries (but clicking on the + sign at the right of the selected line):
  i.    Localization native development region    English   
  ii.   Executable file                           ${PRODUCT_NAME}
  iii.  Bundle name                               ${PRODUCT_NAME}
  iv.   Icon file
  v.    Bundle identifier                         com.yourdomain.youpluginname
  vi.   InfoDictionary version                    6.0
  vii.  Bundle OS Type code                       BDNL
  viii. Bundle creator OS Type code               ????
  ix.   Bundle version                            1.0
  x.    Bundle versions string, short             1.0
  xi.   Resources should be file-mapped           [checked]

  1. Create a new group called vst_sdk. Add the VST SDK source files to this group (copy the folders "plugininterfaces/vst2.x/" and "plublic.sdk/source/vst2.x/" into this VST group) 
  2. Create an empty file named <yourpluginname>-Prefix.pch and add these lines:
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
  1. In the target's build settings check the following value:
    Architectures                   32-bit Universal
    Base SDK                        Current Mac OS
    Valid Architectures (Release)   i386 ppc ppc64 ppc7400 ppc970
    Valid Architectures (Debug)     $(NATIVE_ARCH)
  Compiler Version:
    C/C++ Compiler Version          LLVM GCC 4.2
    Force Package Info Generation   YES
    Info.plist File                 <yourpluginname>-Info.plist
    Preprocess Info.plist           YES
    Product Name                    Name of your plugin
    Wrapper Extension               vst

  Search Paths:
    Header Search Paths             <vst_sdk location>
  GCC 4.0 Language:
    Prefix Header                   <yourpluginname>-Prefix.pch

  1. Add the QuickTime and Carbon frameworks
  2. Add the cpp and h files with your plugin (TODO: generate a template for this)
  3. Add a New Build Phase -> New Run Script Build Phase to the target. Then:
  i.    Set shell to /bin/bash
  ii.   Add the following script:
rm -rf $HOME/Library/Audio/Plug-Ins/VST/$PRODUCT_NAME.vst
cp -r "$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.vst" "$HOME/Library/Audio/Plug-Ins/VST/$PRODUCT_NAME.vst"

The last step is optional but very convenient. It copies you VST to a System folder where almost any VST host will look for VSTs.

The template

This XCode3 template was created using the previous steps (since XCode 4 templates are not clearly documented, I haven't even tried). Note that the VST SDK is not provided, due to licensing restrictions. You will have to download it from the Steinberg website.

The are a couple of places where you can place the template, but I recommend the following:

/Library/Application Support/Developer/Shared/XCode/Project Templates/VST/<thedownloadedtemplatehere>

Probably you will have to create most of these folders (from Developer on), but placing the templates here will prevent future updates of XCode from deleting them.


    1. Thank you!! This worked flawlessly the first time!

    2. This comment has been removed by the author.

    3. Amazing Article, thank you!. I am very glad to read your informative & practical blog. Kindly keep updating your blog.
      Java Developer is a wonderful career for IT students.To start Dream Career to become a Java developer learn from
      Java Training in Chennai
      . or learn thru Java Online Training from India .