summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-10-04 18:52:34 +0000
committerfrosch <frosch@openttd.org>2009-10-04 18:52:34 +0000
commit1ee5520854db0f7097554da048c28b389326a0c6 (patch)
treeddfe75b139daca66089d198d70164169e977fd2b /src
parente7fb5f00e7b97c235aaad45844ad816f0df5e31e (diff)
downloadopenttd-1ee5520854db0f7097554da048c28b389326a0c6.tar.xz
(svn r17698) -Fix (r17140) [FS#3205]: Convert endian after loading sounds from file.
Diffstat (limited to 'src')
-rw-r--r--src/sound.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/sound.cpp b/src/sound.cpp
index 5be043eee..3b81af08b 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -130,6 +130,16 @@ static bool SetBankSource(MixerChannel *mc, const SoundEntry *sound)
}
}
+#if TTD_ENDIAN == TTD_BIG_ENDIAN
+ if (sound->bits_per_sample == 16) {
+ uint num_samples = sound->file_size / 2;
+ int16 *samples = (int16 *)mem;
+ for (uint i = 0; i < num_samples; i++) {
+ samples[i] = BSWAP16(samples[i]);
+ }
+ }
+#endif
+
assert(sound->bits_per_sample == 8 || sound->bits_per_sample == 16);
assert(sound->channels == 1);
assert(sound->file_size != 0 && sound->rate != 0);