Porting VST Plugins to BeOS
With VST 2.0 the BeOS (x86 only) has become one of the supported platforms of Steinbergs VST standard (the others are Windows, MacOS and SGI/MOTIF). This includes full UI support if you're using the cross-platform VSTGUI library. In fact you can code one version of the plugin and recompile it on all platforms without much hassle. But also VST 1.0 plugins can be easily ported with one little modification, as long as you're not using custom, platform-dependent UI code.
On this page I'll give you detailled instructions on how to port your plugs. So if you're new to BeOS, but have it installed somewhere near you and are willing to port, this is for you. If you need help or don't have access to a BeOS machine, feel free to contact me at firstname.lastname@example.org.
Install the SDK Files
First of all, if you don't have the BeOS specific files of the VST2 SDK (i.e. the folder 'beos'), you must first download the BeOS version of the SDK from the Steinberg site. Otherwise you'll probably have the files on a floppy or another partition of the same machine. In BeOS you can easily access both by 'mounting' them: right-click the Desktop to bring up its context-menu, select 'Mount' and choose the partition you want to access, or 'floppy' if the files are there. The icon of that disk will appear on the Desktop, simply double-click to browse its contents.
Then you'll have to put the files into a appropriate place on the BeOS partition. In BeOS the directory "/boot/home" is there for user-specific files, so everything that is yours goes there. I would recommend creating a folder inside the home directory called 'develop' and a subfolder called 'vstplugins' inside of that. Copy the directory 'source/common' from the SDK into the 'vstplugins' folder, and the file called 'vstgui.o' into a new folder 'vstplugins/lib'.
After you've done that, the structure should look something like this:
/boot/home/develop/vstplugins/ /boot/home/develop/vstplugins/common AEffect.h aeffectx.h AEffEditor.hpp AudioEffect.cpp AudioEffect.hpp audioeffectx.cpp audioeffectx.h vstcontrols.h vstgui.h /boot/home/develop/vstplugins/lib libvstgui.o
Note: the directory structure above is only a recommendation. Of course you can put the files anywhere you want, but I'll assume this structure for the following instructions.
Create a BeIDE Project
To simplify things even further, I've created a BeIDE template for your convenience. Get it here: vst_stationery.zip [3 kB]. Install it as suggested by the included 'Read Me' file.
When you've got that, launch the BeIDE from the Be/Applications menu, and a empty editor window will pop up. Select 'New Project...' from its 'File' menu and you should be getting this window:
Select the 'VST PlugIn' entry and click 'Create', leaving the 'Create Folder' option checked. Next you will be asked to select a directory and project name. Using the file panel, navigate into the 'develop/vstplugins' directory you've created before, and type in the name of your plugin (e.g. MyPlugIn.proj), which will become the project and folder name, and continue by clicking 'OK'.
Now you'll have to change the name of the binary image that will be linked (i.e. what will become the file name of your plug). To do this, select 'Settings...' from the 'Window' menu. A window similar to this should open:
Select the 'Project/x86 ELF Project' item in the left-hand list. Then enter the name of your PlugIn into the 'File Name' text field and 'Save'.
Import the PlugIn Source Code
Next thing is to copy the source code of your PlugIn into the project folder. To access your code on a different partition see Install the SDK files. You'll just need the actual source (i.e. *.cpp, *.hpp and *.h). When you've copied them into the project directory, you simply need to drag the *.cpp files into the project window, which will add them to the list. Your project window should now look something like this:
Now you can try to compile by choosing 'Make' from the 'Project' menu. Normally this should just work.
If your plug uses the VSTGUI though, you'll get a linker error here. The next section details on the additional work to do for PlugIns using the VSTGUI…
Add VST Resources
If you're using the VSTGUI, you'll have a couple of image files that need to
be included with the project. The obvious way to do this is by putting them in a
resource file and adding that into the project. On BeOS you have two command
line utilities to put data into resource files: mwbres and xres. I
will be using xres here, because I think it's a bit simpler to use.
The first thing to consider is the file format of your images. On BeOS you're not limited to use uncompressed bitmap files for resources, you can also use e.g. JPEG files which will reduce the binary size of your plugin quite considerably. So if you have images that can handle a bit of compression loss (maybe because they're 'blurry' anyway), you might want to experiment with this option.
Next you'll need the mapping between files and resources IDs. Depending on your original development environment, you may find these in different places. Look out for files like resources.h or *.rc.
Now I recommend creating a short shell script to make the resource creation process persistent. This is an example for such a script:
# add_images.sh # adds image files to resources xres -o MyPlugIn.rsrc \ -a RAWT:128:Background background.jpg \ -a RAWT:129:MyKnob my_knob.bmp \ -a RAWT:130:MyFader my_fader.bmp \ -a RAWT:131:MyFaderHandle my_fader_handle.bmp
Here you can see that the utility xres is launched with a long list of arguments. The first argument (right after -o) is the name of the resource file you want to create. The next lines each add an image file to the resources. Here 'RAWT' is for 'Raw Type' which is always the type of choice for images. After that is the resource ID (which you should have found out before), optionally followed by a name. After that comes the images file name. You'll have to add such a line for every image you want to include. The backslashes above are important because they make the shell ignore the line breaks.
Store the above script (altered to fit your plugin) in a text file called 'add_images.sh'. Then launch the Terminal application from the Be menu, navigate into the directory where you stored the script and execute it by typing in its full name (case sensitive !). The requested resource file (MyPlugIn.rsrc in the example above) will be created in the same directory, and you'll have to add it to the project (by dragging it into the BeIDE project window).
One more thing is left: You'll have to add the libvstgui.o file to the project. Nothing special to do there!
Now, if you recompile and link the project, you shouldn't be getting linker
errors anymore, and the resources should've been added to the plugin binary.