dsound: keep the high quality resampler for any number of buffers

Staging's dsound-Fast_Mixer moves every resampled buffer to a linear
resampler once more than 4 buffers exist, and that path ignores the
committed region the other mixing paths read. Liarsoft's codeX RScript
games reach 5 buffers and their BGM crackles after voice lines on a
48 kHz device. Default the limit to INT_MAX, like upstream Wine's
behavior; HQBuffersMax in the registry can still lower it.

https://github.com/GloriousEggroll/proton-ge-custom/issues/521

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
GloriousEggrollandClaude Opus 5.5 committed 2026-11-02 21:42:41 -07:00
1 parent 83baaaccba
commit e301e55e5e
2 files changed
+43

No files matched your search

+4
View File
@@ -649,6 +649,10 @@ apply_all_in_dir() {
echo "WINE: -GAME FIXES- rtworkq: don't hold queues_section while shutting down the system queues (MFShutdown deadlock, Kingdom Hearts 358/2 Days port hangs after the first cutscene)"
apply_patch "../patches/wine-hotfixes/pending/rtworkq-dont-hold-queues-section-during-system-queue-shutdown.patch"
# https://github.com/GloriousEggroll/proton-ge-custom/issues/521
echo "WINE: -GAME FIXES- dsound: keep the high quality resampler for any number of buffers (BGM crackles after voice lines in Liarsoft codeX RScript games)"
apply_patch "../patches/wine-hotfixes/pending/dsound-keep-hq-resampler-for-any-buffer-count.patch"
# https://github.com/GloriousEggroll/proton-ge-custom/issues/881
echo "WINE: -HOTFIX- win32u: defer destroying NVIDIA Wayland host Vulkan instances while another is alive (NVIDIA driver clears its global libwayland table, EA app crash on winewayland)"
apply_patch "../patches/wine-hotfixes/pending/win32u-defer-nvidia-wayland-host-instance-destroy.patch"
@@ -0,0 +1,39 @@
From: GloriousEggroll <[email protected]>
Date: Mon, 2 Nov 2026 22:00:00 -0700
Subject: [PATCH] dsound: Keep the high quality resampler for any number of
buffers.
Staging's dsound-Fast_Mixer switches every resampled buffer to a linear
resampler once more than HQBuffersMax (default 4) buffers exist. That
path reads the live buffer memory, while the no-resample and FIR paths
read the committed region between the play and write cursors (Wine
commit 975d0632a19), so audio a game streams into that region can
glitch.
Liarsoft's codeX RScript games play 44.1 kHz buffers and reach 5 of
them during play, and their BGM crackles after voice lines on a 48 kHz
device. Forcing the device to 44.1 kHz avoids resampling and the
crackle, and Proton and upstream Wine, which only have the FIR path,
don't crackle.
Default HQBuffersMax to INT_MAX so the FIR path is always used, as
upstream. The registry value can still lower it.
https://github.com/GloriousEggroll/proton-ge-custom/issues/521
---
--- a/dlls/dsound/dsound_main.c
+++ b/dlls/dsound/dsound_main.c
@@ -81,7 +81,12 @@
/* All default settings, you most likely don't want to touch these, see wiki on UsefulRegistryKeys */
int ds_hel_buflen = 32768 * 2;
-int ds_hq_buffers_max = 4;
+/* Staging's linear resampler is used once more than this many buffers exist. It
+ * reads the live buffer instead of the committed region the other mixing paths
+ * use, so streamed audio can glitch when a game rewrites that region. Keep the
+ * high quality resampler for any number of buffers, like upstream Wine; the
+ * HQBuffersMax registry value can still lower it. */
+int ds_hq_buffers_max = 0x7fffffff;
BOOL ds_eax_enabled = TRUE;
#define IS_OPTION_TRUE(ch) \