Limit plugin to one instance for demo purpose

Hi is this an easy thing to do somewhere im not finding. just unlimited trial but limit to one instance of the plugin?

I think you’d have to have the different instances of the plugin make each other aware of their existence using a shared object (SharedResourcePointer) or Inter Process Communication (InterProcessConnectionServer).

nice i thought it would be really challenging didnt know how it was acheived in the first place. When i used to demo lots of software.

IPC is not really necessary (but can be used [1]) for this … an alternative is to use a SharedResourcePointer, pointing to a “SharedStruct” of your own construction, containing pointers to your PluginEditor and PluginProcessor instances, and in the constructor of your processor, check the SharedStruct to see if another instance of your plugin has already been instantiated …

Bonus points, if you decide to enable multi-instances, you’ve got a SharedStruct, good to go. Handy for syncing parameters between instances, and … so on …

[1] - but is expensive

Indeed SharedResourcePointer is preferred. IPC would be needed in the case where each plugin instance is loaded in its own process, which is rare.

Is it that rare? More and more DAWs are starting to host plugins in separate processes

I think most of them use a process per plugin rather than per plugin instance. So several plugin instances are likely to still be in the same process. At least based on other comments I’ve seen on the forum.

2 Likes

Oh I got an idea Application Properties just check that a plugin is live when it is destroyed you decrement a counter.

If that entry isn’t there then disable every instance

SharedResourcePointer I guess