From fe0713a5a7c3266a4b0fe870dcbcbb748fff324b Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Fri, 18 Nov 2022 19:23:00 -0500
Subject: [PATCH] audio: fixed compatibility downsampler.
---
src/SDL12_compat.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index d195ca224..298534d4c 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -9446,7 +9446,7 @@ CompatibilityCVT_Resampler(SDL12_AudioCVT *cvt12, Uint16 format)
SDL_assert((bitsize == 8) || (bitsize == 16)); /* there were no 32-bit audio types in 1.2. */
- if (cvt12->rate_incr > 0.0) { /* upsampling */
+ if (cvt12->rate_incr < 1.0) { /* upsampling */
/*printf("2x Upsampling!\n");*/
#define DO_RESAMPLE(typ) \
const typ *src = (const typ *) (cvt12->buf + cvt12->len_cvt); \
@@ -9466,8 +9466,8 @@ CompatibilityCVT_Resampler(SDL12_AudioCVT *cvt12, Uint16 format)
} else { /* downsampling. */
/*printf("2x Downsampling!\n");*/
#define DO_RESAMPLE(typ) \
- const typ *src = (const typ *) (cvt12->buf + cvt12->len_cvt); \
- typ *dst = (typ *) (cvt12->buf + (cvt12->len_cvt * 2)); \
+ const typ *src = (const typ *) cvt12->buf; \
+ typ *dst = (typ *) cvt12->buf; \
for (i = cvt12->len_cvt / (sizeof (typ) * 2); i; i--, src += 2) { \
*(dst++) = *src; \
}