|
|||||||||
| Version 1.5 | APIs subject to change! | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmultiverse.server.engine.EnginePlugin
multiverse.server.plugins.VoicePlugin
public class VoicePlugin
Plugin to handle voice channels
| Nested Class Summary | |
|---|---|
static class |
VoicePlugin.VoiceConManager
A class with locking to manage the Maps and Sets of connections. |
| Field Summary | |
|---|---|
protected static boolean |
allowVoiceBots
If this is true, we subscribe to login messages and pass on login notifications. |
static CountLogger.Counter |
countAllocateVoiceReceived
|
static CountLogger.Counter |
countAllocateVoiceSent
|
static CountLogger.Counter |
countDeallocateVoiceReceived
|
static CountLogger.Counter |
countDeallocateVoiceSent
|
static CountLogger.Counter |
countSendLoginStatus
|
protected static boolean |
createGroupWhenReferenced
If this is true, we'll synthesize the group and/or group member when an auth packet comes in. |
static TimeHistogram |
dataSendHistogram
|
static int |
lengthBytes
There are two bytes in the length prefixed to a TCP message |
protected java.util.concurrent.locks.Lock |
lock
|
static int |
maxVoiceChannels
The server is supposed to run things so no client ever has more than this number of voice channels. |
static byte |
opcodeAggregatedData
An aggregated data packet contains a number of data packets. |
static byte |
opcodeAllocateCodec
Allocate a voice. |
static byte |
opcodeAllocatePositionalCodec
This has exactly the same payload as AllocateCodec, but says that the voice should be positional. |
static byte |
opcodeAuthenticate
The authenticate packet must be the first one received by the voice plugin on any new connection from a client. |
static byte |
opcodeData
A data packet, consisting of a 4-byte header followed by the bytes of the data frame. |
static byte |
opcodeDeallocate
Deallocate the voice number. |
static int |
opcodeHighest
|
static byte |
opcodeLoginStatus
An opcode sent exclusively from the server to the client, and used only to support synchronization between voice bots and test clients. |
static java.lang.String[] |
opcodeNames
Used in logging messages |
static byte |
opcodeReconfirmCodec
This has exactly the same payload as AllocateCodec, but is with lossy transports like UDP to send the opcode parameters every second or so. |
static byte |
opcodeVoiceUnallocated
All voices start out unallocated |
protected PerceptionFilter |
perceptionFilter
|
protected long |
perceptionSubId
|
static TimeHistogram |
processPacketHistogram
|
static boolean |
runHistograms
|
static int[] |
speexNarrowBandFrameSize
This array is indexed by Speex narrow-band mode, and gives the narrow-band frame size for that mode. |
static int[] |
speexWideBandFrameSize
|
static TimeHistogram |
voiceAllocHistogram
|
static TimeHistogram |
voiceDeallocHistogram
|
static int[] |
voiceMsgSize
This gives the number of bytes in the message excluding the length, except for the data case, where it gives the number of bytes in the header, but not including the data itself |
static byte |
voicePacketHeaderSize
All voice packets start with 4 bytes: o 16-bit sequence number, increased by one for each successive transmission for this voice. |
| Fields inherited from interface multiverse.msgsys.MessageCallback |
|---|
NO_FLAGS, RESPONSE_EXPECTED |
| Constructor Summary | |
|---|---|
VoicePlugin()
The VoicePlugin accepts connections from game clients who have been supplied the IP and port number to contact by the initial game system login. |
|
| Method Summary | |
|---|---|
void |
acceptConnection(multiverse.server.network.ClientConnection con)
|
void |
addGroup(long groupOid,
VoiceGroup group)
Inform the VoicePlugin about the existance of a voice group. |
protected void |
addPerceiverToTracker(long playerOid,
VoiceStub stub)
|
protected void |
addToPerceptionFilter(long playerOid)
|
void |
connectionReset(multiverse.server.network.ClientConnection con)
Close record stream if it's open, deallocate all voices in use by the connection, and remove the listeners ??? TBD: Need to remove connection from a whole bunch of data structures. |
protected VoiceStub |
createVoiceStub(long playerOid)
|
static int |
encodedFrameSizeForMode(int mode,
boolean wideBand)
Return the total frame size for narrow or wide-band mode given |
static int |
encodedFrameSizeFromFirstByte(byte b)
Return the frame size for the band/mode specified by the first byte of the Speex frame |
protected void |
expungeVoiceClient(long playerOid)
|
protected void |
expungeVoiceClient(long playerOid,
VoiceConnection con)
|
protected VoiceGroup |
findVoiceGroup(long groupOid)
Return the group for groupOid, having checked to see that the group exists and contains the player. |
java.lang.String |
formatCon(multiverse.server.network.ClientConnection con)
|
VoiceConnection |
getConnectionData(multiverse.server.network.ClientConnection con)
|
Point |
getCurrentLoc(long memberOid)
Get the current location of the member. |
static VoicePlugin |
getInstance()
|
protected GroupMember |
getPlayerMember(long playerOid)
|
ProximityTracker |
getTracker(long instanceOid,
boolean mustAlreadyExist)
|
ProximityTracker |
getTrackerOrNull(long instanceOid)
|
static short |
incSeqNum(short original)
Increment the short seqNum so that it wraps around properly. |
static short |
incSeqNum(short original,
int byWhat)
Increment the short seqNum so that it wraps around properly. |
protected void |
maybeRemoveFromTracker(long playerOid,
long instanceOid)
|
void |
notifyReactionRadius(long listenerOid,
long speakerOid,
boolean inRadius,
boolean wasInRadius)
This callback is invoked by the ProximityTracker to tell us who is in audible range of whom. |
boolean |
objectShouldBeTracked(long objectOid,
PerceptionMessage.ObjectNote note)
This callback is invoked by the ProximityTracker to determine if a candidate remote object should be tracked. |
void |
onActivate()
for developers extending the EnginePlugin object, it may be easier to use the onActivate() method which gets called when the plugin is being activated by the Engine. |
static java.lang.String |
opcodeString(byte opcode)
Return a string representation of the opcode number |
protected java.io.BufferedOutputStream |
openSpeexVoiceFile(long oid)
|
void |
processAuthenticationPacket(VoiceConnection playerCon,
multiverse.server.network.MVByteBuffer buf)
Check to see of the auth packet contains the proper credentials, and if so, create a group member in the specified group. |
void |
processPacket(multiverse.server.network.ClientConnection con,
multiverse.server.network.MVByteBuffer buf)
The buf limit is the size. |
protected void |
removeFromPerceptionFilter(long playerOid)
|
void |
removeGroup(long groupOid)
Remove a group. |
void |
removePlayerFromGroup(VoiceConnection playerCon)
Remove the player identified by the argument from the group it belongs to. |
void |
removeTracker(long instanceOid)
|
void |
sendAllocateVoice(VoiceConnection speaker,
VoiceConnection listener,
byte voiceNumber,
boolean positional)
Send a message which tells the client that the server has established a voice channel to the client, identified by the given voiceNumber, using an overloading of sendAllocateVoice in which whether the voice channel will be treated positionally is determined by the boolean positional arg. |
void |
sendAllocateVoice(VoiceConnection speaker,
VoiceConnection listener,
byte voiceNumber,
byte opcode)
Send a message which tells the client that the server has established a voice channel to the client, identified by the given voiceNumber, using an overloading of sendAllocateVoice in which the positional boolean is replaced by the appropriate voice allocate opcode. |
void |
sendDeallocateVoice(VoiceConnection speaker,
VoiceConnection listener,
byte voiceNumber)
Send a message to the connection deallocating the voice with the given number. |
void |
sendExtensionMessage(WorldManagerClient.ExtensionMessage msg)
Send a broadcast ExtensionMessage to anyone who cares. |
void |
sendLoginStatus(VoiceConnection receiver,
long playerOid,
boolean login)
|
protected void |
sendLoginStatusToReceivers(long playerOid,
boolean login)
|
void |
sendVoiceFrame(VoiceConnection speaker,
VoiceConnection listener,
byte opcode,
byte voiceNumber,
multiverse.server.network.MVByteBuffer sourceBuf,
short pktLength)
Send a voice data message to the client on the voice channel identitified by the voiceNumber. |
protected void |
writeSpeexData(java.io.BufferedOutputStream recordSpeexStream,
byte[] buf,
int startIndex,
int byteCount)
Write a single Speex frame to the stream, from the byte array |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final byte voicePacketHeaderSize
public static final byte opcodeVoiceUnallocated
public static final byte opcodeAuthenticate
public static final byte opcodeAllocateCodec
public static final byte opcodeAllocatePositionalCodec
public static final byte opcodeReconfirmCodec
public static final byte opcodeDeallocate
public static final byte opcodeData
public static final byte opcodeAggregatedData
public static final byte opcodeLoginStatus
public static final int opcodeHighest
public static java.lang.String[] opcodeNames
public static int[] voiceMsgSize
public static int lengthBytes
public static int[] speexNarrowBandFrameSize
public static int[] speexWideBandFrameSize
public static int maxVoiceChannels
public static CountLogger.Counter countSendLoginStatus
public static CountLogger.Counter countAllocateVoiceReceived
public static CountLogger.Counter countDeallocateVoiceReceived
public static CountLogger.Counter countAllocateVoiceSent
public static CountLogger.Counter countDeallocateVoiceSent
public static boolean runHistograms
public static TimeHistogram processPacketHistogram
public static TimeHistogram dataSendHistogram
public static TimeHistogram voiceAllocHistogram
public static TimeHistogram voiceDeallocHistogram
protected static boolean createGroupWhenReferenced
protected static boolean allowVoiceBots
protected PerceptionFilter perceptionFilter
protected long perceptionSubId
protected transient java.util.concurrent.locks.Lock lock
| Constructor Detail |
|---|
public VoicePlugin()
| Method Detail |
|---|
public static VoicePlugin getInstance()
public void onActivate()
EnginePlugin
onActivate in class EnginePluginpublic void acceptConnection(multiverse.server.network.ClientConnection con)
acceptConnection in interface multiverse.server.network.ClientConnection.AcceptCallbackprotected VoiceStub createVoiceStub(long playerOid)
protected void maybeRemoveFromTracker(long playerOid,
long instanceOid)
protected void sendLoginStatusToReceivers(long playerOid,
boolean login)
public Point getCurrentLoc(long memberOid)
protected void addPerceiverToTracker(long playerOid,
VoiceStub stub)
protected GroupMember getPlayerMember(long playerOid)
public void notifyReactionRadius(long listenerOid,
long speakerOid,
boolean inRadius,
boolean wasInRadius)
notifyReactionRadius in interface ObjectTracker.NotifyReactionRadiusCallback
public boolean objectShouldBeTracked(long objectOid,
PerceptionMessage.ObjectNote note)
objectShouldBeTracked in interface ObjectTracker.RemoteObjectFilter
public ProximityTracker getTracker(long instanceOid,
boolean mustAlreadyExist)
public ProximityTracker getTrackerOrNull(long instanceOid)
public void removeTracker(long instanceOid)
public void processPacket(multiverse.server.network.ClientConnection con,
multiverse.server.network.MVByteBuffer buf)
processPacket in interface multiverse.server.network.ClientConnection.MessageCallback
protected void writeSpeexData(java.io.BufferedOutputStream recordSpeexStream,
byte[] buf,
int startIndex,
int byteCount)
public void processAuthenticationPacket(VoiceConnection playerCon,
multiverse.server.network.MVByteBuffer buf)
protected void addToPerceptionFilter(long playerOid)
protected void removeFromPerceptionFilter(long playerOid)
public void removePlayerFromGroup(VoiceConnection playerCon)
playerCon - The VoiceConnection object corresponding to the player.protected VoiceGroup findVoiceGroup(long groupOid)
public void addGroup(long groupOid,
VoiceGroup group)
groupOid - The oid of the voice group to be added.group - The voice group to be added.public void removeGroup(long groupOid)
groupOid - The oid of the voice group to be removed.
public void sendAllocateVoice(VoiceConnection speaker,
VoiceConnection listener,
byte voiceNumber,
boolean positional)
VoiceSender
sendAllocateVoice in interface VoiceSenderspeaker - The VoiceConnection object that represents
the speaker that will be the source of voice data for the
new voice channel.listener - The VoiceConnection object representing
the listener player, whose client will be sent an allocate
message followed by voice data messages.voiceNumber - The number, from 0 - maxVoiceChannels,
of the voice channel to be established.positional - True if the voice should behave as a positional
voice.
public void sendAllocateVoice(VoiceConnection speaker,
VoiceConnection listener,
byte voiceNumber,
byte opcode)
VoiceSender
sendAllocateVoice in interface VoiceSenderspeaker - The VoiceConnection object that represents
the speaker that will be the source of voice data for the
new voice channel.listener - The VoiceConnection object representing
the listener player, whose client will be sent an allocate
message followed by voice data messages.voiceNumber - The number, from 0 - maxVoiceChannels,
of the voice channel to be established.opcode - Either VoicePlugin.opcodeAllocatePositional or
VoicePlugin.opcodeAllocateNonpositional.
public void sendDeallocateVoice(VoiceConnection speaker,
VoiceConnection listener,
byte voiceNumber)
sendDeallocateVoice in interface VoiceSenderspeaker - The VoiceConnection object that represents
the speaker that was the source of voice data for the
voice channel.listener - The VoiceConnection object representing
the listener player, whose client will be sent the deallocate
message.voiceNumber - The number, from 0 - maxVoiceChannels,
of the voice channel to be established.
public void sendVoiceFrame(VoiceConnection speaker,
VoiceConnection listener,
byte opcode,
byte voiceNumber,
multiverse.server.network.MVByteBuffer sourceBuf,
short pktLength)
VoiceSender
sendVoiceFrame in interface VoiceSenderspeaker - The VoiceConnection object that represents
the speaker that was the source of voice data for the
voice channel.listener - The VoiceConnection object representing
the listener player, whose client will be sent the voice data
message.opcode - Either VoicePlugin.opcodeAggregateData or
VoicePlugin.opcodeData.voiceNumber - The number, from 0 - maxVoiceChannels,
of the voice channel to be established.sourceBuf - A byte buffer holding the entire voice message as received
from the speaker. The first byte of the message is at
index 0 in buf.pktLength - The number of bytes of message in the buf.
public void sendLoginStatus(VoiceConnection receiver,
long playerOid,
boolean login)
public void sendExtensionMessage(WorldManagerClient.ExtensionMessage msg)
VoiceSender
sendExtensionMessage in interface VoiceSendermsg - The ExtensionMessage to send.protected java.io.BufferedOutputStream openSpeexVoiceFile(long oid)
public VoiceConnection getConnectionData(multiverse.server.network.ClientConnection con)
public java.lang.String formatCon(multiverse.server.network.ClientConnection con)
public void connectionReset(multiverse.server.network.ClientConnection con)
connectionReset in interface multiverse.server.network.ClientConnection.MessageCallbackprotected void expungeVoiceClient(long playerOid)
protected void expungeVoiceClient(long playerOid,
VoiceConnection con)
public static short incSeqNum(short original)
public static short incSeqNum(short original,
int byWhat)
public static int encodedFrameSizeForMode(int mode,
boolean wideBand)
public static int encodedFrameSizeFromFirstByte(byte b)
public static java.lang.String opcodeString(byte opcode)
|
Copyright © 2008 The Multiverse Network, Inc. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||