programming

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.

NPR does buckling springs

Posted in programming on July 12th, 2009 by scott – Be the first to comment

There was a great story on NPR a few weeks ago that finally spurred me into buying one more buckling spring keyboard.

Unfortunately, most of my collection of umpteen early 80’s Model F’s and Model M’s, from vintage square logos with the large 5 pin din connectors to Lexmark manufactured ones from the late 90’s haven’t been getting much use. Day-to-day, I’m developing on a MacBook Pro which doesn’t work with the PS/2 to USB adapters, and even if it did, would require remapping almost every single modifier key to be able to work.

Luckily, Unicomp is making them (or at least REALLY good copies) now, including the Apple/Windows key, and putting USB connectors on them. I ordered a couple, and though the quality is about 90% of what it once was, that’s still 90% more than you get with anything else. I do like the Cherry and Alps keyboards in my collection, but nothing beats the buckling spring. Great work guys – please keep it up as long as you can!

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

amazon cloudfront

Posted in programming on March 12th, 2009 by scott – Be the first to comment

I had a client or two who I had suggested CloudFront as a viable solution for content delivery that was affordable and had no long-term commitments. I decided to put my money where my mouth was.

Generally my approach is to keep all the images, swfs, silverlight, etc in a folder called /assets and create custom .NET controls that know to look for a config setting that points to the asset root which may or may not be in the same domain. It will take a little time before I do all that on my own sites, but wanted to share an image all the same…

[Edit] I wanted to note that I finally found an MSBuild task for uploading content to S3! SpaceBlock on Codeplex seems to do the trick. I honestly haven’t tried it yet, but if it works will help my automated Cruise Control deployments greatly.

[Another Edit] I really need to make a Flex version of the satellite tracker!

developing for surface

Posted in programming on July 10th, 2008 by scott – Be the first to comment

We got a surface in the office! I can’t really talk about the project I’m working on, but I will say that I’m determined to get some version of the satellite tracker on it – It offers a very interesting interaction model that could be a fun way to visualize and interact with orbits. 

One problem is that the SDK is under wraps so when you run into problems there’s really not much of a community to turn to. The MS Surface developer’s blog offers little in the way of hard examples, offering more of a list of cool stuff they’re working on and why this thing is going to be cool when the masses get a hold of them.

I’d love to offer up some more info, but am under an NDA! Here’s a little peek at our developer station until I can talk more.

hacking the nike+ sport band

Posted in programming on June 24th, 2008 by scott – Be the first to comment

The Nike SportBand came out. Really, it’s no more than a glorified pedometer, but it stores a lot more data about your running. Now it’s finally no bigger than you would expect. Previously you had to carry around an Ipod Nano.

With both versions, the only real way to get to the data is to upload it to the Nike website. With the Ipod, you could pull the files directly off. I don’t really like the idea of Nike’s website being the only way to really use the data, and would have come up with a way to use the Ipod data if I had one.

I was hoping that the SportBand worked similarly, but unfortunately, that’s not the case. It is a USB device, but the computer sees it as a USB Human Interface Device (a keyboard or mouse, really) instead of a flash drive.

I’ve done a little research into accessing HIDs with the .NET framework, and though it appears possible – with thanks to Jan Axelson, I haven’t yet figured out how to actually read the data off the device. If anyone knows more about this, I’d love to hear about it. Once I have the data, it should be easy enough to build a nice WPF app to display your run data.

Anyway, as a start, the initial critical data for the Nike+ USB device is:

Vendor ID: 11AC
Product ID: 4269

When I use the HID tester though I get the following message:

Device Detected: 
- Vendor ID: 11AC
- Product ID: 4269
The attempt to write an Output report has failed.
The attempt to read an Input report has failed.
The attempt to write a Feature report has failed.
The attempt to read a Feature report has failed.

Well, maybe more later if I can figure some more out.

satellite tracking software

Posted in amateur radio, programming on January 14th, 2008 by scott – Be the first to comment

I wasn’t extremely happy with the PC satellite control software out there, so I decided to do something about it. The process was quite a learning experience – it’s my first true multi-threaded GUI app (as opposed to the web apps I’m usually building) and I learned a lot about basic satellite prediction.

It’s based on bits and pieces of other open-source software out there, but
architected using a more modular approach with decoupling done through a series of event handlers set up as a bi-directional message bus. I release the code on Google Code and wrote an article for the AMSAT Journal (122.55 KB).