diff --git a/NEWS b/NEWS index 8ad91c3b1..a76b21218 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ ver 0.20.2 (not yet released) - libsamplerate: reset state after seeking * output - alsa: fix the DSD_U32 sample rate + - alsa: fix the DSD_U32 byte order ver 0.20.1 (2017/01/09) * input diff --git a/src/pcm/Dsd32.cxx b/src/pcm/Dsd32.cxx index 017774ff5..b8245f47c 100644 --- a/src/pcm/Dsd32.cxx +++ b/src/pcm/Dsd32.cxx @@ -29,8 +29,11 @@ static constexpr inline uint32_t Construct32(uint8_t a, uint8_t b, uint8_t c, uint8_t d) { - return uint32_t(a) | (uint32_t(b) << 8) | - (uint32_t(c) << 16) | (uint32_t(d) << 24); + /* "a" is the oldest byte, which must be in the most + significant byte */ + + return uint32_t(d) | (uint32_t(c) << 8) | + (uint32_t(b) << 16) | (uint32_t(a) << 24); } static constexpr inline uint32_t diff --git a/src/pcm/Dsd32.hxx b/src/pcm/Dsd32.hxx index 30b1c8ee2..5f68814f4 100644 --- a/src/pcm/Dsd32.hxx +++ b/src/pcm/Dsd32.hxx @@ -28,7 +28,7 @@ template struct ConstBuffer; class PcmBuffer; /** - * Convert DSD_U8 to DSD_U32 (native endian). + * Convert DSD_U8 to DSD_U32 (native endian, oldest bits in MSB). */ ConstBuffer Dsd8To32(PcmBuffer &buffer, unsigned channels, ConstBuffer src);