Cycling74 / rnbo.unity.audioplugin

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

Getting a Parameter in Unity is broken or am I doing something wrong? #44

Closed JimPapanick closed 2 months ago

JimPapanick commented 2 months ago

Hi all, I am trying to get the current value of a parameter called "FzeroCompare" but no output was given in the Debug.Log So I tried making a simpler parameter, and tried a simple counter called "test" I exported the plugin with the name "fzeroCompare3"

You can see in the images that the Log doesn't show any changes in any of the two parameters while when I open max they run just fine.

What is going wrong? image image

x37v commented 2 months ago

one thing to note is that I think unity's plugin view isn't monitoring for parameter changes coming out of your plugin, so the GUI sliders won't update.. right @jinpavg ?

x37v commented 2 months ago

@JimPapanick I see that you haven't set the Instance Index in the mixer to 1.

jinpavg commented 2 months ago

That's right @JimPapanick -- you'll need to make sure that you Instance Index (currently set at 0.00 key in your screenshot) matches the instance index you set in your script. But to @x37v 's point -- yes, the GUI will not update the visualization of the sliders in your plugin inspector in response to your plugin's parameter values changes. If you want to debug these values while playing in editor, you could log out the values, for example:

https://github.com/Cycling74/rnbo.unity.audioplugin/blob/main/docs/PARAMETERS.md#getting-a-parameter-value

JimPapanick commented 2 months ago

I'm still not getting the counter's values (they should range from 0 -100 as shown in max/msp screenshots).

I'm not sure what instance index is , never needed it before but now that i set it to "1" the parameter's values are just "1". I don't understand why this happens since both parameters should give their own unique values at any current time image

jinpavg commented 2 months ago

Hi @JimPapanick , thank you for the screenshot, this helps clarify what's going on. On line 30 and 31, you are successfully getting the value of your FZeroCompare and test params -- but you've set them explicitly to the value of 1 on lines 24 and 25.

It seems like you want to know what your patch sets as the value of these two parameters. Could you try removing lines 24 and 25, where you set those parameters to the value of fzeroHigher and testOn, which you've defaulted to 1?

JimPapanick commented 2 months ago

Thanks! Only problem now is that fzero doesn't seems to show any changes in Unity In max/msp it does It does take audio input and the counter does give the values that it should (I just commented them out to avoid flooding the log), so it should give output according to it's input image image

x37v commented 2 months ago

I wonder if you're having issues because you don't have a stereo effect?

Maybe try adding in~ 2, out~ 1 and out~ 2 I'd probably just route in direct to out.. a pass thru, but you can still keep your fzero on in~ 1

JimPapanick commented 2 months ago

This worked weirdly enough! This is the new patch. I don't know why this would work since I only want the patchers data and not it's audio output. Only step now is to put it's gain at 0 since I don't want it's output to be heard in the game image image