diff options
author | rubidium <rubidium@openttd.org> | 2009-08-10 17:46:44 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-08-10 17:46:44 +0000 |
commit | 238b0e43bbaa997acb7e53f1de118a963bb330fa (patch) | |
tree | da4694db44320da55a69268177a8abe47f1069c7 /src/sound.cpp | |
parent | 6800db65a7a16ae02e521dc34ac1ad3d646dee0b (diff) | |
download | openttd-238b0e43bbaa997acb7e53f1de118a963bb330fa.tar.xz |
(svn r17146) -Codechange: improve the sample rate conversion a bit
Diffstat (limited to 'src/sound.cpp')
-rw-r--r-- | src/sound.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sound.cpp b/src/sound.cpp index e314c7ade..130841154 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -109,7 +109,11 @@ static bool SetBankSource(MixerChannel *mc, const SoundEntry *sound) if (sound->file_size == 0) return false; - int8 *mem = MallocT<int8>(sound->file_size); + int8 *mem = MallocT<int8>(sound->file_size + 2); + /* Add two extra bytes so rate conversion can read these + * without reading out of it's input buffer. */ + mem[sound->file_size ] = 0; + mem[sound->file_size + 1] = 0; FioSeekToFile(sound->file_slot, sound->file_offset); FioReadBlock(mem, sound->file_size); |