Archive: HID Audio Controls and Windows
Updated: December 4, 2001
Microsoft Windows 98 and later versions provide built-in support for devices compliant with the USB Device Class Definition for Audio Devices, Version 1.0 (see http://www.usb.org/ ), and for audio control devices compliant with the USB Device Class Definition for Human Interface Devices (HID), Version 1.11.
Input from a HID-based audio control device can control volume, mute, bass, treble, and bass boost settings for audio playback by way of the default system audio device. (Note: Only volume and mute are supported in the original release of Windows 98.)
When designing an audio control device, care should be taken to ensure that the device expresses its capabilities in a manner the operating system can exploit. This article briefly outlines how the HID firmware for such a device should be implemented. The information in this article applies to Windows 98, Windows 2000, and later versions of the Windows operating system.
On This Page
Usage Page and Usages for HID Audio Controls
A device that is to be to recognized as a HID audio control device must declare itself as a Consumer Control device (usage 0x01), as defined in the Consumer Page (page 0x0C) in the Universal Serial Bus HID Usage Tables, Version 1.11 specification. This means that its top-level application collection should be Usage Page (Consumer), Usage (Consumer Control).
When such a device is enumerated by the operating system, the supporting software in the operating system (Mmhid.dll in Windows 98; Hidserv.exe in Windows 98 Second Edition, Windows 2000, Windows Me, and Windows XP) is installed and loaded on the host system. Table 1 outlines the Consumer Page audio controls supported in Windows operating systems.
Table 1. Consumer Page Audio Controls Supported in Windows Operating Systems
* These controls are supported in the original (Gold) release of Windows 98.
The Volume, Bass, and Treble usages (of type LC) should be deployed for relative controls that generate both increment and decrement data represented by a two-bit value, whereas the associated Increment and Decrement usages (of type RTC) should be deployed for pairs of one-bit absolute controls (traditional button controls). The hardware design implementation determines what usage types are appropriate for the HID firmware implementation for a particular device.
Notice that although absolute linear controls are possible and legal according to the USB HID specification, Windows operating systems support only relative Linear Controls.
It is also important to notice that any re-triggering of events should be done by software timers in the host system and not by hardware timers in the device itself. For example, if the user keeps pressing the Volume Increment button, the device should only generate one input report with this state information. Host software performs the actual re-triggering of events that will lead to continuous increments of the volume until the device generates another input report indicating that the button has been released or until the maximum volume has been reached.
Sample Firmware Designs for HID Audio Controls
The following two samples illustrate how firmware that uses the audio controls listed in the previous section can be implemented. The first sample uses the Volume usage (of type LC) for the volume control, and the second sample uses the Volume Increment and Volume Decrement usages (of type RTC). Notice that in both of these samples the mute button is implemented as a Relative, Preferred State type of control, which means that 0-to-1 transitions will toggle mute on and off.
Sample 1. Volume Usage (type LC for Volume Control)
Usage Page (Consumer) Usage (Consumer Control) Collection (Application) Usage (Volume) Logical Minimum (-1) Logical Maximum (1) Report Size (2) Report Count (1) Input (Data, Variable, Relative, Preferred) Usage (Mute) Logical Minimum (0) Logical Maximum (1) Report Size (1) Report Count (1) Input (Data, Variable, Relative, Preferred) Report Count (5) Input (Constant) End Collection
Sample 2. Volume Increment and Volume Decrement Usages (type RTC)
Usage Page (Consumer) Usage (Consumer Control) Collection (Application) Logical Minimum (0) Logical Maximum (1) Usage (Volume Increment) Usage (Volume Decrement) Report Size (1) Report Count (2) Input (Data, Variable, Absolute, Preferred) Usage (Mute) Report Count (1) Input (Data, Variable, Relative, Preferred) Report Count (5) Input (Constant) End Collection
Important Design Aspects for HID Audio Controls
The following lists important aspects of HID-based audio controls supported by Windows operating systems:
Notice that although Windows operating systems provide built-in support only for the controls listed earlier, vendors can easily add support for any number of additional audio controls in value-add, custom software components.
HID devices are accessible to any software application or driver using HID application programming interfaces (APIs) documented in the Windows DDK. Devices are also available to any application using Microsoft DirectInput COM methods documented in the Microsoft DirectX Foundation Software Developers Kit (SDK), version 5.0 or later.
Call to action for HID-based audio controls: