Singleton plugin


#1

I’m just getting into plugins and I was wondering what people have found as best practices to enforce allowing one single instance of a plugin?

The plugin will be an audio provider from another application so there should only be one instance. I was going to make my AudioProcessor a ReferenceCountedObject and have a static instance of it(thread safety needed?). Then in createPluginFilter return this instance. Or maybe just a dummy/empty plugin if the user does happen to create another instance.

Any tips/suggestions from anyone that’s run into this?


#2

Yep, that’s the thing to do. You can’t share an object between instances, because it’ll be getting its methods called multiple times in a way that it’s not designed to cope with.


#3

Good stuff… cheers