-
Notifications
You must be signed in to change notification settings - Fork 32
Getting Started
In this tutorial, we'll see:
- how to install a D environment
- how to build a D program
- how to build the
dplug-build
tool and its purpose - how to build the Dplug example plug-ins. We'll build an existing VST3, Audio Unit and/or LV2 plug-in.
Install a D langage compiler. A good starting point is the VisualD installer: http://rainers.github.io/visuald/visuald/StartPage.html
Alternatively:r
At the end of this process, you should have the dub
tool and a D compiler (LDC and/or DMD).
$ dub --version # the DUB D language package manager
$ dmd --version # the DMD compiler
$ ldc2 --version # the LDC compiler
LDC is recommended compiler for all final builds. DMD can be used in development to get faster build times.
A large majority of D programs can be built simply using:
$ dub
First, make a local copy of the Dplug
repository:
$ git clone https://github.com/AuburnSounds/Dplug.git Dplug
$ cd Dplug
- Link: Dplug Github
Build the dplug-build
tool, which is necessary to bundle plug-ins into the correct structure.
$ cd Dplug/tools/dplug-build
$ dub
Once dplug-build
is in your PATH
, you can examinate the available possibilities with:
$ dplug-build --help
dplug-build
is necessary for several reasons:
-
dplug-build
will give to your plug-ins the required structure, which is necessary for most combinations of plugin format and OS (One notable exception to this is VST2.4 plug-ins on Windows: those can be built using DUB directly, or VisualD). -
dplug-build
can build plug-ins in different DUB configurations and bitness in the command-line run, and bundle them together in an installer -
dplug-build
will fake theVST2_SDK
environment variable if you don't have a VST2 SDK, so that you can build other formats.
Go to the ClipIt or the Distort example directory from the fictional company Witty Audio.
$ cd Dplug/examples/clipit # a clipper distortion using the `dplug:flat-widgets` set of widgets
$ cd Dplug/examples/distort # a tanh distortion using the `dplug:pbr-widgets` set of widgets
Inside the folder, you'll find several directories and files. Below is a breakdown of important items and what they are used for.
-
main.d
(audio processing, parameters) -
gui.d
(UI code) -
dub.json
(configuration file for DUB) -
plugin.json
(containspluginInfo
that is parsed during compilation) -
gfx
(images used by the gui) -
fonts
(font used by the gui)
In order to build VST2 plug-ins with Dplug, you need to setup the VST SDK on your machine. https://www.steinberg.net/en/company/developers.html
Point a VST2_SDK
environment variable to the matching VST2_SDK directory in the SDK.
Example: export VST2_SDK=/Users/MyName/vstsdk3610_11_06_2018_build_37/VST_SDK/VST2_SDK
If you were to distribute VST2 plug-ins, be aware that you need an agreement with Steinberg.
Use the following command to build a VST 2.4 without dplug-build
:
$ dub -c VST # choose the "VST" configuration with -c or --config
Use the following command to build a VST 2.4 without dplug-build
:
$ dub -c VST # choose the "VST" configuration with -c or --config
Limitations:
- Note that on macOS, a barebones VST2 plug-in will not be usable by hosts except REAPER.
- A barebones VST3 plug-in is not usable in VST3 hosts and has to be renamed to
.vst3
first, and eventually put into the right system VST3 directory. - A barebones LV2 plug-in is not usable in LV2 hosts.
- A barebones Audio Unit plug-in is not usable in AU hosts.
- A barebones Audio Unit plug-in is not usable in AU hosts.
Open a terminal in the same directory as distort.d
and type dub --compiler=dmd
or dub --compiler=ldc2
If the build is successful, it will generate a new file called distort.dll in the current directory.
Building on macOS and Linux is slightly more complicated as it requires the use of the included dplug-build
tool.
Indeed, the generated .dylib
binary needs an application bundle in order to work.
Open a terminal in the tools/dplug-build
directory and type dub build
to build it with the default compiler.
To put it in your PATH:
sudo ln -s /my/path/to/dplug/tools/dplug-build/dplug-build /usr/local/bin/dplug-build
To build the distort example, navigate to the examples/distort
directory and type dplug-build
.
dplug-build
uses LDC as the default compiler, but you can use dplug-build --compiler dmd
if you prefer to use DMD.
Type dplug-build --help
to print the details of available parameters.
The only case that doesn't require dplug-build
to build a plug-in is when you're building a VST under Windows (or Linux) with a single configuration, for a single bitness.
Use any of the following methods:
- Run LDC in a 'VS Native/Cross Tools Command Prompt' (LDC checks whether the VSINSTALLDIR environment variable is set). LDC assumes the environment variables are all set up appropriately.
- Set the LDC_VSDIR environment variable to some Visual Studio/Visual C++ Build Tools installation directory, e.g., 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community'. LDC will invoke a batch file provided by VS to set up the environment variables for the selected 32/64-bit target platform, which adds an overhead of about 1 second for each linking operation. You can also set LDC_VSDIR to some non-existing dummy path; LDC will try to auto-detect your latest Visual C++ installation in that case.
- Set up the
etc\ldc2.conf
config file and specify the directories containing the MS libs (appending them to the 'lib-dirs' array; check out the LIB environment variable in a VS tools command prompt) as well as the C runtime flavor (e.g., appending '-mscrtlib=libcmt' to the 'switches' array). In case you prefer the MS linker over LLD, add the switch '-linker=<path\to\link.exe>'.
The dummy path method is recommended, as it's the most painless.
Set an envvar LDC_VSDIR
to some non-existing path
.