Xcode VST Debugging Tips

Today it’s time to talk about debugging with Xcode 2.4. And be warned, debugging can be a pain with Xcode. But first things first.

You choose the VST host in Xcode with “New Custom Executable”. You can add as many as you like, not like Visual Studio where you can only set one.

With Xcode 2.4 a new debug information format called DWARF was added to the existing stabs format. With this change it’s actually possible to debug C++ code. But the default format is still stabs, so go into the target build settings and change stabs to DWARF.

So when you now hit “Build and Restart” your preferred VST host should start.

Now to the caveats. GDB or Xcode has a bug that when your vst was once loaded and then unloaded and loaded again all your breakpoints wouldn’t break. This is a problem in hosts like Cubase which scans all modified or new plug-ins on startup. So if you need to use Cubase as host, start it first without debugger let the scanning happen and then quit Cubase. Now you can hit Debug to actually debug your plug-in.

If you have objects like the VstTimeInfo and you want to see a summary of its values in the debugger Xcode has some nice method: double click into the summary field for the variable (in this case the VstTimeInfo variable) and enter Tempo: {$VAR.tempo} bpmNow you see “Tempo: 120 bpm” whenever a VstTimeInfo struct is in the current scope (and the tempo is 120). Because of some bugs in Xcode or gdb this does not work everytime.
You can even call methods of that object (if it has methods, VstTimeInfo does not have any method). Just take your effect class (AudioEffect) and enter Sample Rate: {$VAR->getSampleRate()}into the summary field and you will see the current sample rate whenever your effect class is in scope.

0 Comments : 05.31.07

Short Mac VST Plug-In Development Tips

So, after Apple switched the processors for the macintosh it looks like more windows only developers are thinking to port their plug-ins to the mac. I will try to give some short tips for new VST mac developers.

How to start a new fresh project in Xcode:

  • Use the “Carbon Bundle” template when creating a new project.
  • Open the target settings and change the build setting “Wrapper Extension” from ‘bundle’ to ‘vst’. (Don’t forget to change the configuration to ‘All Configurations’ before)
  • Add a “Header Search Path” to the root of the VST 2.4 sdk.
  • Add the sdk sources and headers to the project.

You should be able to build the target now with only one linker error :

Undefined symbols:

“createEffectInstance(int (*)(AEffect*, int, int, int, void*, float))”, referenced from: _VSTPluginMain in vstplugmain.o

As an experienced vst developer, you know that this is actually the entry function which will be called by the host to instantiate the vst plug-in. So add your own source files to the project and try to build it.

Next tip will be coming next week.

2 Comments : 05.24.07