usb audio devices and windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · web...

29
Windows Platform Design Notes Design Information for the Microsoft® Windows® Family of Operating Systems USB Audio Devices and Windows Abstract The Universal Audio Architecture (UAA) describes a class driver architecture for personal computer (PC) audio solutions supported in the next version of the Microsoft® Windows® operating system, codenamed “Windows Longhorn.” This paper provides information about how the USB Audio specifications are implemented by Usbaudio.sys, the Microsoft UAA class driver for USB audio devices. Draft Version 0.3 - April 1, 2003 Contents Introduction...............................................................3 Universal Audio Architecture.............................................3 Compatibility of USB Audio Devices with Windows..........................3 Streaming Data.............................................................4 Isochronous Endpoint Types.................................................4 Topology...................................................................4 Interface Descriptors....................................................4 Multiple Types as Alternate Interfaces..................................11 Control Interface and Unit Descriptors..................................12 String Descriptors......................................................13 Property Sets.............................................................13 Standard Audio Properties...............................................13 Feature Unit Properties.................................................14 Processing Unit Properties..............................................16 Device-Specific Properties..............................................19 AC-3 (Type II) Properties...............................................19 Filter-Level Properties.................................................19 Pin Properties..........................................................20 Pin Data Intersection.....................................................20 USB Audio 2.0 Enhancements................................................20 Call to Action and Resources..............................................21

Upload: hadan

Post on 12-Jun-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

Windows Platform Design NotesDes ign In fo rmat ion fo r t he Mic roso f t ® Windows® Fami l y o f Opera t ing Sys tems

USB Audio Devices and Windows

AbstractThe Universal Audio Architecture (UAA) describes a class driver architecture for personal computer (PC) audio solutions supported in the next version of the Microsoft® Windows® operating system, codenamed “Windows Longhorn.” This paper provides information about how the USB Audio specifications are implemented by Usbaudio.sys, the Microsoft UAA class driver for USB audio devices.

Draft Version 0.3 - April 1, 2003

ContentsIntroduction...............................................................................................................................................3

Universal Audio Architecture...............................................................................................................3Compatibility of USB Audio Devices with Windows.............................................................................3

Streaming Data.........................................................................................................................................4Isochronous Endpoint Types....................................................................................................................4Topology...................................................................................................................................................4

Interface Descriptors...........................................................................................................................4Multiple Types as Alternate Interfaces...............................................................................................11Control Interface and Unit Descriptors...............................................................................................12String Descriptors..............................................................................................................................13

Property Sets..........................................................................................................................................13Standard Audio Properties.................................................................................................................13Feature Unit Properties.....................................................................................................................14Processing Unit Properties................................................................................................................16Device-Specific Properties.................................................................................................................19AC-3 (Type II) Properties...................................................................................................................19Filter-Level Properties.......................................................................................................................19Pin Properties....................................................................................................................................20

Pin Data Intersection...............................................................................................................................20USB Audio 2.0 Enhancements................................................................................................................20Call to Action and Resources..................................................................................................................21

Page 2: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 2

This is a preliminary document and may be changed substantially prior to final commercial release of the software described herein.

The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. 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 presented after the date of publication.

This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT.

Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, email address, logo, person, place or event is intended or should be inferred. © 2003 Microsoft Corporation. All rights reserved.

Microsoft, Windows, and Window NT are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

The names of actual companies and products mentioned herein may be the trademarks of their respective owners.

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 3: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 3

IntroductionThe USB Audio class system driver, Usbaudio.sys, is an AVStream minidriver that provides driver support on Microsoft® Windows® operating systems for USB Audio devices.

This paper describes guidelines for developing USB Audio devices to interoperate with the USB Audio class system driver in Microsoft Windows XP and later versions of the operating system. This paper also provides information about enhancements to Usbaudio.sys planned for Windows Longhorn. Audio device manufacturers can use the information in this paper to ensure compliance with the Microsoft Universal Audio Architecture (UAA) initiative and to design devices for compatibility with the Microsoft Windows family of operating systems.

For general information about Windows Driver Model (WDM) audio architecture and Usbaudio.sys, see the Windows DDK. A preview and documentation for Usbaudio.sys will be provided in a beta version of the Windows Longhorn DDK.

Universal Audio ArchitectureMicrosoft is enhancing audio support in Microsoft Windows through the UAA initiative. The UAA initiative supports important audio technologies through class drivers that are provided and maintained by Microsoft. For Windows Longhorn, Microsoft is planning to supply UAA class drivers for USB and IEEE 1394 audio devices and for internal bus audio solutions including PCI and solutions that comply with the Intel next-generation audio specification, codenamed “Azalia.”

USB Audio devices that are compatible with Usbaudio.sys on Windows Longhorn will automatically be UAA-compliant, without additional work on the part of the manufacturer.

UAA compliance is a proposed future Designed for Windows Logo Program requirement for hardware. For information about UAA, see “Resources and Call to Action” at the end of this paper.

Compatibility of USB Audio Devices with WindowsUsbaudio.sys supports a subset of the hardware features described in the USB Audio specifications. To ensure compatibility with Usbaudio.sys, USB Audio devices must design their devices as described in this paper and comply with the following USB Audio specifications:

Universal Serial Bus Device Class Definition for Audio Devices, Revision 1.0 Universal Serial Bus Device Class Definition for Audio Data Formats, Revision 1.0 Universal Serial Bus Device Class Definition for Terminal Types, Revision 1.0 Universal Serial Bus Device Class Definition for MIDI Devices, Revision 1.0

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 4: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 4

Streaming DataThe Universal Serial Bus Device Class Definition for Audio Data Formats defines four categories of data types for USB Audio devices: Type I, Type II, Type III, and MIDI.

Type I consists of uncompressed pulse-code-modulation (PCM)-based formats. These formats are all fully supported by Usbaudio.sys with the exception of signed 8-bit PCM, for which there is no corresponding Windows format. Type II consists of compressed formats. The USB audio data format specification defines two compressed formats: AC-3 and MPEG (1 and 2). Usbaudio.sys implements only the AC-3 format and restricts the Type II AC-3 data path to non-encrypted data. The driver must be able to read the data buffers sent to it to determine the locations of the frame breaks and the frame formats used for the data. Type III formats are based on the IEC 60958 and IEC 61937 formats for packaging data into what is effectively a PCM-like stream. For this reason, Usbaudio.sys fully implements Type III but only exposes the AC-3 and MP3 data formats. Other Type III formats are not supported by Usbaudio.sys. MIDI format communication is performed through a bulk pipe, in contrast with other formats that take advantage of the isochronous capabilities of the USB bus. The MIDI specification was not fully supported in Windows XP and earlier versions of the operating system. In particular, Usbaudio.sys did not support MIDI elements, which often led to broken topologies and sometimes caused the system to crash. Full MIDI support as defined in the Universal Serial Bus Device Class Definition for MIDI Devices is planned for Usbaudio.sys in Windows Longhorn.

Isochronous Endpoint TypesThe USB specification defines three types of isochronous endpoints: Adaptive, Synchronous, and Asynchronous.

Starting with Windows 98, Usbaudio.sys supported the adaptive and synchronous endpoints, but it did not implement the asynchronous endpoint correctly. Full support for asynchronous endpoints in Usbaudio.sys is planned for Windows Longhorn.

For device compatibility with earlier versions of Windows, vendors may choose to continue using adaptive endpoints. Keep in mind that the use of a lock delay for adaptive endpoints adds latency to the start of a stream.

TopologyA USB Audio device describes its capabilities to the system through a series of device descriptors. These descriptors are defined in the USB Audio specifications. Device descriptors describe the internal topology, control capabilities, and data formats for the device.

Interface DescriptorsUSB devices are described as a series of interfaces. The USB bus driver, Usbd.sys, groups associated audio interfaces and creates a single PDO for each group. Of these interfaces, the streaming interfaces and their alternate interfaces define the AVStream pins for the driver. Each streaming interface from the device results in a

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 5: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 5

single pin. Each alternate interface for a streaming interface results in a separate data range for that pin.

Zero-Bandwidth InterfaceAt least one of the alternate interfaces for each interface must be a zero-bandwidth interface. The USB bus driver uses this to free bus bandwidth when the pin is not in use. The USB bus driver will fail enumeration for any device that does not implement a zero-bandwidth alternate setting for each interface.

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 6: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 6

Type I InterfacesType I interfaces enumerate as PCM or other uncompressed time-based kernel-streaming pin formats, depending on the format tag in the audio-specific interface descriptor. The interface is defined by a series of descriptors that define the actual format capabilities for the interface and the pin.

The following example shows an example of a set of Type I interface descriptors.

INTERFACE DESCRIPTOR: BYTE Length: 0x09 BYTE DescriptorType: 0x04 BYTE bInterfaceNumber: 0x01 BYTE bAlternateSetting: 0x01 BYTE bNumEndpoints: 0x01 BYTE bInterfaceClass: 0x01 BYTE bInterfaceSubClass: 0x02 BYTE bInterfaceProtocol: 0x00 BYTE iInterface: 0x00 -------------------------CS GENERAL STREAM DESCRIPTOR: BYTE Length: 0x07 BYTE DescriptorType: 0x24 BYTE DescriptorSubType: 0x01 BYTE bTerminalLink: 0x01 BYTE bDelay: 0x00 SHORT wFormatTag: 0x0001 -------------------------CS FORMAT TYPE DESCRIPTOR: BYTE Length: 0x0e BYTE DescriptorType: 0x24 BYTE DescriptorSubType: 0x02 BYTE bFormatType: 0x01 BYTE bNumberOfChannels: 0x01 BYTE bSlotSize: 0x01 BYTE bBitsPerSample: 0x08 BYTE bSampleFreqType: 0x00 3BYTE MinSampleRate 0x00137e 3BYTE MaxSampleRate 0x00d6e2 ------------------------- ENDPOINT DESCRIPTOR: BYTE Length: 0x09 BYTE DescriptorType: 0x05 BYTE EndpointAddress: 0x04 BYTE bmAttributes: 0x09 SHORT MaxPacketSize: 0x0038 BYTE Interval: 0x01 BYTE Refresh: 0x00 BYTE SynchAddress: 0x00 -------------------------CS AUDIO ENDPOINT DESCRIPTOR: BYTE Length: 0x07 BYTE DescriptorType: 0x25 BYTE DescriptorSubType: 0x01 BYTE bmAttributes: 0x01 BYTE bLockDelayUnits: 0x02 SHORT wLockDelay: 0x0200

An asynchronous interface has an extra endpoint descriptor in its set of descriptors. The extra endpoint descriptor is not shown in this example because it does not affect the data range for the pin.

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 7: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 7

Interfaces that list a discrete set of sample rates appear as a range defined by the lowest and highest rates.

The next example shows the KSDATARANGE_AUDIO structure that contains the pin data range from the interface descriptors shown in the previous example.

struct { { ULONG FormatSize; ULONG Flags; ULONG SampleSize; ULONG Reserved; GUID MajorFormat; GUID SubFormat; GUID Specifier; } Datarange; ULONG MaximumChannels; ULONG MinimumBitsPerSample; ULONG MaximumBitsPerSample; ULONG MinimumSampleFrequency; ULONG MaximumSampleFrequency;} KSDATARANGE_AUDIO, *PKSDATARANGE_AUDIO =

{ {

sizeof( KSDATARANGE_AUDIO ), 0,

0,0,KSDATAFORMAT_TYPE_AUDIO,KSDATAFORMAT_SUBTYPE_PCM,KSDATAFORMAT_SPECIFIER_WAVEFORMATEX

}, 1, 8, 8, 4990, 55010};

Type II InterfacesType II interfaces enumerate as compressed audio formats without padding. This means that the data is sent to the device in as few packets as the device allows. Empty packets are sent for the rest of the time.

Currently Usbaudio.sys recognizes only the AC-3 data format because few devices support these Type II interfaces, and no device known to Microsoft has implemented the MPEG Type II interfaces.

The following example shows a set of Type II interface descriptors.

INTERFACE DESCRIPTOR: BYTE Length: 0x09 BYTE DescriptorType: 0x04 BYTE bInterfaceNumber: 0x03 BYTE bAlternateSetting: 0x01 BYTE bNumEndpoints: 0x02 BYTE bInterfaceClass: 0x01 BYTE bInterfaceSubClass: 0x02 BYTE bInterfaceProtocol: 0x00 BYTE iInterface: 0x00

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 8: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 8

-------------------------CS GENERAL STREAM DESCRIPTOR: BYTE Length: 0x07 BYTE DescriptorType: 0x24 BYTE DescriptorSubType: 0x01 BYTE bTerminalLink: 0x03 BYTE bDelay: 0x00 SHORT wFormatTag: 0x1002-------------------------CS FORMAT TYPE DESCRIPTOR: BYTE Length: 0x0f BYTE DescriptorType: 0x24 BYTE DescriptorSubType: 0x02 BYTE bFormatType: 0x02 SHORT wMaxBitRate: 0x0280 SHORT wSamplesPerFrame: 0x0600 BYTE bSampleFreqType: 0x02 3BYTE SampleRate[0] 0x00ac44 3BYTE SampleRate[1] 0x00bb80-------------------------AC-3 FORMAT SPECIFIC DESCRIPTOR: BYTE Length: 0x0a BYTE DescriptorType: 0x24 BYTE DescriptorSubType: 0x03 SHORT wFormatTag: 0x1002 LONG bmBSID 0x0000001f BYTE bmAC3Features 0x00 -------------------------ENDPOINT DESCRIPTOR: BYTE Length: 0x09 BYTE DescriptorType: 0x05 BYTE EndpointAddress: 0x04 BYTE bmAttributes: 0x05 SHORT MaxPacketSize: 0x0054 BYTE Interval: 0x01 BYTE Refresh: 0x00 BYTE SynchAddress: 0x00 -------------------------CS AUDIO ENDPOINT DESCRIPTOR: BYTE Length: 0x07 BYTE DescriptorType: 0x25 BYTE DescriptorSubType: 0x01 BYTE bmAttributes: 0x00 BYTE bLockDelayUnits: 0x00 SHORT wLockDelay: 0x0000

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 9: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 9

The next example shows the KSDATARANGE_AUDIO structure that contains the pin data range from the interface descriptors shown in the previous example.

struct { { ULONG FormatSize; ULONG Flags; ULONG SampleSize; ULONG Reserved; GUID MajorFormat; GUID SubFormat; GUID Specifier; } Datarange; ULONG MaximumChannels; ULONG MinimumBitsPerSample; ULONG MaximumBitsPerSample; ULONG MinimumSampleFrequency; ULONG MaximumSampleFrequency;} KSDATARANGE_AUDIO, *PKSDATARANGE_AUDIO =

{ {

sizeof( KSDATARANGE_AUDIO ), 0,

0,0,KSDATAFORMAT_TYPE_AUDIO,KSDATAFORMAT_SUBTYPE_AC3_AUDIO,KSDATAFORMAT_SPECIFIER_WAVEFORMATEX

}, 6, 0, 0, 44100, 48000};

Type III InterfacesType III interfaces enumerate as compressed audio formats with padding, as are found in SPDIF interfaces. This means that the data is sent to the device as any PCM stream would be.

Currently, Usbaudio.sys recognizes only the AC-3 and MP3 data formats. Usbaudio.sys uses much of the same code path for these Type III interfaces as it uses for Type I interfaces.

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 10: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 10

The next example shows a set of Type III interface descriptors.

INTERFACE DESCRIPTOR: BYTE Length: 0x09 BYTE DescriptorType: 0x04 BYTE bInterfaceNumber: 0x01 BYTE bAlternateSetting: 0x03 BYTE bNumEndpoints: 0x01 BYTE bInterfaceClass: 0x01 BYTE bInterfaceSubClass: 0x02 BYTE bInterfaceProtocol: 0x00 BYTE iInterface: 0x00 ------------------------- CS GENERAL STREAM DESCRIPTOR: BYTE Length: 0x07 BYTE DescriptorType: 0x24 BYTE DescriptorSubType: 0x01 BYTE bTerminalLink: 0x01 BYTE bDelay: 0x01 SHORT wFormatTag: 0x2001 ------------------------- CS FORMAT TYPE DESCRIPTOR: BYTE Length: 0x26 BYTE DescriptorType: 0x24 BYTE DescriptorSubType: 0x02 BYTE bFormatType: 0x03 BYTE bNrChannels: 0x02 BYTE bSubframeSize: 0x02 BYTE bBitResolution: 0x10 BYTE bSampleFreqType: 0x0a 3BYTE SampleRate[0] 0x001f40 3BYTE SampleRate[1] 0x002b11 3BYTE SampleRate[2] 0x002ee0 3BYTE SampleRate[3] 0x005622 3BYTE SampleRate[4] 0x005dc0 3BYTE SampleRate[5] 0x007d00 3BYTE SampleRate[6] 0x00ac44 3BYTE SampleRate[7] 0x00bb80 3BYTE SampleRate[8] 0x015888 3BYTE SampleRate[9] 0x017700 ------------------------- ENDPOINT DESCRIPTOR: BYTE Length: 0x09 BYTE DescriptorType: 0x05 BYTE EndpointAddress: 0x03 BYTE bmAttributes: 0x09 SHORT MaxPacketSize: 0x0180 BYTE Interval: 0x01 BYTE Refresh: 0x00 BYTE SynchAddress: 0x00 ------------------------- CS AUDIO ENDPOINT DESCRIPTOR: BYTE Length: 0x07 BYTE DescriptorType: 0x25 BYTE DescriptorSubType: 0x01 BYTE bmAttributes: 0x01 BYTE bLockDelayUnits: 0x01 SHORT wLockDelay: 0x0100

The next example shows the KSDATARANGE_AUDIO structure that contains the pin data range from the interface descriptors shown in the previous example.

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 11: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 11

struct { { ULONG FormatSize; ULONG Flags; ULONG SampleSize; ULONG Reserved; GUID MajorFormat; GUID SubFormat; GUID Specifier; } Datarange; ULONG MaximumChannels; ULONG MinimumBitsPerSample; ULONG MaximumBitsPerSample; ULONG MinimumSampleFrequency; ULONG MaximumSampleFrequency;} KSDATARANGE_AUDIO, *PKSDATARANGE_AUDIO =

{ {

sizeof( KSDATARANGE_AUDIO ), 0,

0,0,KSDATAFORMAT_TYPE_AUDIO,KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF,KSDATAFORMAT_SPECIFIER_WAVEFORMATEX

}, 2, 16, 16, 8000, 96000};

MIDI InterfacesMIDI Interfaces are significantly different than Type I, Type II, and Type III interfaces. A MIDI interface does not require a zero-bandwidth interface because it has no isochronous interfaces. The MIDI interface describes a topology in a similar way as the control interface does for the streaming audio device and the MIDI pins. The MIDI interface need only be selected once at initialization.

MIDI jacks. Each MIDI jack in the interface is translated into a MIDI pin. An embedded MIDI out jack becomes a MIDI Out; an embedded MIDI in jack becomes a MIDI In. MIDI jacks are exposed both as a node and with a GUID {8AC76736-966E-4055-A44D-735107F822A7} for identification. One pin of the node is attached to the pin that represents the data interface to the jack. Any control requests to the jack can be sent to the jack node and data can be sent to the pin. MIDI elements. MIDI elements in the USB MIDI device are separated by node type to represent each defined capability in the element. A GUID has been defined for each node type for the defined functions of a MIDI element.

Multiple Types as Alternate InterfacesTo be usable as both a system audio device and a Type III device (for example, a Type III theater renderer), the device must employ two separate interfaces instead of assigning the new format to the alternate and mixing in the device.

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 12: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 12

It is possible to define an interface that has alternate interfaces of different types. Usbaudio.sys will parse this correctly and create the associated pin data ranges. However, this can cause problems with Windows audio. The Windows audio system component Sysaudio.sys assigns the first PCM-capable pin on the device to be used for system sounds and as the default audio renderer. If the assigned pin is also capable of Type III, the pin may not be usable by an application (such as a software for a DVD drive) because the pin is already in use by the system.

Control Interface and Unit DescriptorsThe control interface precedes the topology descriptors for any audio streaming device except a MIDI device (although an audio streaming device can incorporate a MIDI interface). Usbaudio.sys dynamically generates the AVStream topology for the device from these descriptors.

For device compatibility with Usbaudio.sys, USB Audio devices must implement a complete audio topology that establishes a complete path between input terminals and output terminals.

Terminal UnitsA Terminal Unit is parsed into the node that is best suited for the endpoint it represents. If the terminal type is Streaming terminal (as determined by the terminal type = 0x101), the node connected to the pin will be an SRC (sample-rate conversion) node. Terminals that are not Streaming terminals will parse into either an ADC (analog-to-digital converter) node or a DAC (digital-to-analog converter) node.

Feature UnitsFeature Units create a separate node for each capability as defined by the control bitmap. These nodes are in series in the topology and encompass basic audio controls such as mute, volume, tone, and graphic equalizer (GEQ). These are the node properties that usually would be found in the system mixer panels.

Mixer UnitsMixer Units generate a series of supermix nodes and a SUM node to represent the mixer. The number of supermix nodes is determined by the number of input plugs on the unit.

When incorporating a Mixer Unit into a topology, implement the device as follows:

Make sure that the bitmap for the number of channels is correct, as described in Section 4.3.2.3 of the Universal Serial Bus Device Class Definition for Audio Devices. Make sure that the unit responds to queries for the current setting even if it has no programmable controls. Otherwise, it is impossible for the driver to determine what effect, if any, the mixer would have on the data passing through it, even if all multipliers are unary.

Usbaudio.sys support for Mixer Units is planned for Windows Longhorn.

Processing UnitsProcessing Units result in a single topology node that depends on the control in the descriptor. New topology node types for Processing Units are described in the “Property Sets” section later in this paper.

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 13: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 13

If the Processing Unit can be disabled, a property set can be used to disable it. This property is also described in the “Property Sets” section later in this paper.

It is also common for a Processing Unit to change the channel configuration on its output.

Usbaudio.sys support for Processing Units is planned for Windows Longhorn.

Selector UnitsSelector Units are parsed into MUX (multiplexer) nodes in the topology. A MUX node is not allowed to accept inputs from separate sources unless the sources have the same channel count and configuration. Otherwise, it is nearly impossible for Usbaudio.sys to parse the topology, because the units downstream from the selector are dynamic in their function.

For device compatibility with Usbaudio.sys, inputs to the MUX node must have the same channel count and configuration.

Extension UnitsExtension Units result in the formation of a device-specific node in the topology. This type of node allows the device manufacturer to pass whatever information it desires to the device. More information about properties for device-specific nodes will be provided in a future version of this paper.

String DescriptorsManufacturers are encouraged to use string descriptors. Strings in the device descriptor, terminal, unit, or MIDI jacks are used to label different pieces of the control and device panels in Windows.

Property SetsThe node types of the topology define the scope of the possible controls for the device. The node might not support any of the properties indicated by the node type. Thus it might take some trial-and-error by Usbaudio.sys to fully characterize the capabilities of any one device. The driver is as fault tolerant as possible, but occasionally the driver will reject a device that is too far outside the specifications.

If Usbaudio.sys rejects a device, it is most likely because the device indicates support for a property, but the device either does not support the property or supports it incorrectly. This is the most likely cause of a code 10 for the device reported by Device Manager on enumeration. For device compatibility with Usbaudio.sys, manufacturers should ensure that a device indicates support only for properties that are actually supported by the device.

Standard Audio PropertiesUsbaudio.sys supports all of the standard audio properties (mute, volume, tone, MUX, and mixer) for the nodes that usually have these properties. These standard properties are described in the Windows DDK documentation for WDM Audio drivers.

For the majority of the devices available, these are the only properties to be found on the device. The rest of this section describes additional properties that apply for some devices.

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 14: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 14

Feature Unit PropertiesThe majority of the Feature Unit properties are standard audio properties as described earlier. The GEQ basic-support property request and the parametric equalizer are not well defined by the standard property sets.

This section describes how Usbaudio.sys implements the GEQ. More information about the parametric equalizer will be provided in a future version of this paper.

Graphic EqualizerThe Graphic Equalizer (GEQ) property supports the properties for equalizers defined for WDM Audio drivers, but it handles basic-support property requests (KSPROPERTY_TYPE_BASIC_SUPPORT) in an unusual way. A GEQ is a channel-based property but it does not follow the basic-support request form of the usual channel-based functions (mute, volume, tone, MUX, and mixer). A GEQ requires the capability to determine and set band decibel (dB) levels for each channel, so it is not possible to group these all into a single control range as is done with the usual dB level properties. The basic-support property request can be used effectively in place of the KSPROPERTY_AUDIO_NUM_EQ_BANDS property request because that information would be in the response. For example, a Feature Unit that supports a 10-band 2-channel GEQ with dB ranges from -25 dB to +6 dB with a step of 1 dB on all bands would reply to a basic-support property request with the structure shown in Figure 7 in the next section.

GEQ Basic-Support Response for KSPROPERTY_AUDIO_EQ_LEVELThe response to a basic-support property request from any dB level control (such volume or treble) is in the form of a KSPROPERTY_DESCRIPTION structure, followed by a KSPROPERTY_MEMBERSHEADER structure and a single member of a KSPROPERTY_STEPPING_LONG structure following that. This is inadequate for describing the GEQ capabilities (and for the other dB level controls, as described earlier).

For a GEQ basic-support property request, Usbaudio.sys responds with a KSPROPERTY_DESCRIPTION structure followed by a series of KSPROPERTY_MEMBERSHEADER structures and KSPROPERTY_STEPPING_LONG structures. The MembersListCount member of the KSPROPERTY_DESCRIPTION structure reflects the number of channels supported by the control.

For example, if a control has master, left, and right channels, MembersListCount would contain 3. Following would be a KSPROPERTY_MEMBERSHEADER structure for the master channel, if supported. The MembersCount member of this structure would contain the number of bands for the equalizer master channel. If this is the master channel, the Flags member of the structure will have set the master channel flag. Following would be a KSPROPERTY_STEPPING_LONG structure for each band in the channel. Similarly, following the stepping structures of the first channel would be the member header of the next channel and following that the ranges of its bands, and so on.

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 15: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 15

The following example shows the structure for the GEQ basic-support response.

PVOID pResponseBuffer; // Response buffer pointed to //by property call.

PKSPROPERTY_DESCRIPTION pPropDesc = pResponseBuffer;PKSPROPERTY_MEMBERSHEADER pMembers =

( PKSPROPERTY_MEMBERSHEADER )(pPropDesc + 1);PKSPROPERTY_STEPPING_LONG pStepping =

( PKSPROPERTY_STEPPING_LONG )( pMembers+1);ULONG ulNumberOfBands = 10;ULONG ulNumChannels = 3;ULONG ulTotalSize = sizeof(KSPROPERTY_DESCRIPTION) +

ulNumChannels * ( sizeof(KSPROPERTY_MEMBERSHEADER) + ( sizeof(KSPROPERTY_STEPPING_LONG) * ulNumberOfBands ) );

pPropDesc->AccessFlags = KSPROPERTY_TYPE_BASICSUPPORT |KSPROPERTY_TYPE_GET |KSPROPERTY_TYPE_SET;

pPropDesc->DescriptionSize = ulTotalSize;pPropDesc->PropTypeSet.Set = KSPROPTYPESETID_General;pPropDesc->PropTypeSet.Id = VT_I4;pPropDesc->PropTypeSet.Flags = 0;pPropDesc->MembersListCount = ulNumChannels;pPropDesc->Reserved = 0;

pMembers->MembersFlags = KSPROPERTY_MEMBER_STEPPEDRANGES;pMembers->MembersSize = sizeof(KSPROPERTY_STEPPING_LONG);pMembers->MembersCount = ulNumberOfBands;pMembers->Flags = MASTER_CHANNEL_FLAG;// Signed 16.16 Fixed point values are used in all stepping fieldspStepping[0].SteppingDelta = 0x10000; // 1dB StepspStepping[0].Bounds. SignedMinimum = 0xFFE70000; // -25dB pStepping[0].Bounds. SignedMaximum = 0x00060000; // +6dB : : :pStepping[9].SteppingDelta = 0x10000; // 1dB StepspStepping[9].Bounds. SignedMinimum = 0xFFE70000; // -25dB pStepping[9].Bounds. SignedMaximum = 0x00060000; // +6dB

// Update Pointers..pMembers = (pStepping + ulNumberOfBands);pStepping = (pMembers + 1);

pMembers->MembersFlags = KSPROPERTY_MEMBER_STEPPEDRANGES;pMembers->MembersSize = sizeof(KSPROPERTY_STEPPING_LONG);pMembers->MembersCount = ulNumberOfBands;pMembers->Flags = 0;

pStepping[0].SteppingDelta = 0x10000; // 1dB StepspStepping[0].Bounds. SignedMinimum = 0xFFE70000; // -25dB pStepping[0].Bounds. SignedMaximum = 0x00060000; // +6dB : : :pStepping[9].SteppingDelta = 0x10000; // 1dB StepspStepping[9].Bounds. SignedMinimum = 0xFFE70000; // -25dB pStepping[9].Bounds. SignedMaximum = 0x00060000; // +6dB

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 16: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 16

Processing Unit PropertiesAny given node generated by a processing unit control can employ any or none of the supported properties for that node. It is up to the application to determine which properties the node supports. For information about properties, see “Audio Driver Property Sets” in the Windows DDK.

Enabling Processing Unit ControlsUSB processing units can employ an enable/disable control for the unit. If so, the KSPROPERTY_TOPOLOGYNODE_ENABLE property can be used to enable or disable the function of the unit by sending the BOOLEAN property to that node. If the node is disabled, it is as if the node is not in the path.

For information about KSPROPERTY_TOPOLOGYNODE_ENABLE, see the Windows DDK.

Up/Down Mixer Processing Unit ControlThe Up/Down mix Processing Unit exposes a property that allows the application to set the output channel configuration. The possible channel configurations can be determined from the basic-support property request on the node. Channel configuration selection is based on the bit pattern of the desired configuration that is sent to the node through the KSPROPERTY_AUDIO_CHANNEL_CONFIG audio control property.

For information about KSPROPERTY_AUDIO_CHANNEL_CONFIG, see the Windows DDK.

3D-Stereo Extender Processing Unit ControlThe 3D-Stereo Extender Processing Unit is parsed into the stereo extender topology node. It is identified by the KSNODETYPE_STEREO_WIDE GUID in its node name. This node usually allows only enable/disable properties as described in “Enabling Processing Unit Controls” earlier in this paper. However, it is possible to set a spaciousness level. The property value (operation data) is of type ULONG and specifies the spaciousness level as a percentage. Values follow a linear range from 0 to 256*(65536-1/65536) percent:

The value 0x00010000 represents 100 percent. The value 0xFFFFFFFF represents 100*(65536-1/65536) percent.

Chorus Processing UnitA chorus node can expose a series of properties associated with chorus. The common KSPROPERTY_AUDIO_CHORUS_LEVEL audio property is supported. For information about this property, see the Windows DDK.

Two additional properties currently supported only for USB are also available if supported by the device:

KSPROPERTY_AUDIO_CHORUS_MODULATION_RATE. Chorus modulation rate is expressed in Hz. The property descriptor type is KSNODEPROPERTY with a value of ULONG. USB devices can range from 0 to 255.9961 in 1/256th increments. To accommodate this, the property value should be expressed as a fixed-point 16.16 value, where: The value 0x00010000 represents 1Hz. The value 0xFFFFFFFF represents (65536-1/65536) Hz.

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 17: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 17

KSPROPERTY_AUDIO_CHORUS_MODULATION_DEPTH. Chorus modulation depth is expressed in milliseconds (ms) and sets the speed (frequency) of the modulator. The property descriptor type is KSNODEPROPERTY with a value of ULONG. For USB devices, the value can range from 0 to 255.9961 in 1/256th increments. To accommodate this, the property value should be expressed as a fixed point 16.16 value, where: The value 0x00010000 represents 1 ms. The value 0xFFFFFFFF represents (65536-1/65536) ms.

Reverberation Processing UnitThe reverberation node, generated from the Reverberation Processing Unit, exposes KSPROPERTY_AUDIO_REVERB_LEVEL property. For information about this property, see the Windows DDK.

The following additional USB-only properties are also available if supported by the device:

KSPROPERTY_AUDIO_REVERB_TYPE. The Reverb Type Control as defined in the USB Audio specification has a range from 0 through 7 that represents a global value for the reverb based on types of environments. The property descriptor type is KSNODEPROPERTY with a value of ULONG. This property will report the range of settings in the basic-support call and will accept a value from 0 to 7, although this value may increase if more environments are created. KSPROPERTY_AUDIO_REVERB_TIME. The reverb time is the number of seconds for which the reverberation will continue. The property descriptor type is KSNODEPROPERTY with a value of ULONG. For USB devices, the value can range from 0 through 255.9961 in 1/256th increments. To accommodate this, the property value should be expressed as a fixed point 16.16 value, where: The value 0x00010000 represents 1 second. The value 0xFFFFFFFF represents (65536-1/65536) second.

KSPROPERTY_AUDIO_REVERB_DELAY_FEEDBACK. More information about this property will be provided in a future version of this paper.

Dolby Prologic Processing UnitThe Dolby Prologic Processing Unit properties are the same as those of the Up/Down-Mix Processing Unit in that the output of the node is the changed channel configuration. The property requests for the Dolby Prologic Processing Unit are the same as for the Up/Down-mix Processing Unit:

KSPROPERTY_TOPOLOGYNODE_ENABLE KSPROPERTY_AUDIO_CHANNEL_CONFIG.

For information about these properties, see the Windows DDK.

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 18: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 18

Dynamic Range Compressor Processing UnitThe Dynamic Range Compressor Processing Unit enables a set of properties that are currently specific to Usbaudio.sys:

KSPROPERTY_AUDIO_DRC_COMPRESSION_RATIO. The compression ratio is used to affect the slope of the active part of the static input-to-output transfer characteristics of the unit. This ratio is expressed as a value of n dB/dB where n is the value set. The property descriptor type is KSNODEPROPERTY with a value of ULONG. For USB devices, the value can range from 0 through 255.9961 in 1/256th increments. To accommodate this, the property value should be expressed as a fixed-point 16.16 value, where: The value 0x00010000 represents 1dB/dB. The value 0xFFFFFFFF represents (65536-1/65536) dB/dB.

KSPROPERTY_AUDIO_DRC_MAX_AMPLITUDE. The maximum amplitude value sets the upper limit on the active input range of the compressor unit. This is a signed value. For a USB device, this value can range from -128.0 dB through +127.9961 dB in 1/256th increments. Like volume controls, the property value (operation data) is of type LONG and specifies the dB level. Values use a scale that consists of a decibel range represented by integer values –2147483648 through +2147483647, where: –2147483648 is –Infinity dB (attenuation). –2147483647 is –32767.99998474 dB (attenuation). +2147483647 is +32767.99998474 dB (gain).

This scale has a resolution of 1/65536 dB.

KSPROPERTY_AUDIO_DRC_THRESHOLD. The maximum amplitude value sets the lower boundary on the active input range of the compressor unit. This is a signed value. For a USB device, this value can range from -128.0 dB through +127.9961 dB in 1/256th increments. Like volume controls, the property value (operation data) is of type LONG and specifies the dB level. Values use a scale that consists of a decibel range represented by integer values –2147483648 through +2147483647, where: –2147483648 is –Infinity dB (attenuation). –2147483647 is –32767.99998474 dB (attenuation). +2147483647 is +32767.99998474 dB (gain).

This scale has a resolution of 1/65536 dB.

KSPROPERTY_AUDIO_DRC_ATTACK_TIME. The Attack Time Control is used to determine the response of the compressor to a step increase in the input signal. This value is measured in milliseconds. The property descriptor type is KSNODEPROPERTY with a value of ULONG. For USB devices, the value can range from 0 through 255.9961 in 1/256th increments. To accommodate this, the property value should be expressed as a fixed-point 16.16 value, where: The value 0x00010000 represents 1 ms. The value 0xFFFFFFFF represents (65536-1/65536) ms.

KSPROPERTY_AUDIO_DRC_RELEASE_TIME. The Release Time Control is used to determine the response of the compressor to a step decrease

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 19: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 19

in the input signal. This value is measured in milliseconds. The property descriptor type is KSNODEPROPERTY with a value of ULONG. For USB devices, the value can range from 0 through 255.9961 in 1/256th increments. To accommodate this, the property value should be expressed as a fixed-point 16.16 value, where: The value 0x00010000 represents 1 ms. The value 0xFFFFFFFF represents (65536-1/65536) ms.The node type is STATIC_KSNODETYPE_DYN_RANGE_COMPRESSOR.

Device-Specific PropertiesVendor-defined commands can be added to a device through the Extension Unit defined in the USB Audio specification. These units create a KSNODETYPE_DEV_SPECIFIC node in the topology. The vendor’s application can query such a node for its identifying unit type number and, if correctly identified, the application can send KSPROPERTY_AUDIO_DEV_SPECIFIC property requests to the node.

More information about KSPROPERTY_AUDIO_DEV_SPECIFIC and KSPROPERTY_AUDIO_DEV_SPECIFIC_ID will be provided in a future version of this paper.

AC-3 (Type II) PropertiesDevices that support Type II AC-3 interfaces have an added set of properties for AC-3, which can be applied to the pin generated for this interface.

More information about these properties will be provided in a future version of this paper.

Filter-Level PropertiesOnly two properties, KSPROPERTY_PIN_NAME and KSPROPERTY_USBAUDIO_GET_SET_MEM, can be sent to the filter itself (although technically node properties are filter properties). This allows an application to query the name of any pin on the filter and also to send USB-specific GET_MEM and SET_MEM requests. These requests allow such things as firmware updates or possibly NVRAM or EEPROM manipulation on the device by vendor applications.

For more information about KSPROPERTY_PIN_NAME, see the Windows DDK.

More information about KSPROPERTY_USBAUDIO_GET_SET_MEM will be provided in a future version of this paper.

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 20: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 20

Pin PropertiesAll USB Audio streaming pins other than MIDI support the same set of audio properties:

KSPROPERTY_AUDIO_LATENCY KSPROPERTY_AUDIO_POSITION KSPROPERTY_AUDIO_SAMPLING_RATE

Depending on the device’s pin formats and function, a pin might accept some, all, or none of these properties.

For more information about these properties, see the Windows DDK.

Pin Data IntersectionPin intersection is another well-defined function for WDM audio devices. Usbaudio.sys determines the best possible match for an intersection request based on the following series of priorities:

Sample rate. If an alternate setting on one interface has a higher sample frequency than another, the higher sample frequency will be given priority. Number of channels. Sample bit depth (if there is still more than one possibility after sample rate and number of channels).

The criteria priority will be selectable by application through a pin property, KSPROPERTY_USBAUDIO_INTERSECT_ORDER. More information about this property will be provided in a future version of this paper.

USB Audio 2.0 EnhancementsThe USB Implementers’ Forum Audio Device Working Group is defining improvements to the USB Audio specifications that are needed to take full advantage of updates and improvements made in the USB 2.0 specification, as well as resolving ambiguities and adding features to the USB Audio specifications. Microsoft is actively involved in the update process and is planning to implement the updates in Usbaudio.sys when the updates are ratified by the USB Implementers’ Forum.

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003

Page 21: USB Audio Devices and Windowsdownload.microsoft.com/download/5/7/7/577a5684-8a83-43ae... · Web viewDesign Information for the Microsoft ® Windows ® Family of Operating Systems

USB Audio Devices and Windows - 21

Call to Action and ResourcesCall to Action:For audio device manufacturers:

Design USB Audio devices that are compatible with Usbaudio.sys, as described in this paper. Prepare for the Universal Audio Architecture (UAA), a new class driver architecture for personal computer audio solutions supported in Windows Longhorn. For information about UAA, see Universal Audio Architecture on the WinHEC 2003 CD and on the Web at http://www.microsoft.com/hwdev/tech/audio.

For questions about USB Audio and UAA, please email [email protected].

Resources:Designed for Microsoft Windows XP Application Specification

http://www.microsoft.com/winlogo/software/windowsxp-sw.mspxMicrosoft Hardware and Driver Developer Information

http://www.microsoft.com/hwdev/Microsoft Platform Software Development Kit (SDK)

http://msdn.microsoft.com/downloads/Microsoft Windows Driver Development Kit (DDK)

http://www.microsoft.com/ddk/Microsoft Windows Logo Program System and Device Requirements, Version 3.0

http://www.microsoft.com/winlogo/hardware/HWrequirements.mspxWindows XP Application Compatibility Toolkit

http://msdn.microsoft.com/compatibility/Microsoft Windows XP Hardware Compatibility Test Kit, Version 11.2

http://www.microsoft.com/hwtest/

© 2003 Microsoft Corporation. All rights reserved. Draft Version 0.3 - April 1, 2003