Page 1 of 1

Global Variables

Posted: Wed Nov 23, 2016 3:04 am
by S1User
It seems that global variables used in Ruby are shared even between VST plugin instances?

I notice that with this plugin I'm working on, that I had to circle back and make the arrays local because when they were global they affected different plugin instances on different tracks. Is this normal? If so, there may be some useful application for that with plugins.

Re: Global Variables

Posted: Wed Nov 23, 2016 3:13 am
by KG_is_back
yes it is normal. Instances of the same plugin share ruby interpreter, because they are instances of the same class. That means they effectively share everything in ruby that can be considered global (Constants, class and method declarations, class variables, etc.)

Re: Global Variables

Posted: Wed Nov 23, 2016 4:45 pm
by S1User
Thanks. I incorrectly assumed that the Ruby classes would be instance specific when they were (I assume) converted to C++ or whatever on VST compile. Knowing otherwise now, there is some opportunity there to pass data between different plugin instances that I hadn't considered.

I'll have to look more into that.