mostly harmless is a minimal audio plugin framework for C++20. It's first and foremost a wrapper around the CLAP API, capable of building CLAP, VST3, Audio Unit and Standalone targets.
If you're compiling VST3 targets, the responsibility to ensure you're adhering to the Steinberg VST3 License agreement is firmly on you!
The framework is in active development, alongside some of our own plug-ins, and there are some notable missing features (resizable gui being one of them..), so if you're thinking of giving it a go, please bare in mind that we're still working on it.
If you have any questions, the best way to reach me is via The Audio Programmer Discord, I'm @Meijis.
Documentation is built automatically, and hosted here. For convenience, it also includes the documentation for marvin.
While the framework itself doesn't provide anything in the way of audio helpers ala something like JUCE, it ships with our sibling dsp library marvin, should you need some convenience helpers and basic audio features.
The goal of the framework was to provide the bare minimum we (as in SLM Audio) need to write a plugin - and as such we don't provide any kind of gui framework of our own. We do, however, provide a thin wrapper around choc's WebView, and plan to implement similar minimal wrappers around a couple of other frameworks.
We also provide an interface with hooks for you to implement your framework of choice, in mostly_harmless::gui::IEditor
.
Firstly, we'd recommend taking a look in the examples
directory for a real-world use case, and the FX Plugin Tutorial in the docs directory, which talks you through some of the framework's core ideas, and how to set up a simple gain plugin project. We also provide a (wip) python script to generate the boilerplate needed for a new project for you, found in the root directory.
Usage is
python3 create.py <name> <dest_path> <fx | instrument> [no_gui | web | raw_gui]
where <>
denotes a required field, and []
denotes an optional field. The final field, for gui, if not provided, will default to no_gui
.
I realise it's a little janky at the moment having positional args instead of the usual --some_flag=something
approach, and plan to refactor it to be a little more user friendly in future.
mostly harmless is built with CMake, and supports Windows and macOS (Linux support is on the roadmap). It can be consumed either as a git submodule, or as a FetchContent dependency.
We provide a convenience function to set up your plugin targets, mostly_harmless_add_plugin
. This function will create targets for the specified formats, and link them to the necessary dependencies. Note that if you specify the AU format, a few more arguments become neccessary - the arguments are detailed below.
mostly_harmless_add_plugin
will create several targets based on the arguments provided to the FORMATS
field. Internally, we create a static library named based on the value you provide to the YourTarget
argument, with linkage to the library dependencies, and then link our format targets to that - so after the call to mostly_harmless_add_plugin
, the usual cmake rules and techniques apply to the shared target.
For example, to add some sources to the target:
[1] - See here for a full list of available features.
[2] - These are the au specific 4 letter idents you get when you scan with auval - options are as follows:
We also provide a helper to embed assets into your binary, (essentially sugar around CMRC
) and a corresponding cmake function to call this, mostly_harmless_add_binary_data
.
This will create a static library called BinaryData
containing your resources, and add the resulting header to your include path. The value you pass to the TARGET_NAME
parameters will dictate the name of the generated static library, the resulting filename (prefixed by mostly_harmless
), and the namespace the binary resources are contained in (also prefixed by mostly_harmless
).
The generated header provides a free function, getNamedResource()
to access binary resources through, which takes a ( relative to root) path to a resource, and returns a std::optional<BinaryResource>
, where BinaryResource
is defined as:
If the queried resource isn't found, getNamedResource()
will return std::nullopt
.
As mentioned above, the pathing to the resource is relative to the value you passed to the ROOT
parameter in CMake. For example, for a dir structure
if ROOT
is set to ${CMAKE_CURRENT_SOURCE_DIR}/resources
, then to access BottomText.png
:
A full usage example then:
You're not limited to a single library of binary resources either, which could be useful for separating resources of a different category or purpose into different headers, etc etc etc.
We've included the boilerplate for various projects in the boilerplate
directory - these should serve as a good starting point for your plugin sources. As previously mentioned, you can also check out the examples
directory for more inspiration.
mostly harmless depends on the following libraries:
This framework wouldn't exist without the advice, moral support and help of mthierman, Ben Vining, Signalsmith and the legions of incredible people in The Audio Programmer Discord.
SLM Audio Brat Summer 2024, all rights reserved.