Skip to content

Desktop: apply EQ and normalisation changes to the native engine live - #240

Merged
ingoau merged 2 commits into
mainfrom
t3/eq-normalisation-live
Nov 11, 2026
Merged

ingoau merged 2 commits into
mainfrom
t3/eq-normalisation-live

Conversation

@ingoau

@ingoau ingoau commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Fixes #227.

Problem

On desktop, changing EQ bands, EQ preamp or normalisation had no effect on playback until the app restarted. Core::apply_audio_to_backend sent gapless, output device and exclusive to the backend piecewise and had a no-op placeholder (let _ = &self.audio; under #[cfg(feature = "native-audio")]) where the DSP chain should have been updated. NativeBackend::set_audio_settings (which sends Cmd::SetDsp) existed but was only called from tests, so the engine's DSP chain was fixed at construction. ReplayGain/preamp kept working because they travel with the per-item gain.

Change

  • PlaybackBackend gains a set_audio_settings method carrying the full update (DSP chain + gapless + exclusive). The default forwards to set_gapless/set_exclusive, so the external (Android) and null backends behave exactly as before.
  • NativeBackend overrides it, delegating to the inherent method: Cmd::SetDsp retunes the chain mid-stream with the existing smoothing, and the preview player is updated too.
  • LoggedBackend forwards the call (the core always wraps its backend in it — without the override the DSP update would be swallowed) and logs one summary line.
  • ScriptedBackend records the call (ScriptedCall::SetAudioSettings), and RecordingBackend in test support forwards it, so core tests can observe the wiring.
  • apply_audio_to_backend now sends the combined update (keeping the separate set_output_device) instead of the piecewise gapless/exclusive calls.

Tests

  • New core-level regression test an_audio_settings_change_reaches_the_backend_while_playing (fails on main before the fix, passes here).
  • LoggedBackend pass-through test extended to cover the new method.
  • One engine test now drives set_audio_settings through the trait (the route the core takes) rather than the inherent method.

Verified: cargo fmt --all -- --check, cargo clippy --workspace --all-features -- -D warnings, and cargo test --workspace --all-features (43 suites, all green).

Generated by GLM-5.3-Flash in OpenCode

Core::apply_audio_to_backend sent gapless, output device and exclusive
to the backend one by one, and had a no-op placeholder where the DSP
chain should have been updated: on desktop, changing EQ bands, EQ
preamp or normalisation only took effect after a restart, because the
native engine got its DspSettings solely at construction
(NativeBackend::set_audio_settings existed but only tests called it).

Give the PlaybackBackend seam a set_audio_settings method carrying the
full update: the DSP chain plus gapless and exclusive. The default
forwards to set_gapless/set_exclusive, so the external (Android) and
null backends behave exactly as before; NativeBackend delegates to its
inherent method, which sends Cmd::SetDsp (the chain retunes mid-stream
with the existing smoothing) and forwards to the preview player.
LoggedBackend forwards the call so the wrapper can't swallow it, and
ScriptedBackend records it so core tests can observe the wiring.
apply_audio_to_backend now sends the combined update (keeping the
separate set_output_device) instead of the piecewise gapless/exclusive
calls. ReplayGain/preamp keep reaching playback through the per-item
gain as before.

Fixes #227.

Co-authored-by: GLM-5.3-Flash <opencode-agent[bot]@users.noreply.github.com>
@ingoau
ingoau force-pushed the t3/eq-normalisation-live branch from 0631975 to ab5522a Compare November 10, 2026 11:58
Settings applied mid-crossfade reached only the incoming deck's chain;
seeking back before the handover restored A's stale chain. Also set the
output device before exclusive mode, so exclusive opens the new device.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ingoau
ingoau merged commit 8e9534d into main Nov 11, 2026
13 checks passed
@ingoau
ingoau deleted the t3/eq-normalisation-live branch November 11, 2026 00:27
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.

Desktop: EQ and normalisation changes don't reach the native engine until restart

1 participant