Skip to content

Allow explicit audio decoders when loading sounds - #2959

Merged
pvcraven merged 1 commit into
pythonarcade:developmentfrom
snowyukitty:feat/custom-sound-decoder
Oct 9, 2026
Merged

pvcraven merged 1 commit into
pythonarcade:developmentfrom
snowyukitty:feat/custom-sound-decoder

Conversation

@snowyukitty

Copy link
Copy Markdown
Contributor

Refs #2049.

Allow arcade.Sound and arcade.load_sound to accept a keyword-only decoder: MediaDecoder | None and forward it to pyglet's audio loader. Games can select a built-in or custom decoder without subclassing Sound or registering it globally; the default remains automatic selection.

Document the argument and a WAV example in the sound guide, and add regression coverage using pyglet's real WAV decoder. The tests cover both loaders, both streaming modes, resource handles and Path inputs with an unregistered extension, decoded PCM data, and decoder failures without fallback or changes to exception chaining.

Validation on Python 3.12 / Linux with pyglet 3.0.dev11:

  • All 12 new regression cases fail on the original implementation and pass with this change.
  • Full unit suite: 1,602 passed (original implementation: 1,590 passed).
  • Full Ruff formatting, lint and import checks; mypy over 401 source files.
  • The sound guide's new example executes successfully.
  • Pyright and the full Sphinx HTML build with warnings treated as errors, using prefetched intersphinx inventories.

@pvcraven
pvcraven merged commit 81209e0 into pythonarcade:development Oct 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants