Finally finishing up a basic implementation of my licensing scheme but I’m looking for what function to perform my license validation under.
I currently have it in one of my constructors, but this isn’t called until the plugin is opened (at least on the JUCE AudioPluginHost. Is there any function or codeblock that is called before that, or is that the earliest run code for a plugin?
The latter would follow my understanding of how plugins are setup and how some DAWs will open all the plugin UIs when you load a project that has them, but I wanted to confirm whether this was or wasn’t the case. Thanks!
I think what you want is the function in the processor that’s called something like ‘createFilter’ or whatever. It’s the function the host calls to get a new instance of the processor, that’s essentially the entry point of everything.
1 Like
As @Algernon says createPluginFilter
is generally the first function containing user code that is called. You could in theory return a nullptr if the validation fails, but I’m not sure how all DAWs would respond to that, maybe you could return a different processor, or just handle it in the processors constructor.
1 Like
Thanks! What I do is have a separate function called isValidated() that acts as the conditional for the audio output. Essentially validate() just tries to automatically check if there’s a license and if so will set the underlying flag to true.
If that get’s called in createPluginFilter, then everything else should fall into place, as opposed to having to wait for the window to open.
Usually people designing license schemes try to do the opposite:
If you check as early as possible, it will check during scanning already. This has two drawbacks:
- the scanning is held up regardless if your plugin is used or not
- your plugin gets blocked as disfunctional, so the user has no chance to activate
That’s why usually people only check after a few seconds.
3 Likes
The check in my case just sets a flag that kills the effected output and adds the ‘Load License’ button. So no pop-ups or anything to annoy users. So far in my tests it works ok whether you have a license already registered or not, but I’m open to ideas about where it could go wrong.