From bdd88ec1fc406944e1d05d2fecfdd61c4d82f29e Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 1 Aug 2016 17:51:24 +0200 Subject: [PATCH] Fix an endianness issue. --- mixer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mixer.cpp b/mixer.cpp index 96668c8..05b7c51 100644 --- a/mixer.cpp +++ b/mixer.cpp @@ -3,6 +3,7 @@ #include "mixer.h" #include +#include #include #include #include @@ -73,8 +74,7 @@ void convert_fixed32_to_fp32(float *dst, size_t out_channels, const uint8_t *src assert(in_channels >= out_channels); for (size_t i = 0; i < num_samples; ++i) { for (size_t j = 0; j < out_channels; ++j) { - // Note: Assumes little-endian. - int32_t s = *(int32_t *)src; + int32_t s = le32toh(*(int32_t *)src); dst[i * out_channels + j] = s * (1.0f / 2147483648.0f); src += 4; } -- 2.39.2