1
0
KF2-Dev-Scripts/Engine/Classes/OnlineVoiceInterface.uc
2020-12-13 18:01:13 +03:00

279 lines
9.3 KiB
Ucode

/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
/**
* This interface deals with voice over IP. It is responsible for registering,
* unregistering, and filtering talkers. It also handles special voice effects.
* This interface also provides hooks for accessing the raw data to perform
* operations on it, such as speech recognition, lip sync, etc.
*/
interface OnlineVoiceInterface
dependson(OnlineSubsystem);
/**
* Registers the user as a talker
*
* @param LocalUserNum the local player index that is a talker
*
* @return TRUE if the call succeeded, FALSE otherwise
*/
//@HSL_BEGIN_XBOX
function bool RegisterLocalTalker(byte LocalUserNum, optional byte ChannelIndex);
//@HSL_END_XBOX
/**
* Unregisters the user as a talker
*
* @param LocalUserNum the local player index to be removed
*
* @return TRUE if the call succeeded, FALSE otherwise
*/
//@HSL_BEGIN_XBOX
function bool UnregisterLocalTalker(byte LocalUserNum, optional byte ChannelIndex);
/**
* Determines if there are any local talkers that are currently registered
*/
function bool AreAnyLocalTalkersRegistered();
/**
* Recieves a reliable voice packet from server
*
* @param MessageType the type of message sent
* @param Sender the Unique Net Id for the sender who sent the packet
* @param InData the reliable voice data
*
*/
function ReceiveReliableVoicePacket( byte MessageType, UniqueNetId Sender, int Length, byte InData[60]);
//@HSL_END_XBOX
/**
* Registers a remote player as a talker
*
* @param PlayerId the unique id of the remote player that is a talker
*
* @return TRUE if the call succeeded, FALSE otherwise
*/
function bool RegisterRemoteTalker(UniqueNetId PlayerId);
/**
* Unregisters a remote player as a talker
*
* @param PlayerId the unique id of the remote player to be removed
*
* @return TRUE if the call succeeded, FALSE otherwise
*/
function bool UnregisterRemoteTalker(UniqueNetId PlayerId);
/**
* Determines if the specified player is actively talking into the mic
*
* @param LocalUserNum the local player index being queried
*
* @return TRUE if the player is talking, FALSE otherwise
*/
function bool IsLocalPlayerTalking(byte LocalUserNum);
/**
* Determines if the specified remote player is actively talking into the mic
* NOTE: Network latencies will make this not 100% accurate
*
* @param PlayerId the unique id of the remote player being queried
*
* @return TRUE if the player is talking, FALSE otherwise
*/
function bool IsRemotePlayerTalking(UniqueNetId PlayerId);
/**
* Determines if the specified player has a headset connected
*
* @param LocalUserNum the local player index being queried
*
* @return TRUE if the player has a headset plugged in, FALSE otherwise
*/
function bool IsHeadsetPresent(byte LocalUserNum);
/**
* Sets the relative priority for a remote talker. 0 is highest
*
* @param LocalUserNum the user that controls the relative priority
* @param PlayerId the remote talker that is having their priority changed for
* @param Priority the relative priority to use (0 highest, < 0 is muted)
*
* @return TRUE if the function succeeds, FALSE otherwise
*/
function bool SetRemoteTalkerPriority(byte LocalUserNum,UniqueNetId PlayerId,int Priority);
//@HSL_BEGIN_XBOX
/**
* Mutes all the players (including self)
*
* @param PlayerMuteSetting whether to mute all or mute just bad rep players
*
* @return TRUE if the function succeeds, FALSE otherwise
*/
function bool UpdatePlayerMuteSetting(bool PlayerMuteSetting);
//@HSL_END_XBOX
/**
* Mutes a remote talker for the specified local player. NOTE: This only mutes them in the
* game unless the bIsSystemWide flag is true, which attempts to mute them globally
*
* @param LocalUserNum the user that is muting the remote talker
* @param PlayerId the remote talker that is being muted
* @param bIsSystemWide whether to try to mute them globally or not
*
* @return TRUE if the function succeeds, FALSE otherwise
*/
function bool MuteRemoteTalker(byte LocalUserNum,UniqueNetId PlayerId,optional bool bIsSystemWide);
/**
* Allows a remote talker to talk to the specified local player. NOTE: This only unmutes them in the
* game unless the bIsSystemWide flag is true, which attempts to unmute them globally
*
* @param LocalUserNum the user that is allowing the remote talker to talk
* @param PlayerId the remote talker that is being restored to talking
* @param bIsSystemWide whether to try to unmute them globally or not
*
* @return TRUE if the function succeeds, FALSE otherwise
*/
function bool UnmuteRemoteTalker(byte LocalUserNum,UniqueNetId PlayerId,optional bool bIsSystemWide);
//@HSL_BEGIN_XBOX
/**
* Checks if a user is muted or not
*
* @param ConsoleId the remote talker that is being restored to talking
*
* @return TRUE if the player is muted, FALSE otherwise
*/
function bool IsTalkerMuted(UniqueNetId ConsoleId);
//@HSL_END_XBOX
/**
* Called when a player is talking either locally or remote. This will be called
* once for each active talker each frame.
*
* @param Player the player that is talking
* @param bIsTalking if true, the player is now talking, if false they are no longer talking
*/
delegate OnPlayerTalkingStateChange(UniqueNetId Player,bool bIsTalking);
/**
* Adds a talker delegate to the list of notifications
*
* @param TalkerDelegate the delegate to call when a player is talking
*/
function AddPlayerTalkingDelegate(delegate<OnPlayerTalkingStateChange> TalkerDelegate);
/**
* Removes a talker delegate to the list of notifications
*
* @param TalkerDelegate the delegate to remove from the notification list
*/
function ClearPlayerTalkingDelegate(delegate<OnPlayerTalkingStateChange> TalkerDelegate);
/**
* Tells the voice layer that networked processing of the voice data is allowed
* for the specified player. This allows for push-to-talk style voice communication
*
* @param LocalUserNum the local user to allow network transimission for
*/
function StartNetworkedVoice(byte LocalUserNum);
/**
* Tells the voice layer to stop processing networked voice support for the
* specified player. This allows for push-to-talk style voice communication
*
* @param LocalUserNum the local user to disallow network transimission for
*/
function StopNetworkedVoice(byte LocalUserNum);
/**
* Tells the voice system to start tracking voice data for speech recognition
*
* @param LocalUserNum the local user to recognize voice data for
*
* @return true upon success, false otherwise
*/
function bool StartSpeechRecognition(byte LocalUserNum);
/**
* Tells the voice system to stop tracking voice data for speech recognition
*
* @param LocalUserNum the local user to recognize voice data for
*
* @return true upon success, false otherwise
*/
function bool StopSpeechRecognition(byte LocalUserNum);
/**
* Gets the results of the voice recognition
* Will not return results that were below the SpeechRecognition's ConfidenceThreshold,
* so you may get an empty array back
*
* @param LocalUserNum the local user to read the results of
* @param Words the set of words that were recognized by the voice analyzer
*
* @return true upon success, false otherwise
*/
function bool GetRecognitionResults(byte LocalUserNum,out array<SpeechRecognizedWord> Words);
/**
* Called when speech recognition for a given player has completed. The
* consumer of the notification can call GetRecognitionResults() to get the
* words that were recognized
*/
delegate OnRecognitionComplete();
/**
* Adds the speech recognition notification callback to list of callbacks for the specified user
*
* @param LocalUserNum the local user to receive notifications for
* @param RecognitionDelegate the delegate to call when recognition is complete
*/
function AddRecognitionCompleteDelegate(byte LocalUserNum,delegate<OnRecognitionComplete> RecognitionDelegate);
/**
* Clears the speech recognition notification callback to use for the specified user
*
* @param LocalUserNum the local user to receive notifications for
* @param RecognitionDelegate the delegate to call when recognition is complete
*/
function ClearRecognitionCompleteDelegate(byte LocalUserNum,delegate<OnRecognitionComplete> RecognitionDelegate);
/**
* Changes the vocabulary id that is currently being used
*
* @param LocalUserNum the local user that is making the change
* @param VocabularyId the new id to use
*
* @return true if successful, false otherwise
*/
function bool SelectVocabulary(byte LocalUserNum,int VocabularyId);
/**
* Changes the object that is in use to the one specified
*
* @param LocalUserNum the local user that is making the change
* @param SpeechRecogObj the new object use
*
* @param true if successful, false otherwise
*/
function bool SetSpeechRecognitionObject(byte LocalUserNum,SpeechRecognition SpeechRecogObj);
/**
* Mutes all voice or all but friends
*
* @param LocalUserNum the local user that is making the change
* @param bAllowFriends whether to mute everyone or allow friends
*/
function bool MuteAll(byte LocalUserNum,bool bAllowFriends);
/**
* Allows all speakers to send voice
*
* @param LocalUserNum the local user that is making the change
*/
function bool UnmuteAll(byte LocalUserNum);