Larry Osterman Principal SDE Microsoft Corporation PC13.
-
Upload
loreen-robertson -
Category
Documents
-
view
227 -
download
4
Transcript of Larry Osterman Principal SDE Microsoft Corporation PC13.
![Page 1: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/1.jpg)
Windows 7: Building Great Audio Communications Applications
Larry OstermanPrincipal SDEMicrosoft Corporation
PC13
![Page 2: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/2.jpg)
What’s new for audio in Windows 7 Vista audio overview Windows 7 feature details:
Device Roles Stream Switching Bluetooth Audio Ducking
Demo Q&A
Agenda
![Page 3: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/3.jpg)
Communications is clearly the wave of the future
New features focused on communications scenarios Multimedia IM VOIP LiveMeeting Etc.
Audio Changes for Windows 7
![Page 4: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/4.jpg)
Improved device role detection Bluetooth audio in-box Stream switching Improved audio latency Automatic attenuation of
audio samples (ducking) Other stuff
Audio Changes for Windows 7
![Page 5: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/5.jpg)
First significant architectural changes since Windows 98
Most of audio stack moved from kernel mode to user mode
Addition of per-application volume controls
Vista Audio Concepts
![Page 6: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/6.jpg)
Vista And Windows 7 Audio Architecture
WASAPI
Audio Driver
DeviceTopology Audio Client
Audio Engine
Endpoint VolumeMMDeviceAPI
Direct Sound
WINMM
WAVE APIMixer API
SWMIDIPlaySound Media Foundation
Policy Engine
![Page 7: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/7.jpg)
Audio Applications Reference “Endpoints”
Audio Endpoints
hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL,
CLSCTX_INPROC_SERVER, __uuidof(IMMDeviceEnumerator), (LPVOID *)&deviceEnumerator);
IMMDevice *defaultDevice = NULL;hr = deviceEnumerator->GetDefaultAudioEndpoint(eRender,
eConsole, &defaultDevice);
Endpoints support an “Activation” ModelIAudioSessionManager *endpointVolume = NULL;hr = defaultDevice->Activate(__uuidof(IAudioSessionManager),
CLSCTX_INPROC_SERVER, NULL, (LPVOID *)&sessionManager);
![Page 8: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/8.jpg)
Volume control based on “audio sessions” An audio session is a collection of
audio streams Each session represents a slider in the
mixer application Each stream is a associated with a session One process may have more than one session One session may span multiple processes
Volume Control
![Page 9: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/9.jpg)
Improved device role detection Added eCommunications audio role Added OEM configurable heuristics to
improve role detection General jack location Geometric location Jack detection ability Jack subtype Etc.
Audio Changes for Windows 7
![Page 10: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/10.jpg)
Reduced latency for shared mode audio
Audio Changes for Windows 7
40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 940
100200300400500600700800
Vista latency (ms)
40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 940
100200300400500600700800900
Windows 7 latency (ms)
![Page 11: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/11.jpg)
Stream Switching May not require any code changes to
your application Depends on use of default eConsole or
eCommunications device Works for waveXxx, MediaFoundation,
DirectSound, DirectShow Does not work for WASAPI
WASAPI is a low level API
Audio Changes For Windows 7
![Page 12: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/12.jpg)
Bluetooth audio in-box Supports both Headset/Handsfree profile
and A2DP (high quality audio playback) Supports enhanced call control messages
Audio Changes For Windows 7
![Page 13: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/13.jpg)
Based on Windows low level HID APIs http://msdn.microsoft.com/en-us/library/ms78
9924.aspx New messages are in the Telephony HID
usage page Support the following usages
Dial Number Dial Memory Redial Ring Others
Call Control HID Messages
![Page 14: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/14.jpg)
Associating a HID device with an audio endpoint Retrieve the PKEY_Device_BaseContainerId from the
endpoint Using the base container ID look up the HID device
associated with that base container Open (CreateFile) the HID collection
for that device
Call Control HID messages
![Page 15: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/15.jpg)
Ducking
demo
![Page 16: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/16.jpg)
Depends on use of eCommunications role New streams opened on eCommunications role
duck non-communications streams Provides notification mechanism to enable
advanced behaviors for applications Supports opt-out for both users
and applications
Automatic Attenuation of Audio Samples
![Page 17: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/17.jpg)
Let’s talk about simple communications applications Simple Media Player “Voice Chat between two machines”
Let’s add support for ducking to these applications
Building a Communications Application
![Page 18: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/18.jpg)
Voice chat application Application uses the WAVE APIs to capture
audio samples from the microphone Need to change the application to use
the eCommunications role Wave APIs:
Use WAVE_MAPPER with WAVE_MAPPED_DEFAULT_COMMUNICATION_DEVICE
DirectShow/DirectSound: Activate IDirectSound/IDirectSoundCapture/IBaseFilter from default device
MediaFoundation: Add the MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_AUDCAP_ROLE attribute to the graph specifying eCommunications
Building A Communications Application
![Page 19: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/19.jpg)
Next we’ll work on the media playerApplication uses DirectShow to render a file with a
progress slider. It also supports basic transport controls Let’s change the application so that it pauses
when a communications stream is startedRegister for ducking notifications with
IAudioSessionManager2::RegisterDuckNotification Implement the IAudioVolumeDuckNotification interface
Building A Communications Application
![Page 20: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/20.jpg)
Finally let’s add support to opt out of ducking Ducking is applied over a second or so,
so it can interfere with media playback Games are likely to want to opt out so that
game audio isn’t accidentally ducked when using in-game voice chat
Notifications and opt-out are independent Opt out is easy
Just call IAudioSessionControl2 :: SetDuckingPreference to opt out
Building a Communications Application
![Page 21: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/21.jpg)
Capture Monitor HDMI Audio Windows Media Player Device Selection Device Specific Audio HID controls Audio HID controls work
when not logged on Reduced power consumption of
DirectSound and DShow APIs Reduced power consumption of MMCSS
Other Windows 7 Audio Features
![Page 22: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/22.jpg)
All Developers Use the default console or
communication device Voice Chat developers
Use the default eCommunications device Add support for BT call controls
Media Player developers Listen for ducking notifications and pause audio
streams when ducking Other developers
Opt out of ducking if appropriate
Call To Action
![Page 23: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/23.jpg)
PDC Documentation PDC Documentation contains preliminary
documentation and whitepapers for all of the stuff I’ve presented in this talk
Larry Osterman’s Blog http://blogs.msdn.com/larryosterman
Other Resources
![Page 24: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/24.jpg)
questions?
![Page 25: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/25.jpg)
Evals & Recordings
Please fill
out your
evaluation for
this session at:
This session will be available as a recording at:
www.microsoftpdc.com
![Page 26: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/26.jpg)
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
![Page 27: Larry Osterman Principal SDE Microsoft Corporation PC13.](https://reader036.fdocuments.us/reader036/viewer/2022062308/56649e435503460f94b370f8/html5/thumbnails/27.jpg)