Photon Voice v2.18

Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Properties | Events | List of all members
VoiceConnection Class Reference

Component that represents a client voice connection to Photon Servers. More...

Inherits ConnectionHandler, and ILoggable.

Inherited by PhotonVoiceNetwork.

Public Member Functions

bool ConnectUsingSettings (AppSettings overwriteSettings=null)
 Connect to Photon server using Settings More...
 
void InitRecorder (Recorder rec)
 Initializes the Recorder component to be able to transmit audio. More...
 

Public Attributes

AppSettings Settings
 Settings to be used by this voice connection More...
 
Func< int, byte, object, SpeakerSpeakerFactory
 Special factory to link Speaker components with incoming remote audio streams More...
 
float MinimalTimeScaleToDispatchInFixedUpdate = -1f
 Configures the minimal Time.timeScale at which Voice client will dispatch incoming messages within LateUpdate. More...
 
bool AutoCreateSpeakerIfNotFound = true
 Auto instantiate a GameObject and attach a Speaker component to link to a remote audio stream if no candidate could be found More...
 

Protected Member Functions

override void Awake ()
 
virtual void Update ()
 
virtual void FixedUpdate ()
 
void Dispatch ()
 Dispatches incoming network messages for Voice client. Called in FixedUpdate or LateUpdate. More...
 
override void OnDisable ()
 
virtual void OnDestroy ()
 
virtual Speaker SimpleSpeakerFactory (int playerId, byte voiceId, object userData)
 
virtual void OnOperationResponse (OperationResponse opResponse)
 
virtual void OnVoiceStateChanged (ClientState fromState, ClientState toState)
 
void CalcStatistics ()
 
void LinkSpeaker (Speaker speaker, RemoteVoiceLink remoteVoice)
 

Protected Attributes

List< RemoteVoiceLinkcachedRemoteVoices = new List<RemoteVoiceLink>()
 

Properties

VoiceLogger Logger [get, protected set]
 Logger used by this component More...
 
DebugLevel LogLevel [get, set]
 Log level for this component More...
 
new LoadBalancingTransport Client [get]
 
VoiceClient VoiceClient [get]
 Returns underlying Photon Voice client. More...
 
ClientState ClientState [get]
 Returns Photon Voice client state. More...
 
float FramesReceivedPerSecond [get]
 Number of frames received per second. More...
 
float FramesLostPerSecond [get]
 Number of frames lost per second. More...
 
float FramesLostPercent [get]
 Percentage of lost frames. More...
 
GameObject SpeakerPrefab [get, set]
 Prefab that contains Speaker component to be instantiated when receiving a new remote audio source info More...
 
Recorder PrimaryRecorder [get, set]
 Main Recorder to be used for transmission by default More...
 
DebugLevel GlobalRecordersLogLevel [get, set]
 
DebugLevel GlobalSpeakersLogLevel [get, set]
 
int GlobalPlaybackDelay [get, set]
 
- Properties inherited from ILoggable
DebugLevel LogLevel [get, set]
 
VoiceLogger Logger [get]
 

Events

Action< SpeakerSpeakerLinked
 Fires when a speaker has been linked to a remote audio stream More...
 
Action< RemoteVoiceLinkRemoteVoiceAdded
 Fires when a remote voice stream is added More...
 

Detailed Description

Component that represents a client voice connection to Photon Servers.

Member Function Documentation

◆ ConnectUsingSettings()

bool ConnectUsingSettings ( AppSettings  overwriteSettings = null)

Connect to Photon server using Settings

Parameters
overwriteSettingsOverwrites Settings before connecting
Returns
If true voice connection command was sent from client

◆ Dispatch()

void Dispatch ( )
protected

Dispatches incoming network messages for Voice client. Called in FixedUpdate or LateUpdate.

It may make sense to dispatch incoming messages, even if the timeScale is near 0. That can be configured with MinimalTimeScaleToDispatchInFixedUpdate.

Without dispatching messages, Voice client won't change state and does not handle updates.

◆ InitRecorder()

void InitRecorder ( Recorder  rec)

Initializes the Recorder component to be able to transmit audio.

Parameters
recThe Recorder to be initialized.

Member Data Documentation

◆ AutoCreateSpeakerIfNotFound

bool AutoCreateSpeakerIfNotFound = true

Auto instantiate a GameObject and attach a Speaker component to link to a remote audio stream if no candidate could be found

◆ MinimalTimeScaleToDispatchInFixedUpdate

float MinimalTimeScaleToDispatchInFixedUpdate = -1f

Configures the minimal Time.timeScale at which Voice client will dispatch incoming messages within LateUpdate.

It may make sense to dispatch incoming messages, even if the timeScale is near 0. In some cases, stopping the game time makes sense, so this option defaults to -1f, which is "off". Without dispatching messages, Voice client won't change state and does not handle updates.

◆ Settings

AppSettings Settings

Settings to be used by this voice connection

◆ SpeakerFactory

Func<int, byte, object, Speaker> SpeakerFactory

Special factory to link Speaker components with incoming remote audio streams

Property Documentation

◆ ClientState

ClientState ClientState
get

Returns Photon Voice client state.

◆ FramesLostPercent

float FramesLostPercent
get

Percentage of lost frames.

◆ FramesLostPerSecond

float FramesLostPerSecond
get

Number of frames lost per second.

◆ FramesReceivedPerSecond

float FramesReceivedPerSecond
get

Number of frames received per second.

◆ Logger

VoiceLogger Logger
getprotected set

Logger used by this component

◆ LogLevel

DebugLevel LogLevel
getset

Log level for this component

◆ PrimaryRecorder

Recorder PrimaryRecorder
getset

Main Recorder to be used for transmission by default

◆ SpeakerPrefab

GameObject SpeakerPrefab
getset

Prefab that contains Speaker component to be instantiated when receiving a new remote audio source info

◆ VoiceClient

Returns underlying Photon Voice client.

Event Documentation

◆ RemoteVoiceAdded

Action<RemoteVoiceLink> RemoteVoiceAdded

Fires when a remote voice stream is added

◆ SpeakerLinked

Action<Speaker> SpeakerLinked

Fires when a speaker has been linked to a remote audio stream