Difference between revisions of "Creating Commercial Plugins"
|Line 60:||Line 60:|
== Publishing ==
== Publishing ==
you want to have your plugin publish please [:moddevices.comus].
Revision as of 20:12, 18 January 2018
In this page we give you an overview of how the license authentication mechanism works and how to build your commercial LV2 plugins using the mod-plugin-builder. If want to know information regarding the legal aspect of the commercial plugins please contact us.
Creating commercial LV2 plugins is just like the regular ones except that you have to link the mod license API to them. Here in this page we assume you already know how to build plugins using the MPB, if you don't please read How To Build and Deploy LV2 Plugin to MOD Duo first.
We, MOD Devices, take care of generating a license file per plugin per user. The license file looks like this:
John Doe http://example.com/my-commercial-plugin 00112233445566778899AABBCCDDEEFF I6FvK5XRu8PP/u5AJ+oi4rHnk2MizRln0Bmd/mk3gAIWpvbLPsnDgX5ZnI2hFv2Y mEUkKFxPRQheb7bVUSRuLT9NWYA2aEier9MNozlSUP7+c7Jb+7YBPdWBL/O1Ckqb N2kq4+ZY3oOWWSwxV9jzAZluWtEHzPuJv6DuHbSVtD0=
The first line is the name of the user, the licensee. The second line is the URI of the plugin that the license file applies to (note: this can also be a plugin collection). The third line is the MOD unit unique ID that the license file applies to. The next 3 lines are exactly the same content as the initial 3 but encrypted with a MOD Cloud private key.
With this file setup we're able to know the user name, plugin URI and MOD unit ID directly by reading the file, but it still offers protection by encrypting the same content on the file. If someone changes something in the first 3 lines, the encrypted content will no longer match and thus the plugin runs unlicensed.
If the license file is invalid or not found, the plugin must generate some random noise in the output, representing then a trial plugin. Such noise function is provided by the library.
The API / Library
The library package has 3 main files:
- mod-license.h the LV2 API that the host implements in order to support the licensing API. This is actually only meta-data.
- libmodla.a the API that the commercial plugin developer must implement in its LV2 plugin.
- libmodla.h the static library containing the implementation of the license authentication.
How to use the library
- Add the library include:
uint32_t run_countas a member variable of the plugin object, initialized to 0 on instantiate/construction
mod_license_check(host_features, PLUGIN_URI);during instantiate function
- In the beginning of your process function, call
run_count = mod_license_run_begin(run_count, nsamples);. Where
nsamplesis the number of samples in the process function.
- For each audio output, call
mod_license_run_noise(run_count, audio_output[i], nframes, i);
- At the end of your LV2 descriptor extension_data function use
Additionally, you need to edit the meta-data in your LV2 plugin TTL file by adding the following lines. This will let the host know that the plugin supports such LV2 feature.
lv2:extensionData <http://moddevices.com/ns/ext/license#interface> ; lv2:requiredFeature <http://moddevices.com/ns/ext/license#feature> ;
There is a full example of commercial plugin in our github repository, check the source code here. Once you are done understanding the code, take a careful look at the Makefile and make sure you use the same flags and commands as the ones in the example. This is very important to help with the protection of your plugins.
When you are ready run
./build commercial-plugin-example inside the MPB directory to build the plugin. Note that you'll need to run
./build libmodla-rebuild first if you already have your plugin build system all set (i.e.: the bootstrap done).
If you want to have your plugin publish please contact us.