From e9b840794e9ee3cc9fe399ec55fdac6199da70b5 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Wed, 14 Dec 2022 20:03:20 +0300
Subject: [PATCH] music_wavpack: setup the buffer as U8 instead of S8 for 8-bit
sources.
---
src/codecs/music_wavpack.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/codecs/music_wavpack.c b/src/codecs/music_wavpack.c
index eae61a85..0789a706 100644
--- a/src/codecs/music_wavpack.c
+++ b/src/codecs/music_wavpack.c
@@ -401,7 +401,7 @@ static void *WAVPACK_CreateFromRW_internal(SDL_RWops *src1, SDL_RWops *src2, int
* but always in an int32_t[] buffer, in host-endian format. */
switch (music->bps) {
case 8:
- format = AUDIO_S8;
+ format = AUDIO_U8;
break;
case 16:
format = AUDIO_S16SYS;
@@ -519,9 +519,9 @@ static int WAVPACK_GetSome(void *context, void *data, int bytes, SDL_bool *done)
amount *= music->channels;
switch (music->bps) {
case 8: {
- Sint8 *dst = (Sint8 *)music->buffer;
+ Uint8 *dst = (Uint8 *)music->buffer;
for (; c < amount; ++c) {
- *dst++ = *src++;
+ *dst++ = 0x80 ^ (Uint8)*src++;
} }
break;
case 16: {