Placeholder-Software / Dissonance

Unity Voice Chat Asset
70 stars 5 forks source link

[bug] Multiple Tokens Broadcastings when Broadcast token is absent in overlapping channels #102

Closed KokopeIlI closed 6 years ago

KokopeIlI commented 6 years ago

Context

Currently Using several colliders as triggers to act as private rooms. There is a public global channel that ALL players should be able to listen to at all times. and there are private rooms that no one but te individuals in the private rooms can hear. Currently, when a player moves from the public room, to the private room, the public room can still hear the private room, even when the public broadcasting channel token is absent

Expected Behavior

A player should be able to hold a private conversation in a private room while still being able to hear audio from the public room.

Actual Behavior

Players enter a private room, but still broadcast to overlapping public room, even without a proadcasting token

Workaround

None found

Fix

Not obligatory! If you think you know exactly how this problem should be fixed tell us how

Steps to Reproduce

Provide a detailed set of steps to reproduce the problem

  1. Create a private room that is activated manually using a capsule collider, not by using the triggers on the components.
  2. Create a Public room with separate tokens for broadcast and receive
  3. when moving from public to private remove ONLY the public broadcasting token
  4. speak from private room and the players in the public room will still hear you.

Your Environment

Include as many relevant details about the environment you experienced the bug in

martindevans commented 6 years ago

Hi Kokopeili,

I've just managed to track this down to a bug in how soft fading is implemented. Way back in Dissonance 3.0.0 we introduced a feature which would softly fade channels out when the user stopped speaking, this sounds much nicer than simply cutting off the channel. However, it looks like the check for "when the user stops speaking" does not take into account tokens, so the channel fade out never starts and thus the channel never closes (because it's always waiting for the fader to reach zero).

You can fix this by changing VoiceBroadcastTrigger update a little. Change line 300 from:

if (CurrentFaderVolume <= 0)
    CloseChannel();

To:

if (CurrentFaderVolume <= 0 || intent)
    CloseChannel();
KokopeIlI commented 6 years ago

Martindevans, I'm sorry for the late response, I have adjusted the above code to reflect your changes but I am still encountering the same issue.

martindevans commented 6 years ago

Could you email me (martin@placeholder-software.co.uk) your invoice number. I'll send you back the latest version of Dissonance (currently awaiting approval from Unity to release on the asset store). I fixed the bug but in a slightly different way to how I mentioned above, hopefully the temp fix I told you before was wrong and the real fix will resolve your issue :)

KokopeIlI commented 6 years ago

Yes of course. I have to say your turn around time is incredible. Thank you for your dedication!

REDACTED

On Sun, Jul 8, 2018, 2:46 PM Martin Evans notifications@github.com wrote:

Could you email me (martin@placeholder-software.co.uk) your invoice number. I'll send you back the latest version of Dissonance (currently awaiting approval from Unity to release on the asset store). I fixed the bug but in a slightly different way to how I mentioned above, hopefully the temp fix I told you before was wrong and the real fix will resolve your issue :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Placeholder-Software/Dissonance/issues/102#issuecomment-403307824, or mute the thread https://github.com/notifications/unsubscribe-auth/AmzB0hukkbl_8X_RBsZg1cSuT5pBcrOyks5uElOTgaJpZM4U8Zbp .

martindevans commented 6 years ago

Woah, don't give out your invoice number in public! You'll need to email me directly (rather than reply to this issue thread) so that I know who to send back to :)

martindevans commented 6 years ago

Reported not fixed by latest update:

What I did try was changing it to push to talk and it worked just fine. But I found that if I held down the PTT when I moved from a public region to a private one it would continue to broadcast. I dont know if that helps, let me know if there is anything more I can do.

martindevans commented 6 years ago

When you say:

Create a private room that is activated manually using a capsule collider, not by using the triggers on the components.

What exactly are you doing to "activate" the room? Just enabling/disabling it when the capsule enters/leaves?

KokopeIlI commented 6 years ago

I have several private "regions" that are static in the world, when a player passes through them it calls a trigger method(the one that I sent to you) that adds the Broadcast/Receive token to the comms object for the private channel, and then removes just the "PublicChat" token. It does the reverse when a player steps out of a region.

I would have to say that it is not an entirely accurate description since the audio regions are static from the get go, sorry for the confusion

On Mon, Jul 9, 2018 at 9:36 AM, Martin Evans notifications@github.com wrote:

When you say:

Create a private room that is activated manually using a capsule collider, not by using the triggers on the components.

What exactly are you doing to "activate" the room? Just enabling/disabling it when the capsule enters/leaves?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Placeholder-Software/Dissonance/issues/102#issuecomment-403481579, or mute the thread https://github.com/notifications/unsubscribe-auth/AmzB0tdCTr_5t5KNnhYI9YnEcQtUXTj5ks5uE1xzgaJpZM4U8Zbp .

martindevans commented 6 years ago

Ah yes, I forgot about the reddit discussion with the code samples. I'll go check those out again. Thanks :)

KokopeIlI commented 6 years ago

Let me know if you want me to test/try anything. Im at work till 6 but I'll be able to work on it after that.

On Mon, Jul 9, 2018, 9:43 AM Martin Evans notifications@github.com wrote:

Ah yes, I forgot about the reddit discussion with the code samples. I'll go check those out again. Thanks :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Placeholder-Software/Dissonance/issues/102#issuecomment-403483788, or mute the thread https://github.com/notifications/unsubscribe-auth/AmzB0qXl4aOEllG45f61-4i4XtcVhIAWks5uE14TgaJpZM4U8Zbp .

martindevans commented 6 years ago

I can't reproduce this issue with the latest changes. I made some changes to the demo scene:

  1. Change global chat room broadcaster to require Test Token
  2. Change global chat room to voice activation
  3. Add this code:
void OnGUI()
{
    if (GUILayout.Button("Add 'Test Token' To DissonanceComms"))
        FindObjectOfType<DissonanceComms>().AddToken("Test Token");
    if (GUILayout.Button("Remove 'Test Token' From DissonanceComms"))
        FindObjectOfType<DissonanceComms>().RemoveToken("Test Token");
}

When using Dissonance 6.2.3 (the one I sent to you by email) this works. Speaking continuously (so it never stops broadcasting) and then clicking "Remove" cuts off the broadcast. If I try this same test with Dissonance 6.2.0 clicking "Remove" does not cut me off (until I stop speaking).

If you try this with a demo scene using Dissonance 6.2.3 does it work for you? Do you agree that this is a good approximation of the problem you're having?

martindevans commented 6 years ago

Dissonance 6.2.4 went live on the asset store yesterday. As far as I can tell this was fixed in the previous version (6.2.3) so I'll close this issue now - of course please re-open it if the issue persists.