Getting Started

Guillaume Piolat edited this page Oct 16, 2018 · 20 revisions

Clone The Repository

First, make a local copy of the Dplug repository

git clone https://github.com/AuburnSounds/Dplug.git

Open the Dplug/ directory and navigate to an example like examples/distort or examples/clipit.

When making a new plug-in it is recommended to start from a Dplug example.

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 (contains pluginInfo that is parsed during compilation)
  • gfx (images used by the gui)
  • fonts (font used by the gui)

Getting the VST SDK

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.

Building

Windows

To build the plugin you will need DUB, and either dmd or ldc installed on your system.

Note that both dmd and ldc come with their own copy of the dub utility. You should be able to use either one.

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.

macOS and Linux

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.

dplug-build is useful (instead of dub) whenever your are:

  • building macOS Universal Binaries
  • building a plug-in in several bitness
  • building an AAX or AU plug-in which need a special packaging
  • building for every OS in the same way
  • building a plug-in in different versions ("configurations" as defined by dub.json)

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.

Debugging

With Visual Studio on Windows

You can use Visual Studio + the VisualD extension to have working debugging on Windows. Generate a .sln solution file with dub generate visuald or dub generate -a x86_64 visuald for 32-bit or 64-bit plugins respectively. Launch a host program from there. You are now attached.

With Visual Studio Code on macOS and Linux

You can use Visual Studio Code and the native-debug extension

Break this glass if you can't debug on Windows

When everything fails, you can use the OutputDebugMessageA Win32 API as a sort of printf replacement, and launch dbgview.exe as an Administrator. This enables a barebones print-based debugging.

Break this glass if you can't debug on macOS

LLDB usually saves the day. lldb -- /Applications/MyHost.app will launch a LLDB session from the command-line. At startup, the file .lldbinit is taken as an input command list, this can improve scriptability. You can then use core.stdc.stdio.printf to debug.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.