USB Audio Device Driver

Purpose

Supports the Universal Serial Bus (USB) audio devices.

Syntax

#include <sys/usbdi.h>

Description

The USB audio device driver supports isochronous USB devices such as USB audio speakers. Each USB audio device is represented as the following interfaces: audio control and audio streaming. Although these interfaces are associated with the single device, the interfaces are treated as separate devices virtually. The /dev/paud0 special file is created for audio control interface and the /dev/paudas0 special file is created for audio streaming interface.

The audio control interface is used to access the internal functions of an audio device. Any request to change the audio controls within the audio function's units or terminals is directed to the audio control interface of the function.

The audio streaming interface can be configured to operate in mono or stereo mode. The number of input channel data streams varies based on the selected mode. Audio streaming interface must have isochronous endpoint. This interface can have alternative settings that can be used to change some characteristics of the endpoint.

Note: You must use external or third-party audio software to stream and play audio files on the supported USB audio devices.

The following table lists the ioctl operations:

ioctl operation Description
AUDIO_INIT The driver searches the interfaces and alternative settings to determine the setting that can support the requested sample rate, bits per sample, mode, and channels.
AUDIO_STATUS The driver returns information about its internal data structures.
AUDIO_CONTROL The driver handles requests to change the audio properties, for example, start, stop, and pause.
AUDIO_BUFFER The driver calculates and returns the values that are based on the information about its data structures, the amount of data in buffers, the amount of data in requests, the time delay that is specified in the bDelay field, and general class-specific interface descriptor.
AUDIO_WAIT The driver waits until the requests for all remaining playback data are complete. If the bDelay field is specified, it waits for that amount of time. This operation must be called just before the AUDIO_STOP operation to avoid interruption in the last remaining samples in the playback buffer.
AUDIO_SET_CHANNELS The driver updates its copies of the record and playback settings in the driver's internal data structures.
  • If a record path is active and one of the record settings is changed, the driver sends requests to the USB audio device to change the settings in the units.
  • If the playback path is active and one of the playback settings is changed, the driver sends requests to the USB audio device to change the settings in the units for the playback and playback rider paths. For the playback path, the master settings volume must be included in the calculations before you set the playback path volume.
AUDIO_GET_CHANNELS The driver returns information that is based on the four input and one output device models.
AUDIO_CHANNEL_STATUS The driver returns information that is stored in its internal data structures.
AUDIO_SET_GAIN The driver updates its copy of the settings in its internal data structures. If a record path is active, the driver sends requests to the USB audio device to change the settings in the units.
AUDIO_MODIFY_LIMITS The driver updates the values in its internal data structures. If a select() call is pending and one of the conditions to unblock the select() call is met, the select() call is unblocked.
AUDIO_MASTER_VOLUME The driver saves the new master volume value. It calculates the new unit volume value that is based on the new master volume value and the playback volume value. If playback is active, the driver sends requests to the USB audio device to change the settings in the units for the playback and playback rider paths.