Cycling74 / rnbo.unity.audioplugin

RNBO Adapter for Unity's Native Audio Plugin
MIT License
40 stars 8 forks source link

Instance index ignored? #5

Open arokhsar opened 1 year ago

arokhsar commented 1 year ago

In the example project with the QuantizedBuffers plug-in, if you go to the DrumKitTrack and change the Instance Index to any value other than 1, even though the DrumKit script is hard-coded with an instanceIndex value of 1, the script still seems to be communicating with the same QuantizedBuffers instance.

For example, I would expect that if I change the Instance Index on the plug-in to 2, but still do QuantizedBuffersHelper.FindById(1), I would no longer hear any drum samples when I press the input keys. Instead, it behaves as if it the indices match.

Similarly, if I keep the QuantizedBuffers index at 1, but change the instanceIndex in the DrumKit script to any other value, QuantizedBuffersHelper.FindById still seems to return that same QuantizedBuffers plug-in.

x37v commented 1 year ago

@arokhsar This is interesting.. I'll have to look into it.

The key element seems to be that you have to have an index that corresponds in your script and plugin on first run, then after that, you can change either and run again and you can still trigger the drums.

It is an odd behavior and not ideal for development but it doesn't seem to be critical at least.. if you restart your editor the behavior should go away if you keep your indexes aligned?

arokhsar commented 1 year ago

Thanks! I agree that it doesn't seem critical, and you are right -- if you restart the editor the behavior goes away.

x37v commented 1 year ago

I'll hunt this down and fix it at some point but I'm happy it isn't making things unusable in the mean time