Package: zynaddsubfx
Version: 2.2.1-1
Severity: important
Tags: patch

hi,

zynaddsubfx works fine in jack mode on big endian machines, but
outputs very strange noises when using the oss mode. the attached
patch adds adequate conversion. it applies to the latest 2.2.1
(and probably earlier).

cheers, piem


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: powerpc (ppc)
Kernel: Linux 2.6.12-rc3-powerpc
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages zynaddsubfx depends on:
ii  fftw3                    3.0.1-11        Library for computing Fast Fourier
ii  libasound2               1.0.8-3         ALSA library
ii  libc6                    2.3.2.ds1-21    GNU C Library: Shared libraries an
ii  libfltk1.1c102           1.1.6-2         Fast Light Toolkit shared librarie
ii  libgcc1                  1:3.4.3-12      GCC support library
ii  libjack0.80.0-0          0.99.0-6        JACK Audio Connection Kit (librari
ii  libmxml1                 2.2-1           development files for libmlxml
ii  libstdc++5               1:3.3.5-12      The GNU Standard C++ Library v3
ii  libx11-6                 4.3.0.dfsg.1-12 X Window System protocol client li
ii  libxext6                 4.3.0.dfsg.1-12 X Window System miscellaneous exte
ii  libxft2                  2.1.7-1         FreeType-based font drawing librar
ii  xlibs                    4.3.0.dfsg.1-12 X Keyboard Extension (XKB) configu
ii  zlib1g                   1:1.2.2-4       compression library - runtime

-- no debconf information
--- ZynAddSubFX-2.2.1/src/Output/OSSaudiooutput.C       2005-03-14 
19:57:49.000000000 +0000
+++ zynaddsubfx-2.2.1/src/Output/OSSaudiooutput.C       2005-04-28 
18:48:22.000000000 +0100
@@ -31,6 +31,18 @@
 #include "OSSaudiooutput.h"
 #include "../Misc/Util.h"
 
+/* borrowed from glib2 */
+#define SHORT_SWAP_LE_BE(val)  ((short) ( \
+    (short) ((short) (val) >> 8) |     \
+    (short) ((short) (val) << 8)))
+
+static void swap_endian(short *data, int length)
+{
+       int i;
+       for (i = 0; i < length; i += 1, data++)
+               *data = SHORT_SWAP_LE_BE(*data);
+}
+
 OSSaudiooutput::OSSaudiooutput(){
     int i;
     int snd_bitsize=16;
@@ -76,6 +88,9 @@
        smps[i*2]=(short int) (l*32767.0);    
        smps[i*2+1]=(short int) (r*32767.0);
     };
+#ifdef __BIG_ENDIAN
+    swap_endian(smps, SOUND_BUFFER_SIZE*4);
+#endif
     write(snd_handle,smps,SOUND_BUFFER_SIZE*4);// *2 because is 16 bit, again 
* 2 because is stereo
 };
 

Reply via email to