//// 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 #include "ChatUser.h" #if TV_API namespace Microsoft { namespace Xbox { namespace GameChat { /// /// Various types of chat messages sent by the GameChat system /// public enum class ChatMessageType { /// /// Sends voice data along with a unique LOOKUP_ID which is built from the local name of remote console and an audio device index /// ChatVoiceDataMessage = 1, /// /// Sends byte array which is used to create an IUser on the remote console /// UserAddedMessage = 2, /// /// Sends XboxUserId string of the user to remove /// UserRemovedMessage = 3, /// /// ProcessIncomingChatMessage was sent an invalid chat packet /// InvalidMessage = 4 }; /// /// Event to report diagnostic and error message information /// public ref class DebugMessageEventArgs sealed { public: /// /// The debug message /// property Platform::String^ Message { Platform::String^ get(); } /// /// The HRESULT of the message. S_OK for non-errors /// property int ErrorCode { int get(); } internal: DebugMessageEventArgs( _In_ Platform::String^ message, _In_ int hr ); private: Platform::String^ m_message; int m_hresult; }; /// /// Arguments for the event when a chat packet is ready to be sent /// public ref class ChatPacketEventArgs sealed { public: /// /// The buffer of the packet that should be sent to remote console(s) /// property Windows::Storage::Streams::IBuffer^ PacketBuffer { Windows::Storage::Streams::IBuffer^ get(); } /// /// Indicates if the packet should be sent with reliable UDP /// property bool SendReliable { bool get(); } /// /// Indicates if the packet should be sent sequential ordering if available /// property bool SendInOrder { bool get(); } /// /// Indicates if the packet should be sent to all connected consoles or just a single remote console. /// If this is false, then TargetUniqueConsoleIdentifier indicates who to send the packet to. /// property bool SendPacketToAllConnectedConsoles { bool get(); } /// /// The remote console to send the packet to. This is nullptr if SendPacketToAllConnectedConsoles is true. /// property Platform::Object^ UniqueTargetConsoleIdentifier { Platform::Object^ get(); } /// /// Indicates the ChatMessageType message type of the packet /// Typically this should be ignored, but some games may need to specific handling around unique types /// property Microsoft::Xbox::GameChat::ChatMessageType ChatMessageType { Microsoft::Xbox::GameChat::ChatMessageType get(); } /// /// If this is a ChatMessageType::ChatVoiceDataMessage message, then this is the first ChatUser whose audio device that created the voice packet. /// For Kinect, there may be multiple ChatUsers who share the Kinect mic, so this is the first ChatUser. /// Otherwise, this is nullptr. /// Typically this can be ignored but some games may want to do specific handling around who created the voice packet. /// property Microsoft::Xbox::GameChat::ChatUser^ ChatUser { Microsoft::Xbox::GameChat::ChatUser^ get(); } internal: ChatPacketEventArgs( _In_ Windows::Storage::Streams::IBuffer^ packetBuffer, _In_ Platform::Object^ uniqueTargetConsoleIdentifier, _In_ bool sendPacketToAllConnectedConsoles, _In_ bool sendReliable, _In_ bool sendInOrder, _In_ Microsoft::Xbox::GameChat::ChatMessageType chatMessageType, _In_ Microsoft::Xbox::GameChat::ChatUser^ chatUser ); private: Windows::Storage::Streams::IBuffer^ m_packetBuffer; Platform::Object^ m_uniqueTargetConsoleIdentifier; bool m_sendPacketToAllConnectedConsoles; bool m_sendReliable; bool m_sendInOrder; Microsoft::Xbox::GameChat::ChatMessageType m_chatMessageType; Microsoft::Xbox::GameChat::ChatUser^ m_chatUser; }; /// /// This delegate compares 2 uniqueRemoteConsoleIdentifiers. They are Platform::Object^ and can be cast or unboxed to most types. /// What exactly you use doesn't matter, but optimally it would be something that uniquely identifies a console on in the session. /// A Windows::Xbox::Networking::SecureDeviceAssociation^ is perfect to use if you have access to it. /// This delegate is not optional and must return true if the uniqueRemoteConsoleIdentifier1 matches uuniqueRemoteConsoleIdentifier2 /// public delegate bool CompareUniqueConsoleIdentifiersHandler( _In_ Platform::Object^ uniqueRemoteConsoleIdentifier1, _In_ Platform::Object^ uniqueRemoteConsoleIdentifier2 ); /// /// This delegate enables titles to process the audio stream. /// To use, set either ChatManagerSettings::PreEncodeCallbackEnabled or ChatManagerSettings::PostDecodeCallbackEnabled to true /// /// A buffer containing the pre-processed raw audio data /// The audio format of the preEncodedRawBuffer /// A collection of users associated with this audio buffer /// A buffer containing processed audio public delegate Windows::Storage::Streams::IBuffer^ ProcessAudioBufferHandler( _In_ Windows::Storage::Streams::IBuffer^ preEncodedRawBuffer, _In_ Windows::Xbox::Chat::IFormat^ audioFormat, _In_ Windows::Foundation::Collections::IVectorView^ chatUsers ); }}} #endif