diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-08-07 14:26:04 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-08-07 15:20:12 +1000 |
| commit | a66c3428063017f2233b6b15d5ce6c920d5c9095 (patch) | |
| tree | 98ce11a6ac2fce108a1592b47e0d3690acc0f1a3 /src/codecs/include | |
| parent | 4118d880c3f20dbd9304a3f50d6d111f194592c8 (diff) | |
| download | tangara-fw-a66c3428063017f2233b6b15d5ce6c920d5c9095.tar.gz | |
Resampling *basically* working? Just cleanup and buffering issues
Diffstat (limited to 'src/codecs/include')
| -rw-r--r-- | src/codecs/include/sample.hpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/codecs/include/sample.hpp b/src/codecs/include/sample.hpp index 7209673b..f8e08cdc 100644 --- a/src/codecs/include/sample.hpp +++ b/src/codecs/include/sample.hpp @@ -52,8 +52,14 @@ constexpr auto FromMad(mad_fixed_t src) -> Sample { return FromSigned(src >> (MAD_F_FRACBITS + 1 - 24), 24); } -constexpr auto ToSigned16Bit(Sample src) -> uint16_t { +constexpr auto ToSigned16Bit(Sample src) -> int16_t { return src >> 16; } +static constexpr float kFactor = 1.0f / static_cast<float>(INT32_MAX); + +constexpr auto ToFloat(Sample src) -> float { + return src * kFactor; +} + } // namespace sample |
