Using gcc to compile a VST plugin on OS X

Posted in programming on January 4th, 2010 by scott – Be the first to comment

It’s been so long since I’ve posted any code… It’s actually been so long, I’m pretty sure the code I’ve posted got dropped a couple of blog migrations ago.

I don’t have anything against all the fancy tools like Visual Studio, XCode and Eclipse… well, except that they have huge footprints and hide a lot of the work so that you really don’t know what’s going on behind the scenes. I was pretty frustrated reading through various tutorials and message boards where, when asked, most of the people shrugged off the idea of using gcc to build VST plugins.

Sure, you wouldn’t want to do it day in and day out, but if you want to, for instance, use maven or Eclipse’s CDT rather than XCode or Visual Studio, you need to know what’s going on under the covers – to break it down to it’s components and build from there.

I managed to get the ‘again’ plugin compiled from the command line with a minimum of fuss and will most likely continue working this way until I can get Eclipse CDT configured properly.

Here’s a set of commands that will get you going.
First is the easy part. Build the assembled binaries of your plugin and the VST library.

gcc -x c++ -arch i386 -mmacosx-version-min=10.4 -I ../../includes/vstsdk2.4 -c -o obj/audioeffect.o
gcc -x c++ -arch i386 -mmacosx-version-min=10.4 -I ../../includes/vstsdk2.4 -c -o obj/audioeffectx.o
gcc -x c++ -arch i386 -mmacosx-version-min=10.4 -I ../../includes/vstsdk2.4 -c -o obj/vstplugmain.o
gcc -x c++ -arch i386 -mmacosx-version-min=10.4 -I ../../includes/vstsdk2.4 -c -o obj/again.o src/ag

Then create a placeholder for what will become the plugin package and link the object files into a bundle.

set MACOSX_DEPLOYMENT_TARGET 10.4
mkdir -p bin/again.vst/Contents/MacOS
g++ -arch i386 -bundle -mmacosx-version-min=10.4 -o bin/again.vst/Contents/MacOS/again obj/again.o o

The next step will create an OS X package that will be treated as a VST plugin. I placed the Info.plist and PkgInfo files into the resources folder and copy them over at the end.

cp -r src/resources/* bin/again.vst/Contents/

The Info.plist file looks like this for the ‘again’ example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>English</string>
	<key>CFBundleExecutable</key>
	<string>again</string>
	<key>CFBundleIdentifier</key>
	<string>de.steinberg.vst2.4.example.again</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>again</string>
	<key>CFBundlePackageType</key>
	<string>BNDL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>1.0</string>
	<key>CSResourcesFileMapped</key>
	<true/>
</dict>
</plist>

And the PkgInfo file is a single line that looks like:

BNDL????

Next, I’m going to try to get this working with a cross compiler so that I don’t have to run one script on OS X and another on Windows. We’ll see how that goes. Hopefully both should work with my VST-RTAS wrapper in Pro Tools… keeping my fingers crossed.

Emmett – 08.28.09

Posted in emmett on September 3rd, 2009 by scott – 1 Comment

I’ve uploaded the first week’s worth of photos here…

Venice is Sinking – kickstarter project

Posted in recording on August 21st, 2009 by scott – Be the first to comment

Homemade Ketchup

Posted in kitchen on August 15th, 2009 by scott – Be the first to comment
  • 12 oz tomato paste
  • 1/4 c honey
  • 1/4 c good red wine vinegar
  • 1/8 c worchestershire sauce
  • 1 tsp salt
  • pepper to taste
  • cayenne to taste (optional)

Mix together and chill for a few hours. Adjust to your own tastes – ketchup is really just a sweet/salty/tangy perhaps spicy condiment made from tomato paste. Maybe you like it a little tangier or sweeter. The vinegar will have a big effect on the outcome so make sure you find something that you like.

Then, eat lots of hot dogs.

The Crinolines (some tracks from last weekend)

Posted in recording on August 9th, 2009 by scott – Be the first to comment


(vegan or not) raspberry bread

Posted in kitchen on July 26th, 2009 by scott – Be the first to comment
  • 330 g flour
  • 1 tsp baking soda
  • 1 tsp salt
  • 2 tsp cinnamon
  • 400 g sugar
  • 1 1/2 c butter
  • 4 eggs
  • 2 c raspberries, slightly mashed
  • 1/2 c sunflower seeds
  • 1/2 c flax seeds
  • 1/2 c oats

Vegan version:

  • substitute 1 1/2 c oil for butter
  • substitute 1/2 c flax meal processed with 3/4 c water for egg

We picked another 3 lbs of raspberries this weekend. I used about 2 lbs making 4 loaves of bread! I’m going to a friend’s house for some grilling whose wife is vegan. I’ve never cooked vegan before (on purpose, anyway), so gave it a shot.

For the vegan version, combine the flax meal and water in a food processor and process until it becomes thick. Refrigerate until needed.

Grease 2 5×9 bread pans. Mix dry ingredients including the nuts and oats. In a separate bowl, mash the raspberries with a potato masher and combine with the sugar, melted and cooled butter (or oil), and eggs (or flax meal concoction). Combine with the dry ingredients, mixing until just combined. Bake 1 hour and 15 minutes at 325.

the chewy (chocolate chip cookies with toffee and buckwheat groats)

Posted in kitchen on July 24th, 2009 by scott – Be the first to comment

  • 320 g bread flour
  • 1 tsp kosher salt
  • 1 tsp baking soda
  • 2 sticks butter
  • 50 g white sugar
  • 248 g dark brown sugar
  • 1 egg and 1 egg yolk
  • 2 tbsp milk
  • 1.5 tsp vanilla
  • 1 12 oz package semisweet or milk chocolate chips
  • 1/2 package toffee chips (optional)
  • 1 c  buckwheat groats (optional, but oh so good)

Melt the butter in a saucepan and allow to cool. Combine the flour, salt, and baking soda in a bowl. Combine the sugar and butter in a stand mixer and beat at a medium speed until whipped up. Add the eggs, vanilla and milk on a slower speed and mix until combined. Use the mixer to mix in the dry ingredients. By hand mix in the extras – chocolate chips, toffee, and groats.

Katrina asked me if the groats made them more healthy. My guess – no. They taste good tho. They’re nutty and crunchy, but not as heavy as walnuts or hazelnuts.

strawberry bread

Posted in kitchen on July 23rd, 2009 by scott – Be the first to comment
  • 330 g flour
  • 1 tsp. baking soda
  • 1 tsp. salt
  • 1 tbsp. cinnamon
  • 400 g sugar
  • 1 1/2 c. butter
  • 4 eggs
  • 2 c sliced strawberries, slightly mashed
  • 1/2 c sunflower seeds
  • 1/2 c flax seeds
  • 1/2 c oats

This is a little different from most strawberry breads I found. I reduced the sugar a little, changed the oil to butter, and added some grains and nuts. Overall it’s a little less sweet, and if you cook it the full 1:15, it turns out a little chewier than you’d expect, but I like that.

Slice the strawberries and add 100g of the sugar. Allow to macerate for an hour or so and speed the process along a little bit by mashing them up with a potato masher.

Grease 2 5×9 bread pans. Mix dry ingredients including the nuts and oats. In a separate bowl combine the remaining sugar, melted and cooled butter, eggs, and macerated strawberries. Combine with the dry ingredients, mixing until just combined. Bake 1 hour and 15 minutes at 325.

curried red potatoes and cilantro yogurt

Posted in kitchen on July 21st, 2009 by scott – Be the first to comment

For the potatoes:

  • ‘B’ size red potatoes (about a peck’s worth, or enough to fill your roasting pan)
  • olive oil
  • 2 tbsp ground curry powder
  • 1 tbsp ground cumin
  • 1 tbsp ground coriander
  • pinch of ground cinnamon
  • pinch of cayenne pepper
  • pinch of ground cloves
  • hefty pinch of kosher salt

For the yogurt:

  • 8oz strained yogurt
  • half of a bunch of cilantro
  • 1/4 tsp salt
  • juice of one lime

Preheat the oven to 425 – we’re roasting the potatoes, not baking them! Rinse the potatoes and slice them into 8ths – once each in the x, y, and z planes. Dump them into the roasting pan and toss with enough olive oil to coat. Add spices and salt and toss. Roast for about 45 – 50 minutes, stirring them (scrape the bottom!) once every 10 – 15 minutes. Turn on the broiler for another 10 – 15 minutes, shaking every few minutes for even browning.

While the potatoes are in the oven, finely chop the cilantro and mix with yogurt, salt, and lime juice. Allow to set in the fridge for the remaining time.

peanut? butter

Posted in kitchen on July 20th, 2009 by scott – Be the first to comment

I’ve made a couple of batches of peanut butter and cashew butter. I don’t know what got into me, but I thought If just peanuts taste good, it’s gotta taste better with everything in it! Honestly, I think I need to add a lot more oil to the butter than I’m comfortable doing. What I’ve been making should be rolled in parchment paper and sliced instead of spread out of a tub. I should probably use peanut oil instead. We’ll see next time.

  • 5 oz peanuts
  • 5 oz cashews
  • 5 oz almonds
  • 1/2 c sunflower seeds
  • 1/2 c flax meal
  • 1/2 c cappings
  • 1/2 c honey
  • 1/4 c vegetable oil

Roast the nuts and seeds in a 425 degree oven until they start to smell toasty.  In a food processor combine the cooled nuts and seeds, flasx meal, honey, cappings, and vegetable oil. Process until it’s smooth. I’m seriously considering rolling it up in some parchment paper next time, but for now, it’s sitting in my fridge in a 24oz jar.

Serve with raspberry preserves that you made from your roadside raspberries.