summaryrefslogtreecommitdiff
path: root/csid.cpp
diff options
context:
space:
mode:
authorGravatar waker <waker@titty.(none)>2009-08-23 14:27:23 +0200
committerGravatar waker <waker@titty.(none)>2009-08-23 14:27:23 +0200
commit281da8fb493ab740026ae69d35164d67731903a9 (patch)
tree0f4221932ce5b61e77e9fe0b63f829a0502a0e92 /csid.cpp
parent444dcb0e712bbc694f5c6dce13ba48145f51a45f (diff)
ppc64(ps3) compatibility fixes + some cleanup
Diffstat (limited to 'csid.cpp')
-rw-r--r--csid.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/csid.cpp b/csid.cpp
index 2bf29bb6..969bce70 100644
--- a/csid.cpp
+++ b/csid.cpp
@@ -19,6 +19,9 @@
#include <stdio.h>
#include <string.h>
#include <iconv.h>
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
#include "sidplay/sidplay2.h"
#include "sidplay/builders/resid.h"
// #include "md5/MD5.h" // include those 2 files if you want to use md5 impl from libsidplay2
@@ -36,7 +39,7 @@ extern "C" {
static inline void
le_int16 (int16_t in, unsigned char *out) {
char *pin = (char *)&in;
-#if !BIGENDIAN
+#if !WORDS_BIGENDIAN
out[0] = pin[0];
out[1] = pin[1];
#else
@@ -286,6 +289,19 @@ csid_read (char *bytes, int size) {
}
int rd = sidplay->play (bytes, size/csid.info.channels);
csid.info.readposition += size/csid.info.channels/2 / (float)csid.info.samplesPerSecond;
+
+#if WORDS_BIGENDIAN
+ // convert samples from le to be
+ int n = rd * csid.info.channels/2;
+ int16_t *ptr = (int16_t *)bytes;
+ while (n > 0) {
+ int16_t out;
+ le_int16 (*ptr, (unsigned char *)&out);
+ *ptr = out;
+ ptr++;
+ n--;
+ }
+#endif
return rd * csid.info.channels;
}