VST Plug-ins

From Schmid.wiki
Jump to: navigation, search

Contents

Creating VST Plug-ins: The Easy Way

SynthEdit

Creating VST Plug-ins for Mac OS X

SConstruct file:

vstEnvironment = Environment(CPPPATH = [
	'public.sdk/source/midi/',
	'public.sdk/source/common/',
	'pluginterfaces/'
	],
	)

vstLib = vstEnvironment.StaticLibrary('vst', [
	    './pluginterfaces/base/funknown.cpp',
	    './public.sdk/source/common/linkedlist.cpp',
	    './public.sdk/source/common/pluginfactory.cpp',
	    #'./public.sdk/source/common/pluginview.cpp',
	    './public.sdk/source/common/plugparams.cpp',
	    './public.sdk/source/common/plugxmlgui.cpp',
	    #'./public.sdk/source/common/plugguieditor.cpp',
	    #'./public.sdk/source/main/dllmain.cpp',
	    './public.sdk/source/main/macmain.cpp',
	    './public.sdk/source/midi/eventqueue.cpp',
	    './public.sdk/source/midi/midieffect.cpp'
	])

vstPlugin = vstEnvironment.SharedLibrary('midiecho', [
	'public.sdk/samples/midi/midiecho/source/midiecho.cpp',
	'public.sdk/samples/midi/midiecho/source/midiechoentry.cpp'
	],
	CCFLAGS = '-include public.sdk/samples/midi/midiecho/mac/prefixmacho.h',
	LIBPATH = '.',
	LIBS = 'vst',
	LINKFLAGS = '-framework carbon -framework coreservices'
    )

Creating VST Plug-ins with MinGW

I don't use Visual Studio, and I also don't use Dev-C++ (even though it is very nice and open source). This HOWTO is based on the simplest possible setup: MSYS / MinGW. It assumes VST SDK version 2.4, but should be easily changed for other versions.

Prerequisites

Preparations

  • create directory 'PLUGINNAME' (just make up your own name) somewhere
  • unpack VST SDK in the same directory as 'PLUGINNAME', you should end up with a structure like this:
 |- PLUGINNAME/
 `- vstsdk2.4/
     |- artwork
     |- etc.

Coding

  • create cpp program 'PLUGINNAME.cpp', you could base it on vstsdk2.4/public.sdk/samples/vst2.x/again/source/again.cpp
  • create header file 'PLUGINNAME.h', you could base it on vstsdk2.4/public.sdk/samples/vst2.x/again/source/again.h
  • create file 'PLUGINNAME.def':
LIBRARY     PLUGINNAME
DESCRIPTION 'my first VST plugin'
EXPORTS     main=VSTPluginMain

Building

  • create file 'Makefile' (if you copy-paste this Makefile, please ensure that all indentations are converted to TABs, otherwise make won't understand anything):
# change this to the location of your unpacked VST SDK:
VSTSDKDIR = ../vstsdk2.4

CPP       = g++.exe
OBJ       = PLUGINNAME.o $(VSTSDKDIR)/public.sdk/source/vst2.x/vstplugmain.o $(VSTSDKDIR)/public.sdk/source/vst2.x/audioeffect.o $(VSTSDKDIR)/public.sdk/source/vst2.x/audioeffectx.o
LIBS      = -L. --add-stdcall-alias -lole32 -lkernel32 -lgdi32 -luuid -luser32 -mwindows --no-export-all-symbols --def PLUGINNAME.def   
CXXINCS   = -I"$(VSTSDKDIR)/pluginterfaces/vst2.x" -I"$(VSTSDKDIR)/public.sdk/source/vst2.x" -I"$(VSTSDKDIR)" -I"$(VSTSDKDIR)/vstgui.sf/vstgui" -I.
BIN       = PLUGINNAME.dll
CXXFLAGS  = $(CXXINCS) -DBUILDING_DLL=1 -mwindows -O3
RM        = rm -f

.PHONY: all clean

all: PLUGINNAME.dll

clean: 
        ${RM} $(OBJ) $(BIN)

DLLWRAP   = dllwrap.exe
DEFFILE   = libPLUGINNAME.def
STATICLIB = libPLUGINNAME.a

$(BIN): $(OBJ)
        $(DLLWRAP) --output-def $(DEFFILE) --driver-name c++ --implib $(STATICLIB) $(OBJ) $(LIBS) -o $(BIN)

PLUGINNAME.o: PLUGINNAME.cpp
        $(CPP) -c PLUGINNAME.cpp -o PLUGINNAME.o $(CXXFLAGS)

$(VSTSDKDIR)/public.sdk/source/vst2.x/vstplugmain.o: $(VSTSDKDIR)/public.sdk/source/vst2.x/vstplugmain.cpp
        $(CPP) -c $(VSTSDKDIR)/public.sdk/source/vst2.x/vstplugmain.cpp -o $(VSTSDKDIR)/public.sdk/source/vst2.x/vstplugmain.o $(CXXFLAGS)

$(VSTSDKDIR)/public.sdk/source/vst2.x/audioeffect.o: $(VSTSDKDIR)/public.sdk/source/vst2.x/audioeffect.cpp
        $(CPP) -c $(VSTSDKDIR)/public.sdk/source/vst2.x/audioeffect.cpp -o $(VSTSDKDIR)/public.sdk/source/vst2.x/audioeffect.o $(CXXFLAGS)

$(VSTSDKDIR)/public.sdk/source/vst2.x/audioeffectx.o: $(VSTSDKDIR)/public.sdk/source/vst2.x/audioeffectx.cpp
        $(CPP) -c $(VSTSDKDIR)/public.sdk/source/vst2.x/audioeffectx.cpp -o $(VSTSDKDIR)/public.sdk/source/vst2.x/audioeffectx.o $(CXXFLAGS)

  • In MSYS, cd to 'PLUGINNAME' and run 'make' - there will be warnings, but make should output a DLL, which is the actual VST Plug-in

References

Kiloton Freeware VST Survival Kit

These are all free VST instruments and effects that no self-respecting laptop git should do without:

Personal tools