Commit cc0dbcf3 authored by Max Kellermann's avatar Max Kellermann

pcm/Dsd32: fix the byte order

The byte order of DSD_U32 was wrong from the start. The oldest bits must be in the MSB, not in the LSB, according to snd_pcm_format_descriptions in alsa-lib.
parent c5a2cadc
......@@ -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
......
......@@ -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
......
......@@ -28,7 +28,7 @@ template<typename T> 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<uint32_t>
Dsd8To32(PcmBuffer &buffer, unsigned channels, ConstBuffer<uint8_t> src);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment