Skip to content

Fix APU buffering, timing, and audio pops - #7

Open
nathsou wants to merge 1 commit into
mainfrom
apu-fixes
Open

nathsou wants to merge 1 commit into
mainfrom
apu-fixes

Conversation

@nathsou

@nathsou nathsou commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • make the APU the sole audio producer and drain it from a synchronized ring buffer
  • stop the Raylib callback and Web Audio consumer from advancing emulation
  • preserve the last sample on underrun and prevent Web Audio queue overwrites
  • fix triangle DAC popping, ultrasonic triangle handling, noise length/halt behavior, and mixer bounds
  • distribute samples using a CPU-clock phase accumulator
  • honor SMB's per-frame five-step $4017 sequencing and clear queued audio on state restore/mute
  • keep the desktop frontend's audio queue primed without skipping normal game frames

Validation

  • Native codegen/lib/*.c compile with Clang/C11
  • node --check web/index.js
  • node --check web/audio-worklet.js
  • git diff --check

The full desktop link was not available in this environment because the checkout has no Raylib library. The wasm link was not available because the installed Clang has no wasm32 target.

@nathsou nathsou self-assigned this Sep 13, 2026

This branch has not been deployed

No deployments
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.

1 participant