summaryrefslogtreecommitdiff
path: root/src/codecs/sample.cpp
diff options
context:
space:
mode:
authorailurux <ailuruxx@gmail.com>2024-01-11 05:54:30 +0000
committercooljqln <cooljqln@noreply.codeberg.org>2024-01-11 05:54:30 +0000
commit0e04eb918ec976017276306181282769d8896c83 (patch)
tree562da509df2ab03d3906cf3c0f56063f6acc9865 /src/codecs/sample.cpp
parent55bde70b9651b411ac0135bd4704f5b6972ea799 (diff)
downloadtangara-fw-0e04eb918ec976017276306181282769d8896c83.tar.gz
wav-codec (#13)
here is a wav decoder, enjoy! Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/13 Reviewed-by: cooljqln <cooljqln@noreply.codeberg.org> Co-authored-by: ailurux <ailuruxx@gmail.com> Co-committed-by: ailurux <ailuruxx@gmail.com>
Diffstat (limited to 'src/codecs/sample.cpp')
-rw-r--r--src/codecs/sample.cpp7
1 files changed, 2 insertions, 5 deletions
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<int32_t>(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