Photon Voice  v2.8
English | 日本語 | 한국
Public Member Functions | Properties | List of all members
VoiceClient Class Reference

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

Inherits IDisposable.

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 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=0, IEncoder encoder=null)
 Creates basic outgoing stream w/o data processing support. Provided encoder should generate output data stream. More...
 
LocalVoiceFramed< T > CreateLocalVoiceFramed< T > (VoiceInfo voiceInfo, int frameSize, int channelId=0, IEncoder encoder=null)
 Creates outgoing stream consuming sequence of values passed in array buffers of arbitrary length which repacked in frames of constant length for further processing and encoding. More...
 
LocalVoiceAudio< T > CreateLocalVoiceAudio< T > (VoiceInfo voiceInfo, IAudioDesc audioSourceDesc, int channelId=0, IEncoder encoder=null)
 Creates outgoing audio stream. Adds audio specific features (e.g. resampling, level meter) to processing pipeline and to returning stream handler. More...
 
LocalVoice CreateLocalVoiceAudioFromSource (VoiceInfo voiceInfo, IAudioDesc source, bool forceShort=false, int channelId=0, IEncoder encoder=null)
 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...
 
void RemoveLocalVoice (LocalVoice voice)
 Removes local voice (outgoing data stream).

Parameters
voiceHandler of outgoing stream to be removed.
More...
 
void Dispose ()
 

Properties

int FramesLost [get, set]
 Lost frames counter. More...
 
int FramesReceived [get]
 Received 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.

Member Function Documentation

LocalVoice CreateLocalVoice ( VoiceInfo  voiceInfo,
int  channelId = 0,
IEncoder  encoder = null 
)

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

Parameters
voiceInfoOutgoing stream parameters. Set applicable fields to read them by encoder and by receiving client when voice created.
channelIdTransport channel specific to transport.
encoderEncoder producing the stream.
Returns
Outgoing stream handler.
LocalVoiceAudio<T> CreateLocalVoiceAudio< T > ( VoiceInfo  voiceInfo,
IAudioDesc  audioSourceDesc,
int  channelId = 0,
IEncoder  encoder = null 
)

Creates outgoing audio stream. Adds audio specific features (e.g. resampling, level meter) to processing pipeline and to returning stream handler.

Template Parameters
TElement type of audio array buffers.
Parameters
voiceInfoOutgoing audio stream parameters. Set applicable fields to read them by encoder and by receiving client when voice created.
channelIdTransport channel specific to transport.
encoderAudio encoder. Set to null to use default Opus encoder.
Returns
Outgoing stream handler.

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

LocalVoice CreateLocalVoiceAudioFromSource ( VoiceInfo  voiceInfo,
IAudioDesc  source,
bool  forceShort = false,
int  channelId = 0,
IEncoder  encoder = null 
)

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 audio stream parameters. Set applicable fields to read them by encoder and by receiving client when voice created.
sourceStreaming audio source.
forceShortFor audio sources producing buffers of 'float' type, creates stream of 'short' type and adds converter.
channelIdTransport channel specific to transport.
encoderAudio encoder. Set to null to use default Opus encoder.
Returns
Outgoing stream handler.

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

LocalVoiceFramed<T> CreateLocalVoiceFramed< T > ( VoiceInfo  voiceInfo,
int  frameSize,
int  channelId = 0,
IEncoder  encoder = null 
)

Creates outgoing stream consuming sequence of values passed in array buffers of arbitrary length which repacked in frames of constant length for further processing and encoding.

Template Parameters
TType of data consumed by outgoing stream (element type of array buffers).
Parameters
voiceInfoOutgoing stream parameters. Set applicable fields to read them by encoder and by receiving client when voice created.
frameSizeSize of buffer LocalVoiceFramed repacks input data stream to.
channelIdTransport channel specific to transport.
encoderEncoder compressing data stream in pipeline.
Returns
Outgoing stream handler.
IEnumerable<LocalVoice> LocalVoicesInChannel ( int  channelId)

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

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

Remote voice info event delegate.

void RemoveLocalVoice ( LocalVoice  voice)

Removes local voice (outgoing data stream).

Parameters
voiceHandler of outgoing stream to be removed.

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

int DebugLostPercent
getset

Lost frames simulation ratio.

int FramesLost
getset

Lost frames counter.

int FramesReceived
get

Received frames counter.

int FramesSent
get

Sent frames counter.

int FramesSentBytes
get

Sent frames bytes counter.

IEnumerable<LocalVoice> LocalVoices
get

Iterates through copy of all local voices list.

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);

IEnumerable<RemoteVoiceInfo> RemoteVoiceInfos
get

Iterates through all remote voices infos.

int RoundTripTime
get

Average time required voice packet to return to sender.

int RoundTripTimeVariance
get

Average round trip time variation.

bool SuppressInfoDuplicateWarning
getset

Do not log warning when duplicate info received.