The channels field's type is defined as uint8_t in the sample.h pulselib header.
In the PA_SAMPLE_SPEC Structure defined in _pulsectl.py, it is defined as c_uint32 instead. This works on little endian architectures (most platforms currently) when the compiler has zeroed all the bytes in the structure, but it fails on big endian ones: it is the highest significant byte on a big endian uint32_t that is located at the lowest memory location.
Using Python, one can check that byte 0x01 is the first byte in memory for little endian and the fourth byte for big endian.
>>> import struct
>>> print(struct.pack('<I', 0x04030201)) # integer little endian
b'\x01\x02\x03\x04'
>>> print(struct.pack('>I', 0x04030201)) # integer big endian
b'\x04\x03\x02\x01'
The other Structures that use the 'channels' field define correctly the type as c_uint8.
BTW many thanks for this great project !
The
channelsfield's type is defined as uint8_t in the sample.h pulselib header.In the PA_SAMPLE_SPEC Structure defined in _pulsectl.py, it is defined as c_uint32 instead. This works on little endian architectures (most platforms currently) when the compiler has zeroed all the bytes in the structure, but it fails on big endian ones: it is the highest significant byte on a big endian uint32_t that is located at the lowest memory location.
Using Python, one can check that byte 0x01 is the first byte in memory for little endian and the fourth byte for big endian.
The other Structures that use the 'channels' field define correctly the type as c_uint8.
BTW many thanks for this great project !