?/TD> |
Microsoft DirectX 9.0 |
The VoiceConnect sample shows how to network with other players to start a Microsoft?DirectPlay?Voice chat session. After joining or creating a session, the players can use a microphone to talk to one other. Other players can join the session at any time.
Source: (SDK root)\Samples\C++\DirectPlay\VoiceConnect
Executable: (SDK root)\Samples\C++\DirectPlay\Bin
For information about how to connect, refer to the User's Guide section of the SimplePeer sample. After connecting, the host is presented with a dialog box asking which voice codec to use. Typical voice applications automatically select a voice codec, or present this to the user in some other fashion. Once the chat session begins, any client can alter the playback or capture settings by clicking Setup.
The VoiceConnect sample is very similar in form to the SimplePeer sample. The VoiceConnect differs by letting clients use DirectPlay Voice to talk to each other using a computer microphone. For detailed programming notes, see the Programming Notes section of the SimplePeer sample.
To create the voice functionality, the application must first initialize DirectPlay voice. This sample does this by calling CNetVoice::Init when the main dialog is initialized. CNetVoice::Init performs the following tasks.
Calls the VoiceSessionTestAudioSetup function to test the audio setup with DirectPlay Voice. VoiceSessionTestAudioSetup does the following:
DirectPlayVoiceClientMessageHandler handles different DirectPlay messages such as:
When Exit is clicked, the application needs to clean up DirectPlay Voice by calling CNetVoice::Free, which does the following: