mirror of https://github.com/OpenTTD/OpenTTD
(svn r17698) -Fix (r17140) [FS#3205]: Convert endian after loading sounds from file.
parent
e7fb5f00e7
commit
1ee5520854
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue