Create singleton for each plugin instance

I have a singleton in my plugin, which distributes wavetables to the audio classes. Now i’m running into problems, since multiple instances are sharing data, which they really shouldn’t.

I know how to resolve the issues by making it not a singleton and attaching one to each pluginprocessor, but it is a considerable amount of work.

Hence the question: Is there a way to make each instance use its own singleton?

Making it a member of each AudioProcessor is really the easiest way to do.

You could arrange the stuff in a map inside your singleton and access it each time with a uuid that is stored in the AudioProcessor.
But that is definitely more work and more error prone than refactoring the singleton into a member.

2 Likes