From 0e04eb918ec976017276306181282769d8896c83 Mon Sep 17 00:00:00 2001 From: ailurux Date: Thu, 11 Jan 2024 05:54:30 +0000 Subject: wav-codec (#13) here is a wav decoder, enjoy! Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/13 Reviewed-by: cooljqln Co-authored-by: ailurux Co-committed-by: ailurux --- src/codecs/sample.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/codecs/sample.cpp') diff --git a/src/codecs/sample.cpp b/src/codecs/sample.cpp index d4860b94..c99710f1 100644 --- a/src/codecs/sample.cpp +++ b/src/codecs/sample.cpp @@ -21,11 +21,8 @@ auto shiftWithDither(int64_t src, uint_fast8_t bits) -> Sample { uint64_t mask = 0xFFFFFFFF; mask >>= 32 - bits; int64_t noise = static_cast(komirand(&sSeed1, &sSeed2) & mask); - // Centre the noise around 0. - noise -= (mask >> 1); - // Apply to the sample, then clip and shift to 16 bit. - Sample clipped = Clip((src + noise) >> bits); - return clipped; + // Apply to the sample, then shift to 16 bit. + return (src + noise) >> bits; } } // namespace sample -- cgit v1.2.3