?/TD>
Microsoft DirectX 9.0

Handling Voice Client Messages


This document describes how to handle messaging for a client of a Microsoft?DirectPlay?Voice session. For a discussion of host-related messaging, see Handling Voice Host Messages. For a discussion of general messaging issues, see Handling DirectPlay Messaging.

General Voice Messaging Considerations

Many of the messages used by DirectPlay Voice are similar to those used by the DirectPlay core application programming interface (API). However, be aware that similar core and voice messages sometimes differ in their usage.

For example, when you connect to either a core or voice session, DirectPlay returns a completion message with the results of your connection attempt. With a core session, you may get a DPN_MSGID_CONNECT_COMPLETE completion message under some circumstances, even when you connect synchronously. With DirectPlay Voice however, you will never get a completion message if you attempt to connect synchronously to a voice session. You get a DVMSGID_CONNECTRESULT completion message only if you connect to a voice session asynchronously.

One notable difference between core and voice message handling is that your core message handler receives every core message. With DirectPlay Voice, you have the option of specifying a list of messages that you want to receive by calling IDirectPlayVoiceClient::SetNotifyMask. You will receive only those messages that are on the notification list that you pass to this method through the pdwMessageMask parameter. This list must contain at least one message. You cannot use IDirectPlayVoiceClient::SetNotifyMask to disable all DirectPlay Voice messages.

Note  DirectPlay and DirectPlay Voice sessions are separate entities. While there are guarantees about message order for each interface, there are no guarantees about message order between interfaces.

Startup Messages

DirectPlay Voice is an optional addition to a regular DirectPlay session. It enables voice communication between the session members. Before you can become a client of a voice session, you must have created the appropriate DirectPlay object and be connected to a regular peer-to-peer or client/server session. See Peer-to-Peer Sessions or Client/Server Sessions for details.

Every voice session must have a host. If you are in a peer-to-peer session, one of the members must be selected as the voice session host. The voice host need not be the same member as the one that is hosting the core session. If you are in a client/server session, the server must host the voice session as well as the core session. When a session host has been determined, the host must start the voice session by creating a voice server object and calling IDirectPlayVoiceServer::StartSession. Once the session has been started, clients can connect.

This section outlines the messages that a voice client receives when joining a session.

Messaging During Normal Game Play

Once you have successfully connected, there are a number of messages that you might receive during the course of a voice session. The list of possible messages depends on whether you are in a peer-to-peer or client/server voice session. As a general rule, voice clients in a client/server voice session do not receive any messages that are associated with a particular player.

Common Voice Messages

The following messages can be received by clients of both types of voice sessions.

Peer-to-Peer Messages

The following messages can be received only by clients of peer-to-peer voice sessions.

Session Termination Messages



© 2002 Microsoft Corporation. All rights reserved.