Skip to content

feat: add getHardwareOutputLatency to measure OS/hardware presentation delay - #609

Merged
alnitak merged 8 commits into
rtAudioMixerfrom
outputLatencyMicro
Nov 10, 2026
Merged

alnitak merged 8 commits into
rtAudioMixerfrom
outputLatencyMicro

Conversation

@alnitak

@alnitak alnitak commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Description

Closes #587.

Adds SoLoud.instance.getHardwareOutputLatency() returning a Duration to measure the presentation delay introduced outside SoLoud by the OS audio pipeline, HAL buffers, DAC, and active audio route (speakers, headphones, Bluetooth):

  • Android: Computes actual presentation latency via AAudio hardware timestamps (AAudioStream_getTimestamp) against the monotonic clock.
  • iOS / macOS: Queries route-aware hardware latency via AVAudioSession.outputLatency + IOBufferDuration / CoreAudio device latency.
  • Windows: Queries WASAPI IAudioClient::GetStreamLatency.
  • Web: Queries AudioContext.outputLatency + baseLatency via Emscripten EM_ASM macros.
  • Fallback: Estimates latency from the device period buffer size and converter delay.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)

@alnitak
alnitak changed the base branch from main to rtAudioMixer November 9, 2026 19:27
@alnitak
alnitak merged commit 7b78962 into rtAudioMixer Nov 10, 2026
@alnitak
alnitak deleted the outputLatencyMicro branch November 10, 2026 12:22
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.

feat(android): expose the AAudio output timestamp so apps can read per-route output latency

1 participant