Difference between revisions of "Creating Commercial Plugins"
(7 intermediate revisions by 2 users not shown) | |||
Line 10: | Line 10: | ||
== Authentication == | == Authentication == | ||
− | + | The authentication process, among other steps, works by reading a license file which is generated by us, MOD Audio. The license file is per plugin, per user. The file contents looks like this: | |
John Doe | John Doe | ||
Line 23: | Line 23: | ||
lines are exactly the same content as the initial 3 but signed with our private key (also called signature). | lines are exactly the same content as the initial 3 but signed with our private key (also called signature). | ||
− | With this file setup we're able to know the | + | With this file setup, we're able to know the username, plugin URI, and device ID directly by reading the license, but it still offers |
protection by signing the same content on the file. If someone changes something in the first 3 lines, the signature will no longer | protection by signing the same content on the file. If someone changes something in the first 3 lines, the signature will no longer | ||
match and thus the plugin runs unlicensed. | match and thus the plugin runs unlicensed. | ||
− | If the license file is invalid or not found, the plugin must generate | + | If the license file is invalid or not found, the plugin must generate periodic silence in the output or another sound degrading method, representing a trial plugin. |
− | + | The periodic silence function is provided by default by the library. | |
== The API / Library == | == The API / Library == | ||
Line 35: | Line 35: | ||
* '''mod-license.h''' the LV2 API that the host implements in order to support the licensing API. This is actually only meta-data. | * '''mod-license.h''' the LV2 API that the host implements in order to support the licensing API. This is actually only meta-data. | ||
− | * '''libmodla. | + | * '''libmodla.h''' the API that the commercial plugin developer must implement in its LV2 plugin. |
− | * '''libmodla. | + | * '''libmodla.a''' the static library containing the implementation of the license authentication. |
=== How to use the library === | === How to use the library === | ||
Line 44: | Line 44: | ||
# Call <code>mod_license_check(host_features, PLUGIN_URI);</code> during instantiate function | # Call <code>mod_license_check(host_features, PLUGIN_URI);</code> during instantiate function | ||
# In the beginning of your process function, call <code>run_count = mod_license_run_begin(run_count, nsamples);</code>. Where <code>nsamples</code> is the number of samples in the process function. | # In the beginning of your process function, call <code>run_count = mod_license_run_begin(run_count, nsamples);</code>. Where <code>nsamples</code> is the number of samples in the process function. | ||
− | # For each audio output, call <code> | + | # For each audio output, call <code>mod_license_run_silence(run_count, audio_output[i], nframes, i);</code> |
# At the end of your LV2 descriptor extension_data function use <code>return mod_license_interface(extension_uri);</code> | # At the end of your LV2 descriptor extension_data function use <code>return mod_license_interface(extension_uri);</code> | ||
Line 56: | Line 56: | ||
There is a full example of commercial plugin in our github repository, check the [https://github.com/moddevices/mod-plugin-builder/tree/master/plugins/package/commercial-plugin-example/source source code here]. Once you are done understanding the code, take a careful look at the [https://github.com/moddevices/mod-plugin-builder/tree/master/plugins/package/commercial-plugin-example/source/Makefile 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. | There is a full example of commercial plugin in our github repository, check the [https://github.com/moddevices/mod-plugin-builder/tree/master/plugins/package/commercial-plugin-example/source source code here]. Once you are done understanding the code, take a careful look at the [https://github.com/moddevices/mod-plugin-builder/tree/master/plugins/package/commercial-plugin-example/source/Makefile 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 <code>./build commercial-plugin-example</code> inside the MPB directory to build the plugin | + | When you are ready run <code>./build commercial-plugin-example</code> inside the MPB directory to build the plugin. |
== Publishing == | == Publishing == | ||
− | If you want to have your plugin | + | If you want to have your plugin published please [http://moddevices.com/contact contact us]. |
Latest revision as of 19:51, 16 October 2024
Contents
Introduction
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.
Authentication
The authentication process, among other steps, works by reading a license file which is generated by us, MOD Audio. The license file is per plugin, per user. The file contents 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 device unique ID that the license file applies to. The next 3 lines are exactly the same content as the initial 3 but signed with our private key (also called signature).
With this file setup, we're able to know the username, plugin URI, and device ID directly by reading the license, but it still offers protection by signing the same content on the file. If someone changes something in the first 3 lines, the signature will no longer match and thus the plugin runs unlicensed.
If the license file is invalid or not found, the plugin must generate periodic silence in the output or another sound degrading method, representing a trial plugin. The periodic silence function is provided by default 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.h the API that the commercial plugin developer must implement in its LV2 plugin.
- libmodla.a the static library containing the implementation of the license authentication.
How to use the library
- Add the library include:
#include "libmodla.h"
- Add
uint32_t run_count
as a member variable of the plugin object, initialized to 0 on instantiate/construction - Call
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);
. Wherensamples
is the number of samples in the process function. - For each audio output, call
mod_license_run_silence(run_count, audio_output[i], nframes, i);
- At the end of your LV2 descriptor extension_data function use
return mod_license_interface(extension_uri);
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> ;
Plugin example
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.
Publishing
If you want to have your plugin published please contact us.