From 4057beacd02eab820ccf3b7c0633f1c8a0918e24 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 6 Nov 2024 20:05:57 +0100 Subject: FormatConverter: Renormalise for DEXTER --- src/FormatConverter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/FormatConverter.cpp') diff --git a/src/FormatConverter.cpp b/src/FormatConverter.cpp index 1821442..0821191 100644 --- a/src/FormatConverter.cpp +++ b/src/FormatConverter.cpp @@ -65,16 +65,17 @@ int FormatConverter::process(Buffer* const dataIn, Buffer* dataOut) int16_t* out = reinterpret_cast(dataOut->getData()); for (size_t i = 0; i < sizeIn; i++) { - if (in[i] < INT16_MIN) { + const int32_t val = in[i] >> 7; + if (val < INT16_MIN) { out[i] = INT16_MIN; num_clipped_samples++; } - else if (in[i] > INT16_MAX) { + else if (val > INT16_MAX) { out[i] = INT16_MAX; num_clipped_samples++; } else { - out[i] = in[i]; + out[i] = val; } } } -- cgit v1.2.3