The audio class provides several structures that can be used to build an audio function topology. These structures relate to units, terminals and streams. They will be declared and initialized in usbd_audio_dev_cfg.h
and usbd_audio_dev_cfg.c
files. presents all configurable structures and the associated function that will use the structure. Functions are described in Class Instance Configuration section.
The use of these structures makes the audio function topology highly configurable. It allows to describe any type of audio topology.
Several tables will follow describing all fields of all units, terminals and streams structures. All units, terminals structures and some stream structures' fields follow the associated descriptor content defined in audio 1.0 specification. That's why some tables will indicate which audio 1.0 specification section to refer to for more details when it is relevant. Matching the descriptor content defined in the audio 1.0 specification allows to easily understand the audio function topology configuration.
The file usbd_audio_dev_cfg.c
located in
\Micrium\Software\uC-USB-Device-V4\Cfg\Template\
It shows a typical example of terminal, unit and stream structures configuration:
- Two Inputs terminals
- Two Ouput terminals
- Two Feature units
- Two AudioStreaming interfaces
gives a visual representation of the possible topologies that can be built with the 6 terminals and units.
Terminals
All terminals must have a unique ID within a given audio function. The terminals ID assignment is handled by the audio class using the functions USBD_Audio_IT_Assoc
and
USBD_Audio_OT_Assoc
.
Input Terminal
presents the Input terminal structure. Refer to audio 1.0 specification, section "4.3.2.1 Input Terminal Descriptor" for more details about certain fields.
Output Terminal
presents the Output terminal structure. Refer to audio 1.0 specification, section "4.3.2.2 Output Terminal Descriptor" for more details about certain fields.
Units
All units must have a unique ID within a given audio function. The units ID assignment is handled by the audio class using the functions USBD_Audio_FU_Assoc
, USBD_Audio_MU_Assoc() and USBD_Audio_SU_Assoc.
Feature Unit
presents the Feature Unit structure. Refer to audio 1.0 specification, section "4.3.2.5 Feature Unit Descriptor" for more details about certain fields.
LogChCtrlPtr
points to a table of 16-bit unsigned integers. These integers are used as bitmaps to describe which Feature Unit controls are supported by a certain logical channel. Refer to for the complete list of Feature Unit controls. An audio stream encodes several logical channels forming a cluster. For instance, in a stereo stream, left and right channel are two logical channels. Each Feature Unit can apply a certain control to a specific logical channel or to all channels at once. The master channel is used to designate all channels. The code snippet below shows an example of Feature Unit controls table. The table index represents the logical channel number.
Mixer Unit
presents the Mixer Unit structure. Refer to audio 1.0 specification, section "4.3.2.3 Mixer Unit Descriptor" for more details about certain fields.
The total number of logical input channels (
LogInChNbr
) is equal to the addition of all logical input channels that composes each input pin. For instance, if a Mixer Unit has 3 inputs pins with the following logical input channels characteristics:
- Input pin #1: stereo
- Input pin #2: mono
- Input pin #3: stereo
Thus the total number would be 5 in this example.
A Mixer Unit can have programmable and non-programmable mixing controls. If you need to set some programmable mixing controls, you need to use the function
USBD_Audio_MU_MixingCtrlSet
during the audio function initialization.
Selector Unit
presents the Selector Unit structure. Refer to audio 1.0 specification, section "4.3.2.4 Selector Unit Descriptor" for more details about certain fields.
Streams
General Stream Configuration
presents the general stream configuration structure.
AudioStreaming Interface
presents the AudioStreaming interface configuration structure. Each AudioStreaming interface has one unique associated isochronous endpoint. Hence, there is a one-to-one relation between an AudioStreaming interface and its associated endpoint.
The table pointed by SamplingFreqTblPtr
can be declared as shown below:
presents the structure used to gather information about all alternate settings configuration for a given AudioStreaming interface.
Table pointed by AS_CfgPtrTbl
can be declared as shown below: