usb_audio.USBSpeaker: Speaker audio does not adjust based on Windows volume slider/mute.
维护者通常 1 天内回复
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 冷清
- 技术栈
- c
- 领域
- embedded-iot
调研方向
Start by reading the Feature Unit descriptor in shared-module/usb_audio/init.c and tracing how volume and mute are handled in tud_audio_set_req_entity_cb, usb_audio_usbspeaker_background_drain(), and usb_audio_usbspeaker_get_buffer(). Determine which behavior the project should adopt: apply the controls to samples, stop advertising them, or expose them to Python. Done means Windows volume and mute work as expected under the chosen approach, with relevant tests or verification documented.
由索引模型根据 Issue 内容生成。
描述
CircuitPython version and board name
Adafruit CircuitPython 10.3.0-alpha.4; Adafruit QT Py RP2040 with rp2040
Code/REPL
# in boot.py
import usb_audio
usb_audio.enable(speaker=True, microphone=False)
Behavior
The device correctly registers to Windows 11 Pro 25H2 as a CircuitPython Speaker but adjusting the master volume slider or muting it at the Windows level has no effect on the audio.
Description
No response
Additional information
AI Analysis (Cursor Grok 4.6)
Windows volume does nothing because USBSpeaker claims hardware volume, then never applies it.
The taskbar slider and keyboard volume keys are endpoint volume. On a USB Audio Class 2 speaker, Windows treats that as a hardware Feature Unit control: it sends full-scale PCM and a SET_CUR volume/mute request, and it does not insert a software volume APO.
CircuitPython does the first half of that contract and skips the second.
- The descriptor advertises a real volume control. The speaker Feature Unit marks mute and volume as read/write on master and both channels:
shared-module/usb_audio/init.c
Ln 173–174
/* Feature Unit Descriptor(4.7.2.8) */
TUD_AUDIO20_DESC_FEATURE_UNIT(..., AUDIO20_CTRL_RW << MUTE | AUDIO20_CTRL_RW << VOLUME, ...)
Windows therefore binds the system slider to hardware and will not attenuate the stream itself.
- Firmware stores the host’s volume, then ignores it.
tud_audio_set_req_entity_cb writes usb_audio_mute[] / usb_audio_volume[]. Those arrays are only read back forGET_CUR / GET_RANGE. They are never used when samples are copied.
usb_audio_usbspeaker_background_drain() and usb_audio_usbspeaker_get_buffer() memcpy the USB PCM unchanged. There is no scale, no mute-to-zero, and USBSpeaker exposes no volume/mute property you could apply in Python.
So the slider moves (the SET_CUR succeeded) and the speaker stays at unity gain.
- That is why this is a Windows-specific complaint. macOS and Linux often still apply software volume in the host mixer. Windows does not, once a Feature Unit Volume control exists. Per-app sliders in Volume Mixer can still work, because those are session volumes applied before USB. System / keyboard volume cannot.
A firmware fix has to do one of these:
Apply it: scale (and mute) each sample from the per-channel Feature Unit values. Windows prefers channel 1/2 over master when both are advertised.
Stop claiming it: clear Volume/Mute from the Feature Unit so Windows inserts its software volume APO instead.
Until one of those lands, the host-side workaround is the same as for DACs that advertise volume and ignore it: force software attenuation (WinSoftVol, Equalizer APO, or the per-app mixer).
Delegate it: expose the audio channel mute and audio channel volume parameters from Windows and let other code decide what to do with it.
- 主要语言
- C
- 星标
- 4.6k
- 派生
- 1.4k
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 153
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
adafruit/circuitpython 的其他 Issue
-
board breaks api
难度 2/5 1-3 小时 新手友好度 68/100
adafruit/circuitpython#11099 · 3 条评论 ·
维护者通常 1 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 38/100
adafruit/circuitpython#11515 ·
维护者通常 1 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 35/100
adafruit/circuitpython#11514 · 4 条评论 ·
维护者通常 1 天内回复
-
silabs
难度 5/5 一周以上 新手友好度 20/100
adafruit/circuitpython#11507 · 1 条评论 ·
维护者通常 1 天内回复
-
circuitpython api enhancement
难度 5/5 一周以上 新手友好度 25/100
adafruit/circuitpython#11505 · 5 条评论 ·
维护者通常 1 天内回复
查看 adafruit/circuitpython 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
kovidgoyal/kitty#10625 ·
维护者通常 1 天内回复
-
Feature Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
-
docs
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
本機相簿無法上傳webm檔案未关闭
难度 2/5 1-3 小时 新手友好度 70/100
xiaojieonly/Ehviewer_CN_SXJ#2893 ·