Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

usbd_audio.h / usbd_audio.c

Prototype

Code Block
languagecpp
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
borderWidth0
titleFigure - Mixer Unit Example

Mixer Unit ExampleImage 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
borderWidth0
titleTable - Representation of Mixer Unit Programmable Controls


Rowu \ v12
row 11'1''0'
row 22'0''1'
row 33'1''0'
row 44'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
languagecpp
titleListing - Mixer Unit with Non-Programmable and Programmable Controls
linenumberstrue
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);