//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
//// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
//// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//// PARTICULAR PURPOSE.
////
//// Copyright (c) Microsoft Corporation. All rights reserved
#pragma once
#if TV_API
namespace Microsoft {
namespace Xbox {
namespace GameChat {
///
/// Indicates the talking mode of the user
///
public enum class ChatUserTalkingMode
{
///
/// Indicates the chat user is not talking
///
NotTalking = 0x0,
///
/// Indicates the chat user is talking over a headset
///
TalkingOverHeadset = 0x1,
///
/// Indicates the chat user is talking over the Kinect
///
TalkingOverKinect = 0x2
};
public ref class ChatUser sealed
{
public:
///
/// The XboxUserID of this ChatUser
///
property Platform::String^ XboxUserId
{
Platform::String^ get();
}
///
/// The UniqueConsoleIdentifier for this ChatUser
///
property Platform::Object^ UniqueConsoleIdentifier
{
Platform::Object^ get();
}
///
/// Indicates if the this ChatUser is talking or not
///
property ChatUserTalkingMode TalkingMode
{
ChatUserTalkingMode get();
}
///
/// Indicates number of pending audio packets to play.
/// This is controlled by the jitter buffer.
/// The jitter buffer can be controlled by some settings found on ChatManagerSettings
///
property uint32 NumberOfPendingAudioPacketsToPlay
{
uint32 get();
}
///
/// Indicates the current value of the dynamic needed packet count.
/// This is the number of packets required before audio will start playing.
/// This number is dynamically adjusted based on heuristics monitoring how often packets arrive from the network
///
property uint32 DynamicNeededPacketCount
{
uint32 get();
}
///
/// Indicates if the chat user is restricted
///
property Windows::Xbox::Chat::ChatRestriction RestrictionMode
{
Windows::Xbox::Chat::ChatRestriction get();
}
///
/// Returns the IUser for this ChatUser
///
property Windows::Xbox::System::IUser^ User
{
Windows::Xbox::System::IUser^ get();
}
///
/// Returns if the user is local for the console
///
property bool IsLocal
{
bool get();
}
///
/// Returns if the local user is muted.
/// If local user is muted, then doesn't send capture packets to others.
///
property bool IsLocalUserMuted
{
bool get();
}
///
/// Returns if the user is muted.
///
property bool IsMuted
{
bool get();
}
///
/// Returns if the user is muted permanently.
///
property bool IsMutedPermanently
{
bool get();
}
///
/// Returns a list of all channels the user is part of.
///
Windows::Foundation::Collections::IVectorView^ GetAllChannels();
property Windows::Xbox::Chat::ChatParticipantTypes ParticipantType
{
///
/// Gets the ParticipantType for this ChatUser
///
Windows::Xbox::Chat::ChatParticipantTypes get();
///
/// Sets the ParticipantType for this ChatUser
///
void set(Windows::Xbox::Chat::ChatParticipantTypes val);
}
property float Volume
{
///
/// Gets the volume for this ChatUser
/// Volume is a percentage 0.0f to 1.0f
///
float get();
///
/// Sets the volume for this ChatUser
/// Volume is a percentage 0.0f to 1.0f
///
void set(float val);
}
property float LocalRenderTargetVolume
{
///
/// Gets the volume for the render target if this is a local user
/// Volume is a percentage 0.0f to 1.0f.
/// Returns 0 if this is a remote user
///
float get();
///
/// Sets the volume for the chat render target if this is a local user.
/// Volume is a percentage 0.0f to 1.0f
/// Value is ignored if this is a remote user
///
void set(float val);
}
internal:
///
/// Returns the IChatParticipant if this ChatUser
///
property Windows::Xbox::Chat::IChatParticipant^ ChatParticipant
{
Windows::Xbox::Chat::IChatParticipant^ get();
}
///
/// Mute user permanently
///
void MutePermanently();
///
/// UnMute user permanently
///
void UnmutePermanently();
///
/// Internal helper function. If muting local user, then don't send capture packets to others.
/// Else, set ChatParticipant volume to 0.
///
void Mute();
///
/// Internal helper function to unmute user
///
void Unmute();
///
/// Internal function to construct a ChatUser
///
ChatUser(
_In_ Platform::String^ xuid,
_In_ bool isLocal,
_In_opt_ Platform::Object^ uniqueConsoleIdentifier,
_In_ Windows::Xbox::Chat::IChatParticipant^ chatParticipant
);
///
/// Internal function to change the talking mode of the ChatUser
///
void SetTalkingMode(
_In_ ChatUserTalkingMode mode
);
///
/// Internal function to set number of pending audio packets for this ChatUser
///
void SetNumberOfPendingAudioPacketsToPlay(
_In_ uint32 numberOfPendingAudioPacketsToPlay
);
///
/// Internal function to set the restriction mode for this chat user
///
void SetRestrictionMode(
_In_ Windows::Xbox::Chat::ChatRestriction restriction
);
///
/// Internal function to add this chat user to a specific channel
///
void AddChannelIndexToChannelList(
_In_ uint8 channelIndex
);
///
/// Internal function to remove this chat user from a specific channel
///
void RemoveChannelIndexFromChannelList(
_In_ uint8 channelIndex
);
///
/// Set the dynamic needed packet count for this chat user
///
void SetDynamicNeededPacketCount(
_In_ uint32 dynamicNeededPacketCount
);
///
/// Set the Windows::Xbox::Chat::IChatRenderTarget for this chat user
///
void SetChatRenderTarget(
_In_ Windows::Xbox::Chat::IChatRenderTarget^ chatRenderTarget
);
private:
Concurrency::critical_section m_stateLock;
Platform::String^ m_xuid;
Platform::Object^ m_uniqueConsoleIdentifier;
Windows::Xbox::Chat::IChatParticipant^ m_chatParticipant;
Platform::String^ m_gamertag;
ChatUserTalkingMode m_talkingMode;
uint32 m_numberOfPendingAudioPacketsToPlay;
Windows::Xbox::Chat::ChatRestriction m_restrictionMode;
bool m_isLocal;
bool m_isMuted;
bool m_shouldBepermanentlyMuted;
uint32 m_dynamicNeededPacketCount;
Windows::Xbox::Chat::IChatRenderTarget^ m_chatRenderTarget;
///
/// List of channels the user is currently part of.
///
std::vector m_channels;
///
/// ChatParticipant volume prior to mute.
///
float m_chatParticipantVolume;
};
}}}
#endif