# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/xmms-jack/S16_LE.patch # Copyright (C) 2004 - 2026 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- Of course 16 bit little endian data needs to be swapped on big endian CPUs ... (The same is of course true for big endian data on little endian CPUs - but for now this should be enough.) - Rene Rebe --- xmms-jack/jack.c 2004-11-30 04:23:27.000000000 +0100 +++ xmms-jack-fixed/jack.c 2005-03-08 16:59:17.000000000 +0100 @@ -13,7 +13,7 @@ #include "jack.h" #include "xconvert.h" /* xmms rate conversion header file */ - +#include /* set to 1 for verbose output */ #define VERBOSE_OUTPUT 0 @@ -437,6 +437,18 @@ /* loop until we have written all the data out to the jack device */ /* this is due to xmms' audio driver api */ char *buf = (char*)ptr; + +#ifdef __BIG_ENDIAN__ + if (new_format == FMT_S16_LE) { + uint16_t* src = (uint16_t*) ptr; + uint16_t* end = (uint16_t*) (ptr + length); + while (src != end) { + *src = bswap_16(*src); + src++; + } + } +#endif + while(length > 0) { TRACE("writing %d bytes\n", length);