-
Notifications
You must be signed in to change notification settings - Fork 1.3k
audio: Add UAC1.0 support #3270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: Mengsk <[email protected]>
Signed-off-by: Mengsk <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: Mengsk <[email protected]>
Signed-off-by: Mengsk <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive USB Audio Class 1.0 (UAC1) support to TinyUSB's audio device driver, enabling dynamic switching between UAC1 and UAC2 based on host capabilities. The implementation focuses on improving compatibility with Full-Speed devices by recommending UAC1 for better OS compatibility while maintaining UAC2 for High-Speed performance.
- Adds complete UAC1 constants, descriptors, and macros with
audio10_
prefix - Implements UAC1 descriptor parsing and control request handling in audio device driver
- Updates examples to support both UAC1 and UAC2 with automatic fallback capability
Reviewed Changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/device/usbd.h | Adds UAC1 descriptor templates and renames UAC2 macros for clarity |
src/device/usbd.c | Adds UAC1 device support without IAD descriptor handling |
src/common/tusb_compiler.h | Adds TU_ARGS_APPLY_EXPAND macro for variable argument expansion |
src/common/tusb_common.h | Adds U24 byte manipulation macros for UAC1 feedback format |
src/class/midi/midi_host.c | Updates to use renamed UAC1 constants |
src/class/audio/audio_device.h | Removes deprecated config options and adds version detection API |
src/class/audio/audio_device.c | Implements UAC1 parsing, control handling, and feedback format logic |
src/class/audio/audio.h | Comprehensive UAC1/UAC2 constants reorganization and new descriptors |
examples/device/uac2_speaker_fb/* | Removes OS guessing quirks, adds UAC1/UAC2 dual support |
examples/device/uac2_headset/* | Updates to use renamed UAC2 constants |
examples/device/cdc_uac2/* | Updates to use renamed UAC2 constants |
Signed-off-by: HiFiPhile <[email protected]>
3a9fec6
to
a944c0d
Compare
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: Mengsk <[email protected]>
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
@codex merge master branch to this PR |
For now, I can only help with PRs you've created. |
@copilot merge master branch to this PR |
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
Describe the PR
This PR adds USB Audio Class 1.0 (UAC1) support, now audio device driver supports both UAC1 and UAC2 with dynamic switching possibility based on host capabilities.
For asynchronous OUT with feedback, now it's recommended to use UAC1 for Full-Speed device for better OS compatibility, while UAC2 is recommended only for High-Speed device for better performance.
Let me break down this PR:
USBD
audio.h
with prefixaudio10_
, UAC2 renamed with prefixaudio20_
usbd.h
, refactor fixed size descriptor macros to use auto size with the help ofTU_ARGS_APPLY_EXPAND
Audio device
CFG_TUD_AUDIO_FUNC_n_DESC_LEN
configCFG_TUD_AUDIO_ENABLE_FEEDBACK_FORMAT_CORRECTION
, now UAC1 always use 3-bytes 10.14 format while UAC2 always use 4-bytes 16.16 formatExamples
Testing
On STM32F407 & STM32F723:
tinyusb/examples/device/uac2_speaker_fb/src/usb_descriptors.h
Line 137 in 6e153a9