diff options
| author | ailurux <ailuruxx@gmail.com> | 2024-01-11 05:54:30 +0000 |
|---|---|---|
| committer | cooljqln <cooljqln@noreply.codeberg.org> | 2024-01-11 05:54:30 +0000 |
| commit | 0e04eb918ec976017276306181282769d8896c83 (patch) | |
| tree | 562da509df2ab03d3906cf3c0f56063f6acc9865 /src/codecs/include/sample.hpp | |
| parent | 55bde70b9651b411ac0135bd4704f5b6972ea799 (diff) | |
| download | tangara-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/include/sample.hpp')
| -rw-r--r-- | src/codecs/include/sample.hpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/codecs/include/sample.hpp b/src/codecs/include/sample.hpp index 7e550680..7b3f96a3 100644 --- a/src/codecs/include/sample.hpp +++ b/src/codecs/include/sample.hpp @@ -24,10 +24,6 @@ namespace sample { // 3. Monty from Xiph.org reckons it's all you need. typedef int16_t Sample; -constexpr auto Clip(int64_t v) -> Sample { - return std::clamp<int64_t>(v, INT16_MIN, INT16_MAX); -} - auto shiftWithDither(int64_t src, uint_fast8_t bits) -> Sample; constexpr auto FromSigned(int32_t src, uint_fast8_t bits) -> Sample { @@ -42,7 +38,7 @@ constexpr auto FromSigned(int32_t src, uint_fast8_t bits) -> Sample { constexpr auto FromUnsigned(uint32_t src, uint_fast8_t bits) -> Sample { // Left-align, then substract the max value / 2 to make the sample centred // around zero. - return (src << (sizeof(uint16_t) * 8 - bits)) - (~0UL >> 1); + return (src << (sizeof(uint16_t) * 8 - bits)) - (INT16_MAX+1); } constexpr auto FromFloat(float src) -> Sample { |
