...
usbd_audio.h / usbd_audio.c
Prototype
Code Block |
---|
|
void USBD_Audio_MU_MixingCtrlSet (CPU_INT08U class_nbr,
CPU_INT08U mu_id,
CPU_INT08U log_in_ch_nbr,
CPU_INT08U log_out_ch_nbr,
USBD_ERR *p_err); |
Arguments
class_nbr
Class instance number.
...
A Mixer Unit with 2 stereo Input pins and 1 stereo Output pin is considered. In In Figure - Mixer Unit Example, u refers to logical input channels and v to logical output channel.
Anchor |
---|
| Figure - Mixer Unit Example |
---|
| Figure - Mixer Unit Example |
---|
|
Panel |
---|
borderWidth | 0 |
---|
title | Figure - Mixer Unit Example |
---|
|
Image Added
|
The following excerpt from section "4.3.2.3 Mixer Unit Descriptor" of audio 1.0 specification explains how the programmable controls are reported in bmControls
:
...
n represents the number of logical input channels and m the number of logical output channels.
Listing - Mixer Unit with Non-Programmable and Programmable Controls shows the situation #2 where Mixer Unit has non-programmable and programmable controls. We consider that left logical input channels can be mixed in left logical output channel and right logical input channels can be mixed in right logical output channel. gives Table - Representation of Mixer Unit Programmable Controls gives a representation of the programmable controls for our example:
Anchor |
---|
| Table - Representation of Mixer Unit Programmable Controls |
---|
| Table - Representation of Mixer Unit Programmable Controls |
---|
|
Panel |
---|
borderWidth | 0 |
---|
title | Table - Representation of Mixer Unit Programmable Controls |
---|
|
Row | u \ v | 1 | 2 |
---|
row 1 | 1 | '1' | '0' | row 2 | 2 | '0' | '1' | row 3 | 3 | '1' | '0' | row 4 | 4 | '0' | '1' |
|
As stated by the excerpt, the 2D bit array is stored row after row. would Table - Representation of Mixer Unit Programmable Controls would produce the following bmControls
field:
...
The resulting USBD_Audio_MU_MixingCtrlSet()
calling sequence would be (for clarity, the error handling is not shown in this code snippet):
Anchor |
---|
| Listing - Mixer Unit with Non-Programmable and Programmable Controls |
---|
| Listing - Mixer Unit with Non-Programmable and Programmable Controls |
---|
|
Code Block |
---|
language | cpp |
---|
title | Listing - Mixer Unit with Non-Programmable and Programmable Controls |
---|
linenumbers | true |
---|
|
USBD_ERR err;
CPU_INT08U audio_nbr;
audio_nbr = USBD_Audio_Add(APP_CFG_USBD_AUDIO_NBR_ENTITY,
&USBD_Audio_DrvCommonAPI_Template,
DEF_NULL,
&err);
MU11_ID = USBD_Audio_MU_Add(audio_nbr,
&USBD_MU11_Cfg,
&USBD_Audio_DrvMU_API_Template,
&err);
USBD_Audio_MU_MixingCtrlSet(audio_nbr, MU11_ID, 1u, 1u, &err);
USBD_Audio_MU_MixingCtrlSet(audio_nbr, MU11_ID, 2u, 2u, &err);
USBD_Audio_MU_MixingCtrlSet(audio_nbr, MU11_ID, 3u, 1u, &err);
USBD_Audio_MU_MixingCtrlSet(audio_nbr, MU11_ID, 4u, 2u, &err); |