From 8f958953f19c8c7a91f0a6a983ff15492c131535 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 27 Jan 2025 18:46:45 -0500
Subject: [PATCH] audio: Fix audio stream gain going wrong in certain
scenarios.
Fixes #12091.
---
src/audio/SDL_audioqueue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/audio/SDL_audioqueue.c b/src/audio/SDL_audioqueue.c
index 18ed346fad170..df7cac880bf74 100644
--- a/src/audio/SDL_audioqueue.c
+++ b/src/audio/SDL_audioqueue.c
@@ -548,7 +548,7 @@ const Uint8 *SDL_ReadFromAudioQueue(SDL_AudioQueue *queue,
size_t dst_present_bytes = present_frames * dst_frame_size;
size_t dst_future_bytes = future_frames * dst_frame_size;
- bool convert = (src_format != dst_format) || (src_channels != dst_channels);
+ const bool convert = (src_format != dst_format) || (src_channels != dst_channels) || (gain != 1.0f);
if (convert && !dst) {
// The user didn't ask for the data to be copied, but we need to convert it, so store it in the scratch buffer