Photon Voice v2.53

Classes | Public Member Functions | Properties | List of all members
VoiceClient Class Reference

Voice client interact with other clients on network via IVoiceTransport. More...

Inherits IDisposable.

Classes

struct  CreateOptions
 

Public Member Functions

delegate void RemoteVoiceInfoDelegate (int channelId, int playerId, byte voiceId, VoiceInfo voiceInfo, ref RemoteVoiceOptions options)
 Remote voice info event delegate. More...
 
IEnumerable< LocalVoiceLocalVoicesInChannel (int channelId)
 Iterates through copy of all local voices list of given channel. More...
 
void LogSpacingProfiles ()
 
void LogStats ()
 
void SetRemoteVoiceDelayFrames (Codec codec, int delayFrames)
 
 VoiceClient (IVoiceTransport transport, ILogger logger, CreateOptions opt=default(CreateOptions))
 Creates VoiceClient instance More...
 
void Service ()
 This method dispatches all available incoming commands and then sends this client's outgoing commands. Call this method regularly (2..20 times a second). More...
 
LocalVoice CreateLocalVoice (VoiceInfo voiceInfo, int channelId, VoiceCreateOptions options=default(VoiceCreateOptions))
 Creates basic outgoing stream w/o data processing support. Provided encoder should generate output data stream. More...
 
LocalVoiceAudio< T > CreateLocalVoiceAudio< T > (VoiceInfo voiceInfo, IAudioDesc audioSourceDesc, int channelId, VoiceCreateOptions options=default(VoiceCreateOptions))
 
LocalVoice CreateLocalVoiceAudioFromSource (VoiceInfo voiceInfo, IAudioDesc source, AudioSampleType sampleType, int channelId, VoiceCreateOptions options=default(VoiceCreateOptions))
 Creates outgoing audio stream of type automatically assigned and adds procedures (callback or serviceable) for consuming given audio source data. Adds audio specific features (e.g. resampling, level meter) to processing pipeline and to returning stream handler. More...
 
LocalVoiceVideo CreateLocalVoiceVideo (VoiceInfo voiceInfo, IVideoRecorder recorder, int channelId, VoiceCreateOptions options=default(VoiceCreateOptions))
 Creates outgoing video stream consuming sequence of image buffers. More...
 
void RemoveLocalVoice (LocalVoice voice)
 Removes local voice (outgoing data stream).

Parameters
voiceHandler of outgoing stream to be removed.
More...
 
void onJoinChannel (int channelId)
 
void onJoinAllChannels ()
 
void onLeaveChannel (int channel)
 
void onLeaveAllChannels ()
 
void onPlayerJoin (int channelId, int playerId)
 
void onPlayerJoin (int playerId)
 
void onPlayerLeave (int channelId, int playerId)
 
void onPlayerLeave (int playerId)
 
void onVoiceInfo (int channelId, int playerId, byte voiceId, byte eventNumber, VoiceInfo info)
 
void onVoiceRemove (int playerId, byte[] voiceIds)
 
void onFrame (int playerId, byte voiceId, byte evNumber, ref FrameBuffer receivedBytes, bool isLocalPlayer)
 
void Dispose ()
 

Properties

bool ThreadingEnabled [get, set]
 
int EventsLost [get, set]
 Lost events counter (the number of empty frames sent to the deocder). More...
 
int FramesLost [get, set]
 Lost frames counter (the number of empty frames sent to the deocder). More...
 
int FramesFragPart [get, set]
 The counter of assembled frames, fragments of which are partially missing. More...
 
int FramesRecovered [get, set]
 Recovered frames counter. More...
 
int FramesMiss [get, set]
 Counter of slots between correctly ordered frames. More...
 
int FramesLate [get, set]
 Counter of late (incorrectly ordered) frames. More...
 
int FramesLateUsed [get]
 Counter of late but still used frames. More...
 
int FramesReceived [get]
 Received frames counter. More...
 
int FramesReceivedFEC [get, set]
 Received FEC events counter. More...
 
int FramesTryFEC [get, set]
 FEC recorery attempts counter. More...
 
int FramesReceivedFragments [get, set]
 Received events for fragmented frames counter. More...
 
int FramesReceivedFragmented [get, set]
 Assembled fragmented frames counter. More...
 
int FramesSent [get]
 Sent frames counter. More...
 
int FramesSentBytes [get]
 Sent frames bytes counter. More...
 
int RoundTripTime [get]
 Average time required voice packet to return to sender. More...
 
int RoundTripTimeVariance [get]
 Average round trip time variation. More...
 
bool SuppressInfoDuplicateWarning [get, set]
 Do not log warning when duplicate info received. More...
 
RemoteVoiceInfoDelegate OnRemoteVoiceInfoAction [get, set]
 Register a method to be called when remote voice info arrived (after join or new new remote voice creation). Metod parameters: (int channelId, int playerId, byte voiceId, VoiceInfo voiceInfo, ref RemoteVoiceOptions options); More...
 
int DebugLostPercent [get, set]
 Lost frames simulation ratio. More...
 
IEnumerable< LocalVoiceLocalVoices [get]
 Iterates through copy of all local voices list. More...
 
IEnumerable< RemoteVoiceInfoRemoteVoiceInfos [get]
 Iterates through all remote voices infos. More...
 

Detailed Description

Voice client interact with other clients on network via IVoiceTransport.

Constructor & Destructor Documentation

◆ VoiceClient()

VoiceClient ( IVoiceTransport  transport,
ILogger  logger,
CreateOptions  opt = default(CreateOptions) 
)

Creates VoiceClient instance

Member Function Documentation

◆ CreateLocalVoice()

LocalVoice CreateLocalVoice ( VoiceInfo  voiceInfo,
int  channelId,
VoiceCreateOptions  options = default(VoiceCreateOptions) 
)

Creates basic outgoing stream w/o data processing support. Provided encoder should generate output data stream.

Parameters
voiceInfoOutgoing stream parameters.
channelIdTransport channel specific to transport.
optionsVoice creation options.
Returns
Outgoing stream handler.

◆ CreateLocalVoiceAudioFromSource()

LocalVoice CreateLocalVoiceAudioFromSource ( VoiceInfo  voiceInfo,
IAudioDesc  source,
AudioSampleType  sampleType,
int  channelId,
VoiceCreateOptions  options = default(VoiceCreateOptions) 
)

Creates outgoing audio stream of type automatically assigned and adds procedures (callback or serviceable) for consuming given audio source data. Adds audio specific features (e.g. resampling, level meter) to processing pipeline and to returning stream handler.

Parameters
voiceInfoOutgoing stream parameters.
sourceStreaming audio source.
sampleTypeVoice's audio sample type. If does not match source audio sample type, conversion will occur.
channelIdTransport channel specific to transport.
optionsVoice creation options.
Returns
Outgoing stream handler.

audioSourceDesc.SamplingRate and voiceInfo.SamplingRate may do not match. Automatic resampling will occur in this case.

◆ CreateLocalVoiceVideo()

LocalVoiceVideo CreateLocalVoiceVideo ( VoiceInfo  voiceInfo,
IVideoRecorder  recorder,
int  channelId,
VoiceCreateOptions  options = default(VoiceCreateOptions) 
)

Creates outgoing video stream consuming sequence of image buffers.

Parameters
voiceInfoOutgoing stream parameters.
recorderVideo recorder.
channelIdTransport channel specific to transport.
optionsVoice creation options.
Returns
Outgoing stream handler.

◆ LocalVoicesInChannel()

IEnumerable<LocalVoice> LocalVoicesInChannel ( int  channelId)

Iterates through copy of all local voices list of given channel.

◆ RemoteVoiceInfoDelegate()

delegate void RemoteVoiceInfoDelegate ( int  channelId,
int  playerId,
byte  voiceId,
VoiceInfo  voiceInfo,
ref RemoteVoiceOptions  options 
)

Remote voice info event delegate.

◆ RemoveLocalVoice()

void RemoveLocalVoice ( LocalVoice  voice)

Removes local voice (outgoing data stream).

Parameters
voiceHandler of outgoing stream to be removed.

◆ Service()

void Service ( )

This method dispatches all available incoming commands and then sends this client's outgoing commands. Call this method regularly (2..20 times a second).

Property Documentation

◆ DebugLostPercent

int DebugLostPercent
getset

Lost frames simulation ratio.

◆ EventsLost

int EventsLost
getset

Lost events counter (the number of empty frames sent to the deocder).

◆ FramesFragPart

int FramesFragPart
getset

The counter of assembled frames, fragments of which are partially missing.

◆ FramesLate

int FramesLate
getset

Counter of late (incorrectly ordered) frames.

◆ FramesLateUsed

int FramesLateUsed
get

Counter of late but still used frames.

◆ FramesLost

int FramesLost
getset

Lost frames counter (the number of empty frames sent to the deocder).

◆ FramesMiss

int FramesMiss
getset

Counter of slots between correctly ordered frames.

◆ FramesReceived

int FramesReceived
get

Received frames counter.

◆ FramesReceivedFEC

int FramesReceivedFEC
getset

Received FEC events counter.

◆ FramesReceivedFragmented

int FramesReceivedFragmented
getset

Assembled fragmented frames counter.

◆ FramesReceivedFragments

int FramesReceivedFragments
getset

Received events for fragmented frames counter.

◆ FramesRecovered

int FramesRecovered
getset

Recovered frames counter.

◆ FramesSent

int FramesSent
get

Sent frames counter.

◆ FramesSentBytes

int FramesSentBytes
get

Sent frames bytes counter.

◆ FramesTryFEC

int FramesTryFEC
getset

FEC recorery attempts counter.

◆ LocalVoices

IEnumerable<LocalVoice> LocalVoices
get

Iterates through copy of all local voices list.

◆ OnRemoteVoiceInfoAction

RemoteVoiceInfoDelegate OnRemoteVoiceInfoAction
getset

Register a method to be called when remote voice info arrived (after join or new new remote voice creation). Metod parameters: (int channelId, int playerId, byte voiceId, VoiceInfo voiceInfo, ref RemoteVoiceOptions options);

◆ RemoteVoiceInfos

IEnumerable<RemoteVoiceInfo> RemoteVoiceInfos
get

Iterates through all remote voices infos.

◆ RoundTripTime

int RoundTripTime
get

Average time required voice packet to return to sender.

◆ RoundTripTimeVariance

int RoundTripTimeVariance
get

Average round trip time variation.

◆ SuppressInfoDuplicateWarning

bool SuppressInfoDuplicateWarning
getset

Do not log warning when duplicate info received.