Creating multiple instances of a dll object
Hey all,
I'm creating a plugin for Unity which will link in a C++ music synthesis engine. I am accessing it via a dll, which handles all the audio processing work. As the dll is an audio engine, it has a lot of complicated parts including many global variables. In order to be able to do synthesis on many different settings and different spatial points within a scene, I'd like to be able to create multiple objects, each with their own independent instance of the audio engine.
However, this is not currently easy, and by default C# and Unity do not allow multiple instances of a dll (even if loaded from separate files). Even if I have two different gameobjects loading the dll, if one changes the value of a global variable it affects the other as well.
How can I create independent instances of these dlls?
Thanks in advance for any help.