From 2bbe80efa3e967d1c6256ea23977d54594d7b380 Mon Sep 17 00:00:00 2001 From: locphamtran Date: Wed, 19 Aug 2026 11:20:39 +0700 Subject: [PATCH] =?UTF-8?q?fix(bridge):=20set=20ringMask=3D7=20on=20Window?= =?UTF-8?q?s=20=E2=80=94=20ring=20collapsed=20to=201=20slot=20(slot=20=3D?= =?UTF-8?q?=20writeIndex=20&=200),=20dropped=20audio=20blocks=20on=20GUI?= =?UTF-8?q?=20jank?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- native_bridge/src/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/native_bridge/src/main.cpp b/native_bridge/src/main.cpp index 8ca87c6..85f0235 100644 --- a/native_bridge/src/main.cpp +++ b/native_bridge/src/main.cpp @@ -717,6 +717,10 @@ int main(int argc, char* argv[]) { } auto* shmIPC = (SharedAudioBufferIPC*)MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(SharedAudioBufferIPC)); if (!shmIPC) { CloseHandle(hMapFile); return 1; } + // VSTi crackle fix: 8-slot audio ring (see SharedMemoryIPC.h). Must be set + // on Windows too — ringMask stays 0 otherwise and the ring collapses to + // 1 slot (slot = writeIndex & 0), dropping whole blocks on any jank. + shmIPC->ringMask = 7; #else (void)shmName; // POSIX shm mapping (shm_open) added when porting off Windows auto* shmIPC = (SharedAudioBufferIPC*)std::calloc(1, sizeof(SharedAudioBufferIPC));