diff options
author | frosch <frosch@openttd.org> | 2009-10-04 18:52:34 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2009-10-04 18:52:34 +0000 |
commit | 1ee5520854db0f7097554da048c28b389326a0c6 (patch) | |
tree | ddfe75b139daca66089d198d70164169e977fd2b /src | |
parent | e7fb5f00e7b97c235aaad45844ad816f0df5e31e (diff) | |
download | openttd-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.cpp | 10 |
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); |