Microsoft DirectX 9.0 SDK Update (Summer 2003) |
Creating a 3-D Voice Session
You can add extra realism to a Microsoft® DirectPlay® Voice session by making the sound three-dimensional. Your players can then use audio cues to perceive the positions and movement of the other players. The basis for a 3-D voice session is the 3-D capabilities of Microsoft DirectSound®. This document discusses how to manage your voice buffers to create a 3-D voice session. For complete details about how to use the DirectSound 3-D application programming interface (API), see 3-D Sound.
Managing 3-D Voice Buffers
When you receive a voice transmission, it is streamed into a DirectSound buffer. By default, everything is streamed into the main buffer. To implement 3-D sound, you must have a separate buffer for each distinct source. You can then use the DirectSound 3-D API to manage the buffers to create 3-D sound.
You can specify separate 3-D buffers for individual players and for groups of players. To specify a 3-D buffer for a particular player or group, call IDirectPlayVoiceClient::Create3DSoundBuffer and pass the method either the player or group DVID. All transmissions from that player or group will then go into the specified 3-D buffer.
DirectPlay Voice 3-D buffers have the following characteristics.
- If you do not specify a 3-D buffer for a player or group, those transmissions will be streamed into the main buffer.
- If you specify a 3-D buffer for a player or group, those transmissions will not be streamed into the main buffer.
- You can retrieve the 3-D buffer for the main buffer by calling IDirectPlayVoiceClient::Create3DSoundBuffer with DVID_REMAINING as the DVID.
- A player's transmission can be streamed into multiple buffers that can be managed separately. For instance, if a player has a 3-D buffer and is also a member of a group with a 3-D buffer, the player's transmissions will be streamed into both buffers. For example, you might have the group's transmissions coming from a radio on a table. If the player runs by shouting, you can hear the player through the radio, with a fixed position, as well as from a moving sound source as the player runs by.
- You can mute the main buffer by calling IDirectPlayVoiceClient::SetClientConfig and setting the DVCLIENTCONFIG_MUTEGLOBAL flag in the DVCLIENTCONFIG structure. If the main buffer is muted, your player will hear only those voice streams that have a 3-D buffer.