Skip to content

Commit

Permalink
audio: fixed compatibility downsampler.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Nov 19, 2022
1 parent 209ebae commit fe0713a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/SDL12_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
Expand All @@ -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; \
}
Expand Down

0 comments on commit fe0713a

Please sign in to comment.