// // /*=============================================================================== // // Copyright (C) 2024 PhantomsXR Ltd. All Rights Reserved. // // // // This file is part of the Phantom.XRMOD.VoiceModule.Runtime. // // // // The XR-MOD cannot be copied, distributed, or made available to // // third-parties for commercial purposes without written permission of PhantomsXR Ltd. // // // // Contact nswell@phantomsxr.com for licensing requests. // // ===============================================================================*/ using System; namespace Phantom.XRMOD.GameServices.Runtime { public class VoiceParticipant { /// /// An event that fires if the mute state of the participant changes. /// public Action ParticipantMuteStateChanged; /// /// An event that fires if the Participant's speech detected status changes. /// public Action ParticipantSpeechDetected; /// /// An event that fires if the Participants audio energy changes. /// public Action ParticipantAudioEnergyChanged; /// /// The DisplayName of the participant. /// public string DisplayName; /// /// The UserId and unique identifier of a Vivox channel participant. /// This will be either a Unity Authentication Service UserId if the Authentication package is in use, or a unique GUID assigned by Vivox during the account creation process. /// public string UserId; /// /// The Vivox universal resource identifier of this participant. /// public string URI; /// /// The unique identifier of the channel that this participant is associated with. /// public string ChannelName; /// /// The universal resource identifier of the channel this participant is associated with. /// public string ChannelURI; /// /// Whether or not the AudioEnergy has surpassed the threshold to be considered speech. /// public bool SpeechDetected; /// /// Whether or not this participant is muted. /// public bool IsMuted; /// /// Whether or not this participant is the logged in user. /// public bool IsSelf; /// /// The volume of a participant only for the local user in a given channel. /// public int LocalVolume; /// /// The AudioEnergy of the participant. /// This can be used to create a voice activity meter for participants in a channel. /// public double AudioEnergy; public void SetLocalVolume(int _volume) { OnSetLocalVolume?.Invoke(_volume); } public void SetOutputVolume(int _volume) { OnSetOutputVolume?.Invoke(_volume); } public void MuteUserLocally() { OnMuteUserLocally?.Invoke(); } public void UnmuteUserLocally() { OnUnmuteUserLocally?.Invoke(); } internal void OnParticipantMuteStateChanged() { ParticipantMuteStateChanged?.Invoke(); } internal void OnParticipantSpeechDetected() { ParticipantSpeechDetected?.Invoke(); } internal void OnParticipantAudioEnergyChanged() { ParticipantAudioEnergyChanged?.Invoke(); } internal Action OnSetLocalVolume; internal Action OnSetOutputVolume; internal Action OnMuteUserLocally; internal Action OnUnmuteUserLocally; } }