Page 1 of 2

Multiple instances of a plugin in DAW?

PostPosted: Sun May 16, 2021 8:06 pm
by martinvicanek
I am having erratic hangups with Reaper when I use three instances of my plugin La Voz Cantante. It does not happen if I only load one instance. Is there a problem with having more than one instance of the same plugin in a daw? For instance (no pun intended), the preset parameters have similar names in each instance, would that be a concern? What about Ruby?

Re: Multiple instances of a plugin in DAW?

PostPosted: Sun May 16, 2021 8:36 pm
by adamszabo
I never had such issues. Maybe its a combination with your plugin and Reaper? Did you try it in a different daw?

Re: Multiple instances of a plugin in DAW?

PostPosted: Sun May 16, 2021 8:51 pm
by martinvicanek
I have only Reaper to test with. But I can try FS3.x vs. FS4, 32 vs. 64 bit, etc. However, before I do I wanted to know if multiple instances can be a problem because my findings seemed like a cue.

Re: Multiple instances of a plugin in DAW?

PostPosted: Mon May 17, 2021 5:03 am
by adamszabo
I loaded six La Voz Cantante 6B in FL Studio and it works just fine over here.

Re: Multiple instances of a plugin in DAW?

PostPosted: Mon May 17, 2021 7:46 am
by Spogg
On several occasions I’ve loaded multiple instances of a FS plugin in Reaper without issue. It might be down to your audio interface ASIO setup. Did you try to increase the buffer size?

As I understand it, having the same plugin with the same preset parameters etc should be no problem because each instance is treated in isolation by the DAW.

Re: Multiple instances of a plugin in DAW?

PostPosted: Mon May 17, 2021 8:22 am
by tulamide
While for all instances of the same plugin only one Ruby engine runs, you would only have problems when using (caution: I might use the wrong wording here, sorry, I'm a stupid German)singleton globals. Methods, class instances and other variables than globals are per instance of your plugin.

What I mean by singleton? When using globals not in instances, but in class definitions. Such a global would only exist once for all instances of your plugin. It could be used for inter-plugin communication, but it is too risky, so I don't promote it.

Code: Select all
class Klass
  WORLDDOMINATION = True
end
## WORLDDOMINATION will exist once for ALL instances of Klass in ALL instances of the same plugin.


Other than that you're safe.

Re: Multiple instances of a plugin in DAW?

PostPosted: Mon May 17, 2021 11:15 am
by Spogg
tulamide wrote:... for all instances of the same plugin only one Ruby engine runs ...


I’ve read this before but not really understood just how the Ruby engine can be shared and in common.

Does a plugin load the Ruby engine into memory and other similar or identical plugins will look there first? That would suggest something like static (absolute and defined) memory addressing rather than dynamic. It feels counter-intuitive that a DAW would allow such behaviour.

Just out of interest!

Re: Multiple instances of a plugin in DAW?

PostPosted: Mon May 17, 2021 1:39 pm
by tulamide
Spogg wrote:
tulamide wrote:... for all instances of the same plugin only one Ruby engine runs ...


I’ve read this before but not really understood just how the Ruby engine can be shared and in common.

Does a plugin load the Ruby engine into memory and other similar or identical plugins will look there first? That would suggest something like static (absolute and defined) memory addressing rather than dynamic. It feels counter-intuitive that a DAW would allow such behaviour.

Just out of interest!

It has nothing to do with static memory.
But it has to do with how DAWs deal with plugins.

But first, please understand that Ruby is an application. It is just window-less. And just as you don't need static memory to run Flowstone, you also don't need it to run Ruby.

A dll contains instructions that tell the parent application what to do and how. It is not a fixed space in memory, filled with random bits and bytes. When a DAW loads a DLL it allows memory to be allocated for whatever functionality there is (here, instruments and effects) under supervision. You access the dll with so called entry points, which are specifically designed function calls. Now, when the same plugin is used again on another track, instead of allocating another huge portion of memory, it simply allows the same function calls to be executed in the original memory space. This is clever. It prevents memory overloading even under minimal RAM conditions, and at the same time the function calls are of course giving different results, depending on the caller. Exactly like two people can use a pocket calculator, the first asking for the result of 3 + 4, and the second asking for the result of 9 * 13. The same pocket calculator will give correct, different results to those two different people.

Since -spoken simplified- the dll only exists in memory once for all plugin instances, Ruby also exists only once for all instances, because only one dll called Ruby to run. It's a startup call, once loaded, it will neve be called again.

If I was good enough at explaining, you now also see why there are several Ruby apps running, when you load several different plugins.

Re: Multiple instances of a plugin in DAW?

PostPosted: Mon May 17, 2021 4:46 pm
by Spogg
Thanks for the detailed explanation tulamide!

:D

Re: Multiple instances of a plugin in DAW?

PostPosted: Mon May 17, 2021 5:08 pm
by RJHollins
That was clear to me .... thanks T for the explanation. 8-)