General Configuration
Some constants are available to customize the class. These constants are located in the USB device configuration file, usbd_cfg.h
. shows their description.
The audio class uses two internal tasks to manage playback and record streams. The task priority and stack size shown in are defined in the application configuration file, app_cfg.h
. Refer to section Audio Class Stream Data Flow for more details about the audio internal tasks.
When configuring audio tasks, you should pay attention to their priority. Indeed, audio tasks runs against the internal core task responsible for control transfers and asynchronous transfers. In general, it is recommended to set the core task's priority higher than the audio tasks priority. It will ensure that control transfers carrying standard and class-specific requests will be processed in a timely fashion. Also, audio tasks rely on asynchronous implementation of isochronous transfers. Thus, prioritizing the core task guarantees that isochronous transfers completion is processed fast enough. Even if streams are open, control transfers are occasional. They won't really disturb the stream processing.
The audio class has two internal tasks: playback and record. There is no recommendation about if playback task should have higher priority than record task or the opposite. You just need to ensure that these internal tasks have a higher priority than any of your application tasks. Audio data are considered as real-time data. Thus, you should prioritize the audio streams processing over other functionalities of your application whenever possible.