Atavism Version 2018.1AGIS API

atavism.server.voice
Class NonpositionalVoiceGroup

java.lang.Object
  extended by atavism.server.voice.BasicVoiceGroup
      extended by atavism.server.voice.NonpositionalVoiceGroup
All Implemented Interfaces:
VoiceGroup

public class NonpositionalVoiceGroup
extends BasicVoiceGroup

This class implements VoiceGroup interface, and is used to implement two important cases of voice groups: presentations and "raid groups". In a non-positional voice group, all listeners in the group hear the same set of speakers.


Nested Class Summary
static class NonpositionalVoiceGroup.ComparePriorities
          Comparator class that compares GroupMembers by priority, and then by index.
 
Field Summary
protected  java.util.Set<GroupMember> listeners
          The listeners for this non-positional voice group.
 
Fields inherited from class atavism.server.voice.BasicVoiceGroup
allowedMembers, association, defaultPriority, groupOid, lock, loggingRecomputeVoices, maxVoices, members, voiceSender
 
Constructor Summary
NonpositionalVoiceGroup(OID groupOid, java.lang.Object association, VoiceSender voiceSender, int maxVoices)
          Create a NonpositionalVoiceGroup
 
Method Summary
 GroupMember addMember(OID memberOid, VoiceConnection memberCon, int priority, boolean allowedSpeaker)
          Create a member with the given oid, and associate it with memberCon.
protected  void changeListening(GroupMember listener, boolean add)
          Change a listener from not listening to listening, or vice versa
protected  void changeSpeaking(GroupMember speaker, boolean add)
          Change a speaker from not speaking to speaking, or vice versa
 boolean isAllowedSpeaker(OID memberOid)
          Does not need locking, since there are no modifications and the status could change immediately after the call anyway.
 boolean isPositional()
          Return true if the group is a positional group; that is, if membership in the group is determined by being near the listener, and the priority of speakers is determined by how near any speaker is.
 void recomputeListenerVoices(GroupMember listener)
          Recompute the voice channels to be sent to the specified listener.
protected  void recomputeListenerVoices(GroupMember listener, java.util.List<GroupMember> membersToConsider)
          Recompute the voice channels to be sent to the specified listener, where speakers are chosen from membersToConsider.
protected  void speakingStatusChanged()
          Some speaker change from speaking to not speaker, or vice versa.
 
Methods inherited from class atavism.server.voice.BasicVoiceGroup
addMember, addMemberAllowed, addString, eligibleSpeakerListenerPair, endListeningToSpeaker, getAllMembers, getAllowedMembers, getDefaultPriority, getGroupOid, getMember, isListener, isMember, isMemberSpeaking, onAfterAddMember, onAfterRemoveMember, recomputeVoicesFromSpeakerIterator, removeMember, sendVoiceFrameToListeners, setAllowedMembers, setAllowedSpeaker, setAllowedSpeaker, setListener, setListener, setMemberSpeaking, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

listeners

protected java.util.Set<GroupMember> listeners
The listeners for this non-positional voice group. Most of the time all members are listeners.

Constructor Detail

NonpositionalVoiceGroup

public NonpositionalVoiceGroup(OID groupOid,
                               java.lang.Object association,
                               VoiceSender voiceSender,
                               int maxVoices)
Create a NonpositionalVoiceGroup

Parameters:
groupOid - The oid of the group, which is unique across all voice groups.
association - An object-valued data member that is unused in BasicVoiceGroup, but available to derived classes.
voiceSender - The abstraction that allows the voice group to send messages to listeners.
maxVoices - The maximum number of voice channels that may ever be simultaneously in use by any client
Method Detail

addMember

public GroupMember addMember(OID memberOid,
                             VoiceConnection memberCon,
                             int priority,
                             boolean allowedSpeaker)
Create a member with the given oid, and associate it with memberCon.

Specified by:
addMember in interface VoiceGroup
Specified by:
addMember in class BasicVoiceGroup
Parameters:
memberOid - The oid of the member.
memberCon - The VoiceConnection object connecting the voice server with the client
priority - The speaking priority that the member should be assigned; speakers with higher priorities will be heard over speakers with lower priorities.
allowedSpeaker - If true, the new member is allowed to speak in the group; if false they will not be heard by members by members of the group.
Returns:
The newly-created group member.

isPositional

public boolean isPositional()
Description copied from class: BasicVoiceGroup
Return true if the group is a positional group; that is, if membership in the group is determined by being near the listener, and the priority of speakers is determined by how near any speaker is.

Specified by:
isPositional in interface VoiceGroup
Specified by:
isPositional in class BasicVoiceGroup
Returns:
False, because this is a non-positional voice group.

isAllowedSpeaker

public boolean isAllowedSpeaker(OID memberOid)
Does not need locking, since there are no modifications and the status could change immediately after the call anyway.

Specified by:
isAllowedSpeaker in interface VoiceGroup
Overrides:
isAllowedSpeaker in class BasicVoiceGroup
Parameters:
memberOid - The oid of the member whose allowed speaker status will be returned.
Returns:
True if the member can be found in the group and is allowed to be a speaker; false otherwise.

changeSpeaking

protected void changeSpeaking(GroupMember speaker,
                              boolean add)
Change a speaker from not speaking to speaking, or vice versa

Specified by:
changeSpeaking in class BasicVoiceGroup
Parameters:
speaker - A GroupMember instance whose speaking state is to be changed.
add - If true, change the speaker from not speaking to speaking, if false, from speaking to not speaking.

changeListening

protected void changeListening(GroupMember listener,
                               boolean add)
Change a listener from not listening to listening, or vice versa

Specified by:
changeListening in class BasicVoiceGroup
Parameters:
listener - A GroupMember instance whose listening state is to be changed.
add - If true, change the listener from not listening to listening, if false, from listening to not listening.

recomputeListenerVoices

public void recomputeListenerVoices(GroupMember listener)
Recompute the voice channels to be sent to the specified listener.

Specified by:
recomputeListenerVoices in class BasicVoiceGroup
Parameters:
listener - The group member for which voice channels are to be recomputed.

recomputeListenerVoices

protected void recomputeListenerVoices(GroupMember listener,
                                       java.util.List<GroupMember> membersToConsider)
Recompute the voice channels to be sent to the specified listener, where speakers are chosen from membersToConsider.

Parameters:
listener - The group member for which voice channels are to be recomputed.
membersToConsider - The list of speakers.

speakingStatusChanged

protected void speakingStatusChanged()
Some speaker change from speaking to not speaker, or vice versa. So recompute the voices for all listeners.



Copyright © 2018 Dragonsan Studios Sp. z o.o.