oakmound / oak

A pure Go game engine
Apache License 2.0
1.55k stars 83 forks source link

Feature/audio overhaul #191

Closed 200sc closed 2 years ago

200sc commented 2 years ago

See #189, and also #131, although the latter is not done yet

Before this is merged, the new audio system should have implementations for (or spiked and failed for):

200sc commented 2 years ago

Linux is working with two needed things

200sc commented 2 years ago

JS has been spiked and it looks like one needs to use AudioWorklets (https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkletNode) to handle audio like we want to, with a streaming interface. The instructions for doing this revolve around having multiple js files that load each other as classes, which I don't know how to do with syscall/js, if it's even possible.

codecov-commenter commented 2 years ago

Codecov Report

Merging #191 (499ae48) into master (ebf404b) will decrease coverage by 0.41%. The diff coverage is 18.91%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #191      +/-   ##
==========================================
- Coverage   92.67%   92.26%   -0.42%     
==========================================
  Files         141      141              
  Lines        6406     6438      +32     
==========================================
+ Hits         5937     5940       +3     
- Misses        407      435      +28     
- Partials       62       63       +1     
Impacted Files Coverage Δ
dlog/strings.go 0.00% <ø> (ø)
drawLoop.go 44.57% <0.00%> (-17.69%) :arrow_down:
config.go 98.23% <100.00%> (+0.01%) :arrow_up:
dlog/default.go 100.00% <100.00%> (ø)
event/trigger.go 81.81% <100.00%> (-0.33%) :arrow_down:
sceneLoop.go 91.01% <0.00%> (-3.38%) :arrow_down:
event/handler.go 96.66% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ebf404b...499ae48. Read the comment docs.

200sc commented 2 years ago

Darwin can also use our pulse implementation (or our jfreymuth/pulse wrapper, to be less generous)-- and personally I prefer that requirement to the other roads one would need to go down, i.e. compiling more C / C variants to interact with osx specific audio libraries.

200sc commented 2 years ago

Current thought is to do:

  1. Install pulse on the linux arm box and adjust the non-arm test suite to skip examples (they are more effectively tested by graphical runners)
  2. Expose a choice of which audio backing you want to use (with the current options being pulse for unix and direct sound for
  3. Change the old and new direct sound audio systems to share a device so they can both be compiled in
  4. Maybe try to expose to the api a choice of output sound device? Might be too early for that.

Then merge this in and cut a minor release bump for it.

200sc commented 2 years ago

(JS audio can't follow this API as syscall js currently works and android audio basically only works with OpenAL by my understanding, both of which are worth working on but neither worth holding back this branch).

Implausiblyfun commented 2 years ago

Other than the todo with the early return the only other thing of note that I see is the unlimited draw rate change. Namely can we just add it to the description so we dont miss it during changelog creation?

200sc commented 2 years ago

Changelog:

200sc commented 2 years ago

Issues to open after this is merged and released:

Or maybe this is just a "big audio overhaul" issue with these points as sub goals?

200sc commented 2 years ago

@Implausiblyfun Objection to merging this and cutting oak 3.4.0?

Or should we toss in #170 and #179 to 3.4.0 quick?