arcade icon indicating copy to clipboard operation
arcade copied to clipboard

Feature: Add passing pyglet encoders and/or automatic Ogg support

Open pushfoo opened this issue 1 year ago • 2 comments

Enhancement request:

TL;DR: @DigiDuncan pointed out we can't really load .ogg through arcade

What should be added/changed?

  1. Add a way to pass a decoder supported by pyglet's media.load function
  2. (Optional / risky) Smart and helpful pyogg / PyOggDecoder warnings

What would passing in a decoder would it help with?

Improve arcade user experience by allowing sound loading to:

  1. take specific decoders such as pyglet's PyOggDecoder
  2. avoid subclassing Sound as in Charm's current code
  3. without having to file tickets for new formats (example: QOA)

Changes needed:

  1. Add a decoder keyword argument to arcade.sound.Sound.__init__
  2. ~~Add a temp Decoder protocol to annotate it before upstreaming matching pyglet's codecs~~ Use the existing MediaDecoder type
  3. Document the change
  4. Update the sound page in the programming guide

Follow-up Work

  1. Add an example
  2. Make upstream pyglet PRs to help with https://github.com/pyglet/pyglet/issues/1084:
    1. ~~Define a Decoder Protocol type matching pyglet's pyglet's codecs~~
    2. Add argument and return annotations to the codecs

pushfoo avatar Apr 06 '24 07:04 pushfoo

Thanks for writeup, pushfoo! +1.

DigiDuncan avatar Apr 06 '24 20:04 DigiDuncan

Follow-up from earlier reading tonight:

  1. There's already a MediaDecoder base type in pyglet
  2. Although we could define a MediaDecoderLike protocol, it may be redundant for now

pushfoo avatar Apr 08 '24 07:04 pushfoo