Adnezz / VoiceFalloffOverride

GNU General Public License v3.0
7 stars 4 forks source link

Found [an] possible cause of the override not working in some worlds. #1

Closed lil-fluff closed 3 years ago

lil-fluff commented 3 years ago

I was messing around with voicefalloffoverride in several worlds trying to figure out why in the heck it would make this "popping" sound when toggling on and off, regardless of if I wanted to increase OR reduce the falloff. (This was in worlds that the mod doesn't self disable due to risky check or tag check).

Using some magic and the power of UnityExplorer, I discovered many of these worlds have one thing in common, I kept seeing a gameobject called "BetterPlayerAudioController".

Github: https://github.com/Guribo/BetterAudio Wiki: https://github.com/Guribo/BetterAudio/wiki

I'm trying to contact the author of the UDON component directly (old friend of mine, he also made SUVA for vtubing stuff)

However I have already made a fairly rudimentary patch to the UpdateAllPlayerVolumes() method, which will check for the BetterPlayerAudioController component, and simply disable the UdonBehavior of the component until VFO is disabled again.

In my testing, while this does kinda limit the AudioSource effects applied by BetterAudioController, I assume that if you are wanting to hear stuff farther away, reverb, player occlusion, and better voice directionality really would be more of a hinderance rather than helpful, and for reducing to only the voices immediately nearby (which is more why the mod was made to begin with) reverb and occlusion are also not as effective, and the standard audio component from unity already does have directionality (it's what we've used in vrc for years.)

So for me, and likely for many people, a simple toggle between world/udon overrides, and our own with VFO seems like a workable solution, unless the authors wish to further make this all compatible.

My Gist for the temporary fix: https://gist.github.com/lil-fluff/d4e837300b62015f6ebdf22128862623

UnityExplorer: audio fix (2)

Adnezz commented 3 years ago

Well, that's one mystery solved! I had wondered why it seemed like in some rare worlds, any changes I'd make just wouldn't happen at all. What I ultimately want to do is proxy the function that gets called to update the voice audio parameters on a player, which would prevent any other code from overriding the VFO setting, but that's currently beyond my skills.

Thank you for submitting this, I'll look at including it in the next update.

Adnezz commented 3 years ago

Added your fix in, though with a somewhat different implementation. It does the check for the BPAC game object at the same time it samples the default voice range, which should help prevent any issues with the odd race condition on joining a world. Really appreciate your help!