if(PHYSFS_read(file, buffer, readsize, 1) != 1)
throw std::runtime_error("read error while reading samples");
+#ifdef WORDS_BIGENDIAN
+ if (bits_per_sample != 16)
+ return readsize;
+ char *tmp = (char*)buffer;
+
+ size_t i;
+ char c;
+ for (i = 0; i < readsize / 2; i++)
+ {
+ c = tmp[2*i];
+ tmp[2*i] = tmp[2*i+1];
+ tmp[2*i+1] = c;
+ }
+
+ buffer = tmp;
+#endif
+
return readsize;
}
while(buffer_size>0){
long bytesRead
- = ov_read(&vorbis_file, buffer, static_cast<int> (buffer_size), 0, 2, 1,
- §ion);
+ = ov_read(&vorbis_file, buffer, static_cast<int> (buffer_size),
+#ifdef WORDS_BIGENDIAN
+1,
+#else
+0,
+#endif
+ 2, 1, §ion);
if(bytesRead==0){
break;
}