Control interface
Control interface is designed to access primitive controls. There is also interface notifying about control and structure changes.
General overview
In ALSA control feature, each sound card can have control elements. The elements are managed according to below model.
element set
A set of elements with the same attribute (i.e. name, get/put operations). Some element sets can be added to a sound card by drivers in kernel and userspace applications.
element
An element can be identified by userspace applications. Each element has own identical information.
member
An element includes some members to have a value. The value of each member can be changed by both of userspace applications and drivers in kernel.
Each element can be identified by two ways; a combination of name and index, or numerical number (numid).
The type of element set is one of integer, integerr64, boolean, enumerators, bytes and IEC958 structure. This indicates the type of value for each member in elements included in the element set.
When the value of member is changed, corresponding events are transferred to userspace applications. The applications should subscribe any events in advance.
Supplemental data for elements in an element set
TLV feature is designed to transfer data in a shape of Type/Length/Value, between a driver and any userspace applications. The main purpose is to attach supplement information for elements to an element set; e.g. dB range.
At first, this feature was implemented to add pre-defined data readable to userspace applications. Soon, it was extended to handle several operations; read, write and command. The original implementation remains as the read operation. The command operation allows drivers to have own implementations against requests from userspace applications.
This feature was introduced to ALSA control feature in 2006, at commit c7a0708a2362, corresponding to a series of work for Linux kernel (42750b04c5ba and 8aa9b586e420).
There’s no limitation about maximum size of the data, therefore it can be used to deliver quite large arbitrary data from userspace to in-kernel drivers via ALSA control character device. Focusing on this nature, as of 2016, some in-kernel implementations utilize this feature for I/O operations. This is against the original design.