Voice2 API sound routing seems deficient

I'd like to understand the use cases that the Voice2 API team were aiming to support with the groups and receiver target.
My use case does not seem to be supported, and I'm hoping that's just because I don't know what I'm doing.
My situation is that I have a group in one building, that can all hear each other in real life and so do not want to hear each other "echo" over a laggy voice connection. There is another group in another building that can all hear each other in real life and so do not want to hear each other "echo" in the headset either. All of group 1 wants to hear all of group 2 over the headset. All of group 2 wants to hear all of group 1 over the headset.
Is there a way to implement this using PUN Voice2?
Thanks.

Comments

  • Hi @tonycowan,

    Thank you for choosing Photon!

    Each building is an interest group.
    Anyone from building X can hear and talk to anyone in the other building (building Y).

    Example:

    Building 1:
    public const byte INTEREST_GROUP_1 = 1;
    
    Building 2:
    public const byte INTEREST_GROUP_2 = 2;
    
    For anyone in building 1:
    PhotonVoiceNetwork.Instance.Client.GlobalInterestGroup = INTEREST_GROUP_2;
    
    For anyone in building 2:
    PhotonVoiceNetwork.Instance.Client.GlobalInterestGroup = INTEREST_GROUP_1;
    
  • JohnTube wrote: »
    Hi @tonycowan,

    Thank you for choosing Photon!

    Each building is an interest group.
    Anyone from building X can hear and talk to anyone in the other building (building Y).

    Example:

    Building 1:
    public const byte INTEREST_GROUP_1 = 1;
    
    Building 2:
    public const byte INTEREST_GROUP_2 = 2;
    
    For anyone in building 1:
    PhotonVoiceNetwork.Instance.Client.GlobalInterestGroup = INTEREST_GROUP_2;
    
    For anyone in building 2:
    PhotonVoiceNetwork.Instance.Client.GlobalInterestGroup = INTEREST_GROUP_1;
    

    Thanks JohnTube!

    This seems like a good solution for two buildings/groups. Is there a way to scale it beyond 2? If I had participants from three locations, how would that work. As I understand it, I have to assign a recorder to a specific group (a given headset only contributes sound to a specific group), so in the case where there are two groups, you set the recorder for group 1 people to target group 2 interest group, and for group 2 people you set the recorder to target group 1 interest group. But given that a recorder can only target one group (as I understand it), when there are three groups, I don't see how to configure it.
  • JohnTubeJohnTube mod
    edited October 15
    Is there a way to scale it beyond 2?
    Yes you can have up to 255 custom interest groups.
    But given that a recorder can only target one group (as I understand it)
    Yes correct, you can target a single interest group per Recorder at once.

    Depending on what you want to achieve exactly you can set the groups you want to be hearing (OpChangeGroups) and the group you want to target (Recorder.InterestGroup).

    A- if you want to talk to a single other building at the same time.
    B- if you want to talk to all other buildings at the same time.
    C- if you want to talk to more than one other building at the same time.

    ---

    here are three suggestions:

    solution 1 (you can try to extend to up to 255 buildings, if you want to talk to all the other buildings at once):

    public const byte INTEREST_GROUP_BUILDING_1 = 1;
    public const byte INTEREST_GROUP_BUILDING_2 = 2;
    public const byte INTEREST_GROUP_BUILDING_3 = 3;

    For anyone in building 1:

    PhotonVoiceNetwork.Instance.Client.OpChangeGroups(null, new byte[] { INTEREST_GROUP_BUILDING_2, INTEREST_GROUP_BUILDING_3 } );
    Recorder.InterestGroup = INTEREST_GROUP_BUILDING_1;

    For anyone in building 2:

    PhotonVoiceNetwork.Instance.Client.OpChangeGroups(null, new byte[] { INTEREST_GROUP_BUILDING_1, INTEREST_GROUP_BUILDING_3 } );
    Recorder.InterestGroup = INTEREST_GROUP_BUILDING_2;

    For anyone in building 3:

    PhotonVoiceNetwork.Instance.Client.OpChangeGroups(null, new byte[] { INTEREST_GROUP_BUILDING_1, INTEREST_GROUP_BUILDING_2 } );
    Recorder.InterestGroup = INTEREST_GROUP_BUILDING_3;

    ---

    solution 2 (if you want to be able to talk to two 'specific' other buildings at once):

    public const byte INTEREST_GROUP_BUILDINGS_1_2 = 1;
    public const byte INTEREST_GROUP_BUILDINGS_1_3 = 2;
    public const byte INTEREST_GROUP_BUILDINGS_2_3 = 3;

    For anyone in building 1:

    PhotonVoiceNetwork.Instance.Client.OpChangeGroups(null, new byte[] { INTEREST_GROUP_BUILDINGS_1_2, INTEREST_GROUP_BUILDINGS_1_3 } );

    Recorder.InterestGroup = INTEREST_GROUP_2_3;

    For anyone in building 2:

    PhotonVoiceNetwork.Instance.Client.OpChangeGroups(null, new byte[] { INTEREST_GROUP_BUILDINGS_1_2, INTEREST_GROUP_BUILDINGS_2_3 } );

    Recorder.InterestGroup = INTEREST_GROUP_1_3;

    For anyone in building 3:

    PhotonVoiceNetwork.Instance.Client.OpChangeGroups(null, new byte[] { INTEREST_GROUP_BUILDINGS_1_3, INTEREST_GROUP_BUILDINGS_2_3 } );

    Recorder.InterestGroup = INTEREST_GROUP_1_2;

    ---

    solution 3 (if you want to be able to talk to a single other building or two other buildings at once):

    public const byte INTEREST_GROUP_BUILDING_1 = 1;
    public const byte INTEREST_GROUP_BUILDING_2 = 2;
    public const byte INTEREST_GROUP_BUILDING_3 = 3;
    public const byte INTEREST_GROUP_BUILDINGS_1_2 = 3;
    public const byte INTEREST_GROUP_BUILDINGS_1_3 = 4;
    public const byte INTEREST_GROUP_BUILDINGS_2_3 = 5;

    For anyone in building 1:

    PhotonVoiceNetwork.Instance.Client.OpChangeGroups(null, new byte[] { INTEREST_GROUP_1, INTEREST_GROUP_BUILDINGS_1_2, INTEREST_GROUP_BUILDINGS_1_3 } );

    depending on target:

    Recorder.InterestGroup = INTEREST_GROUP_2;
    or
    Recorder.InterestGroup = INTEREST_GROUP_3;
    or
    Recorder.InterestGroup = INTEREST_GROUP_2_3;

    For anyone in building 2:

    PhotonVoiceNetwork.Instance.Client.OpChangeGroups(null, new byte[] { INTEREST_GROUP_2, INTEREST_GROUP_BUILDINGS_1_2, INTEREST_GROUP_BUILDINGS_2_3 } );

    depending on target:

    Recorder.InterestGroup = INTEREST_GROUP_1;
    or
    Recorder.InterestGroup = INTEREST_GROUP_3;
    or
    Recorder.InterestGroup = INTEREST_GROUP_1_3;

    For anyone in building 3:

    PhotonVoiceNetwork.Instance.Client.OpChangeGroups(null, new byte[] { INTEREST_GROUP_3, INTEREST_GROUP_BUILDINGS_1_3, INTEREST_GROUP_BUILDINGS_2_3 } );

    depending on target:

    Recorder.InterestGroup = INTEREST_GROUP_1;
    or
    Recorder.InterestGroup = INTEREST_GROUP_2;
    or
    Recorder.InterestGroup = INTEREST_GROUP_1_2;
  • Thanks JohnTube!

    So for my purposes, I will create a groups as you suggested.
    Building 1: recorder = For_Everyone_Except_1, listen groups set to all other groups
    Building 2: recorder = For_Everyone_Except_2, listen groups set to all other groups
    Building 3: recorder = For_Everyone_Except_3, listen groups set to all other groups
    This should get me going!
    Thanks again.
    On a side note, should we expect a performance hit when enabling voice?

    Thanks again,
    t
  • On a side note, should we expect a performance hit when enabling voice?
    Yes but should not be harmful.
Sign In or Register to comment.