DirectPlay Voice - PowerPoint PPT Presentation

1 / 62
About This Presentation
Title:

DirectPlay Voice

Description:

Server Implementation Details. Mixing Sessions ... Install debug bits during development, watch debug output for details on reason for failure ... – PowerPoint PPT presentation

Number of Views:75
Avg rating:3.0/5.0
Slides: 63
Provided by: rodt
Category:

less

Transcript and Presenter's Notes

Title: DirectPlay Voice


1
(No Transcript)
2
DirectPlay Voice Rod Toll Development
LeadDirectPlay Voice/Lobby Microsoft Corporation
3
Overview
  • DirectPlay Voice
  • Server Implementation Details
  • Host Migration Details
  • Connection Procedure
  • Targeting System Details
  • Integrating With Audio Engine
  • Common Issues
  • Changes For DirectX 8.1 and
  • Windows XP

4
Peer-To-Peer Session
  • Server Implementation Details

5
Peer-To-Peer Sessions
  • Clients stream audio directly to targets
  • Advantages
  • Lowest latency (1 hop, 1 queue)
  • 3D spatialization supported
  • Lowest bandwidth and CPU on host
  • Disadvantages
  • Highest CPU and bandwidth for clients

6
Peer-To-Peer Session
7
Mixing Session
  • Server Implementation Details

8
Mixing Sessions
  • Clients stream audio to the server, server mixes
    audio and sends to clients
  • Advantages
  • Lowest client bandwidth
  • Medium bandwidth on server
  • Disadvantages
  • Highest latency. (2 hops mix)
  • High CPU
  • No 3D spatialization

9
Mixing Session
10
Mixing Server Features
  • Features
  • Per user mixing, per frame
  • Adaptive buffering on each incoming stream
    handles jitter
  • Handles target specification on a per packet
    accuracy
  • Handles up to 64 combinations of players and/or
    groups per packet
  • Multiprocessor friendly

11
Mixing Server Architecture
  • Heavily optimizes mixes
  • Does not decompress unless needed
  • Reuses mixes when appropriate. (i.e., User A
    Hears User B hears)
  • Does not recompress reused mixes
  • Locked to clock on server. All clients are sent
    voice content at the same time
  • Voice data has timeout of 1.5s to prevent
    infinite backup under load (DirectPlay 8 only)

12
Mixing Server Scaling
  • Mixer can spawn multiple mixer threads
  • of mixer threads of processors
  • Provides true concurrent execution on multiple
    processors
  • Designed to minimize contention and parallelism
    compression
  • Secondary mixer threads only run if primary
    cannot keep up with the workload

13
Mixing Server Performance
  • Worst case performance is everyone talking to
    everyone else
  • Prevents any reuse from occurring as every mix is
    different
  • Maximum N compressions N decompressions
  • Poorly designed server can cause linear increase
    in CPU usage
  • To increase performance minimize the number of
    unique mixes

14
Mixing Server Tuning
  • To minimize unique mixes
  • Limit the number of people any one person can
    speak with
  • Break talkers into subgroups to increase
    similarity of mixes
  • Use server controlled targeting to enforce
    targeting restrictions

15
Forwarding Sessions
  • Server Implementation Details

16
Forwarding Sessions
  • Clients stream audio to the server, server
    forwards audio to targets
  • Advantages
  • Low CPU on server
  • Reduced bandwidth on clients
  • Medium latency (2 hops)
  • Disadvantages
  • Highest bandwidth on server

17
Forwarding Session
18
Forwarding Server Features
  • Features
  • Receives streams and forwards them to their
    targets
  • Packet reflector and broadcaster
  • No buffering on streams
  • Handles target specification on a per packet
    accuracy
  • Handles up to 64 combinations of players and/or
    groups per packet
  • Multiprocessor friendly

19
Forwarding Server Tuning
  • CPU load is minimal, bandwidth is high
  • Worst case bandwidth usage is everyone talking to
    everyone else
  • Server is receiving N streams and sending N(N-1)
    streams.
  • Can quickly overwhelm a link
  • To decrease bandwidth usage minimize the number
    of targets for each client
  • Use server controlled targeting to enforce
    restrictions

20
Voice Host Migration
  • Implementation Details

21
Initiating Host Migration
  • Host migration is process of electing new host if
    current host becomes unavailable because
  • Host node calls StopSession() on host interface
  • Host node disconnecting from the session because
    of network error
  • Any other situation which makes host unreachable

22
Host Migration Properties
  • Properties
  • Election order follows order voice create player
    was indicated on host
  • DirectPlay4 and DirectPlay8 supported
  • May complete BEFORE DirectPlay migration
  • Limitations on usage
  • Peer-to-peer voice sessions only
  • Transport must have migration enabled
  • Server controlled targeted is not supported

23
Disabling Host Migration
  • Enabled if enabled for transport.
  • Can disable w/ DVSESSION_NOHOSTMIGRATION in
    DVSESSIONDESC
  • Can be disabled to shutdown session
  • Specify DVFLAGS_NOHOSTMIGRATE to StopSession() in
    the dwFlags parameter

24
Host Migration Process
  • New host
  • Receives a DVMSGID_LOCALHOSTSETUP message which
    allows specification of callback and context for
    new host object
  • Receives a DVMSGID_HOSTMIGRATED message which
    contains pointer to new host object
  • AddRef() on new host object if needed outside of
    callback
  • Clients receive DVMSGID_HOSTMIGRATED with DVID of
    new host

25
Connecting
  • Connection Procedure

26
Connect() Behavior
  • Asynchronous behavior (default)
  • DVMSGID_CONNECTRESULT when process is complete
  • Result of Connect() in message
  • Connect() returns DVSUCCESS_PENDING
  • Synchronous behavior
  • Specify DVFLAGS_SYNC to enable
  • Connect does not return until process is complete
  • Result of Connect() in return code

27
Peer-To-Peer Connects
  • Peer-To-Peer sequence
  • Connect result is indicated.
  • DVMSGID_CREATEVOICEPLAYER for the local player
  • DVMSGID_CREATEVOICEPLAYER messages for other
    players
  • Voice playback will begin once DVMSGID_CREATEVOICE
    PLAYER for local player has been processed

28
Forwarding/Mixing Connects
  • Forwarding/mixing sequence
  • Connect result is indicated.
  • No voice player messages are indicated
  • Voice playback will begin as soon as first voice
    traffic arrives

29
Connect Procedure
  • Voice protocol connect procedure
  • Client broadcasts connect message. Will
    retransmit if no response
  • Host responds to the message
  • Client attempts initialization
  • If initialization is unsuccessful connect fails
  • If initialization is successful host sends name
    table to the client. (Peer-To-Peer only)

30
Targeting
  • Targeting System Details

31
Targeting
  • DirectPlay Voice provides a flexible targeting
    system
  • Can specify up to 64 players and/or groups
  • Player and group IDs are specified as DVIDs which
    are equivalent to transport IDs (DVID DPID
    DPNID)
  • Based on voice nametable NOT transport nametable
  • Packet level resolution

32
Setting Targets
  • SetTransmitTargets is used to set list of
    targets
  • Specified as an array of DVIDs
  • Cannot contain duplicate IDs
  • Can contain a player multiple times (through
    indirection)
  • If DVID_ALLPLAYERS is specified it must be the
    only ID

33
Client Side Targeting
  • Client side targeting implementation
  • Changes target list for next packet that is sent
  • When list changes DVMSGID_SETTARGETS is indicated
    through callback
  • Mixing and Forwarding sessions provide no
    validation for client-side targeting
  • Invalid IDs will be ignored on the host
  • Can result in audio being sent to no one

34
Server Side Targeting
  • Server side targeting implementation
  • Target list change takes effect on next packet
    after update gets to client
  • List changes are indicated through the callback
    on the client with DVMSGID_SETTARGETS
  • Full target list validation for all session types

35
Target List Maintenance
  • If a member of players target list leaves
    session they are automatically removed
  • Target list is updated to remove player
  • DVMSGID_SETTARGETS message indicated on the
    client
  • SetTransmitTarget() replaces previous call
  • To add targets, get current list, update and then
    set

36
Audio System
  • Integrating With Audio Engine

37
Sound Engine Integration
  • Integrates with existing sound engine by sharing
    DirectSound objects.
  • Can share all or any combination
  • DirectSound object
  • DirectSoundBuffer object
  • DirectSoundCapture object
  • Can retrieve objects in use by DirectPlay Voice
    through GetSoundDeviceConfig()

38
Sharing Objects
  • Game creates sound objects
  • Specify the DirectSound and DirectSoundBuffer
    objects in DVSOUNDDEVICECONFIG
  • DirectPlay Voice creates sound objects
  • Specification of flag and priority parameters in
    DVSOUNDDEVICECONFIG
  • DirectPlay Voice uses priority mode and creates a
    primary buffer

39
Buffer Options
  • Main buffer and 3D sound buffers are created with
    following settings
  • Flags 3D, Volume, Global, GetCurrent2
  • 3D Algorithm Default
  • You can control buffer settings by passing
    pre-created buffers to DirectPlay Voice
  • Main buffer DVSOUNDDEVICECONFIG
  • 3D Buffers Create3DSoundBuffer

40
Buffer Formats
  • Playback buffer format
  • 8khz, 16-bit, mono
  • Primary buffer format
  • 22khz, 16-bit, stereo
  • Recording buffer format varies depending on sound
    configuration

41
Audio Stream Access
  • Create3DSoundBuffer enables 3D spatialization of
    audio streams
  • Developer or DirectPlayVoice provided 3D buffers
  • Buffers can be for group or players
  • Player can be mixed to multiple buffers
  • Peer-To-Peer and forwarding are supported

42
Access To Audio Stream
  • Voice effects can be placed onto output buffers
    through the use of DirectMedia objects (DMO)
  • To apply an effect to a buffer
  • Create the buffer with the appropriate settings
  • Specify the DMOs to create to SetFX() and check
    for successful initialization
  • Pass the buffer to DirectPlay Voice

43
Possible Voice Effects
  • Possible uses for DMO objects
  • Access to audio data through use of DMO that
    forwards data to callback
  • Voice morphing
  • Lip syncing
  • Application of radio static to incoming audio
  • Application of ambient noise from transmission
    site

44
Common Issues
  • Causes and Resolutions

45
Sound Quality Issues
  • Sound quality is unacceptable
  • Causes
  • Microphone boost is on and it is not required
  • Automatic gain control is disabled and volume is
    too high
  • Feedback or echo (see later slides)
  • User is breathing into the microphone
  • Resolution
  • Disable microphone boost
  • Enable automatic gain control or lower recording
    volume
  • Reposition microphone

46
Echoed Speech (Delayed)
  • User hears their own voice echoed back to them
    after a delay
  • Causes
  • Remote users input device is capturing users
    output
  • Remote user is configured incorrectly (See Game
    Output Transmitted)
  • Resolution
  • Switch remote user to headset
  • Have remote user reposition their speakers
  • Switch to push to talk

47
Echoed Speech (Immediate)
  • User hears their own voice echoed back to them
    immediately
  • Cause Mixer is configured to redirect microphone
    input to the speakers
  • Resolution Re-configure playback portion of
    mixer to mute microphone line

48
Feedback
  • User receives feedback during wizard
  • Cause Microphone is picking up output from
    speakers causing a feedback loop
  • Resolution Switch to headset or reposition
    speakers

49
CD Audio Recorded
  • Game or other audio from CD is being transmitted
  • Cause Recording mixer is configured to accept
    input from CD line
  • Resolution Re-configure recording portion of
    mixer to de-select or mute CD line

50
Game Output Transmitted
  • Game audio is transmitted to remote users
  • Cause
  • Recording portion of mixer is configured to
    record all output
  • Microphone is picking up speaker output
  • Resolution
  • Re-configure recording portion of mixer to ensure
    what you hear and wave output lines are
    de-selected or muted
  • Reposition speakers

51
Configuration Issues
  • Symptom Wizard passes but Connect() reports
    DVERR_RUNSETUP
  • Cause Running voice wizard on system defaults
    but using voice default for session
  • Resolution Ensure device GUIDs passed to
    CheckAudioSetup match those used in Connect()

52
Configuration Issues (2)
  • User can hear others talking but others cannot
    hear them
  • Issue Microphone input not detected because user
    clicks too quickly through wizard. System ends
    up in half duplex mode
  • Resolution If half duplex session results have
    user run the wizard again

53
Parameter Validation Issues
  • Voice API function call failing because of bad
    parameters
  • Issue
  • Improper parameter usage
  • Resolution
  • Check ALL return codes
  • Install debug bits during development, watch
    debug output for details on reason for failure

54
SetTransmitTargets Issue
  • Calling SetTransmitTargets fails with invalid
    target
  • Issue Valid transport id but not yet valid voice
    id specified in target list
  • Resolution Key available list of targets off of
    voice player management messages NOT transport
    messages

55
Microphones Issue
  • Microphone is plugged in but no voice is being
    recorded. (System with 2 microphones)
  • Issue DirectPlay Voice operates on Microphone 0
    on the system
  • Resolution Disable automatic mixer configuration
    and have user manually configure volume levels
    and mixer

56
Upcoming Changes
  • Updates For DirectX 8.1 and Windows XP

57
DirectPlay Voice 8.1
  • DirectX 8.1 Updates
  • Improved AGC algorithm
  • Multiprocessor scalable mixing server
  • Automated updates to target list when targeted
    client exits
  • DirectPlayVoiceCreate no longer supported
  • DirectPlay8 used as transport for wizard

58
DirectPlay Voice w/XP
  • Itanium systems are supported
  • 64-bit voice wizard
  • 64-bit voice client and server
  • DirectPlay8 only (No 64-bit DirectPlay4)
  • 32-bit versions are also provided
  • Support for all languages supported by Windows XP

59
Fast User Switching
  • Windows XP provides fast switching between users
  • Each users state is preserved and programs
    continue to run
  • Voice conferences continue even with user
    switches
  • User would be unaware they are transmitting
  • DirectPlay Voice automatically mutes playback and
    record when switch occurs

60
Further Information
  • Where To Go From Here

61
DirectX SDK
  • SDK documentation
  • Updated for DirectX 8.1 with more detail
  • Step by step tutorials
  • Sample applications
  • Peer VoiceConnect, VoicePosition, VoiceGroup
  • Mixing/Forwarding Voice client/voice server
  • Tutorial applications
  • Command-line voice enabled application

62
Questions?
Write a Comment
User Comments (0)
About PowerShow.com