From 7e52772413ecb0ccbb96a36691211de4c43a1914 Mon Sep 17 00:00:00 2001 From: mcfnord Date: Sat, 25 Jul 2026 02:03:32 +0000 Subject: [PATCH] Clamp Input Boost instead of letting it wrap around The Input Boost setting (2x..10x) multiplied each sample and narrowed the int result back to int16_t with a plain cast, so any sample boosted past full scale wrapped to the opposite polarity rather than clipping. Use Float2Short, the same saturating helper already used twice in this function, so boosted peaks clip instead of inverting. Co-Authored-By: Claude Opus 5 --- src/client.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index fb9bab5478..03d57ed817 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1429,8 +1429,8 @@ void CClient::ProcessAudioDataIntern ( CVector& vecsStereoSndCrd ) // apply a general gain boost to all audio input: for ( i = 0, j = 0; i < iMonoBlockSizeSam; i++, j += 2 ) { - vecsStereoSndCrd[j + 1] = static_cast ( iInputBoost * vecsStereoSndCrd[j + 1] ); - vecsStereoSndCrd[j] = static_cast ( iInputBoost * vecsStereoSndCrd[j] ); + vecsStereoSndCrd[j + 1] = Float2Short ( static_cast ( iInputBoost ) * vecsStereoSndCrd[j + 1] ); + vecsStereoSndCrd[j] = Float2Short ( static_cast ( iInputBoost ) * vecsStereoSndCrd[j] ); } }