Skip to content

Conversation

@nchapman
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings November 29, 2025 18:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements dynamic rate control for audio/video synchronization based on Hans-Kristian Arntzen's "Dynamic Rate Control for Retro Game Emulators" (2012). The changes replace a deadband-based proportional controller with a mathematically proven continuous feedback algorithm that maintains audio buffer at 50% capacity, providing optimal headroom for timing jitter while keeping pitch adjustments inaudible.

Key changes:

  • Replaced proportional controller with continuous formula: adjustment = 1 - (1 - 2*fill) * d
  • Tightened resampler clamping from ±50%/±100% to ±1% to match the d=0.5% parameter
  • Updated tests to work with smaller adjustment range (1% instead of 2%)
  • Added comprehensive documentation explaining the algorithm and implementation

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
workspace/all/common/audio_resampler.h Updated documentation to reflect ±1% clamping range
workspace/all/common/audio_resampler.c Tightened clamping bounds from ±50%/±100% to ±1%, updated explanatory comments
workspace/all/common/api.c Replaced deadband controller with Arntzen's continuous formula, inverted for resampler semantics
tests/unit/all/common/test_audio_resampler.c Updated tests to use larger sample sizes and ±1% adjustments for reliable detection
docs/audio-rate-control.md Added comprehensive documentation of algorithm, implementation, and rationale

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nchapman nchapman merged commit 5ba8e67 into develop Nov 29, 2025
4 checks passed
@nchapman nchapman deleted the feature/video-king branch November 29, 2025 19:11
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