diff options
author | Sven Hesse | 2013-04-28 17:31:53 +0200 |
---|---|---|
committer | Sven Hesse | 2013-04-28 17:31:53 +0200 |
commit | 2c5a0008badb2c89d1c3f62f7c8b105b22ed8a19 (patch) | |
tree | cfd39e49248a6e7266f2e9d0aaa1fd2139850f34 | |
parent | 1108d202f97d7ddd29ee826647af5b0063c51afd (diff) | |
download | scummvm-rg350-2c5a0008badb2c89d1c3f62f7c8b105b22ed8a19.tar.gz scummvm-rg350-2c5a0008badb2c89d1c3f62f7c8b105b22ed8a19.tar.bz2 scummvm-rg350-2c5a0008badb2c89d1c3f62f7c8b105b22ed8a19.zip |
AUDIO: Do not error out when channel offset >= length after interrupt()
This fixes a Protracker module in the OS/2 version of
Hopkins FBI (bug #3612101). In row 0x30 of the first
pattern, the set channel offset effect in the fourth track
pushes the offset past the sample (repeat) length.
This is not error; the mixing function already handles this
case flawlessly. No assert() is necessary there.
-rw-r--r-- | audio/mods/paula.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/audio/mods/paula.cpp b/audio/mods/paula.cpp index 4b49d6e750..d655428ed0 100644 --- a/audio/mods/paula.cpp +++ b/audio/mods/paula.cpp @@ -132,7 +132,14 @@ int Paula::readBufferIntern(int16 *buffer, const int numSamples) { Channel &ch = _voice[voice]; int16 *p = buffer; int neededSamples = nSamples; - assert(ch.offset.int_off < ch.length); + + // NOTE: A Protracker (or other module format) player might actually + // push the offset past the sample length in its interrupt(), in which + // case the first mixBuffer() call should not mix anything, and the loop + // should be triggered. + // Thus, doing an assert(ch.offset.int_off < ch.length) here is wrong. + // An example where this happens is a certain Protracker module played + // by the OS/2 version of Hopkins FBI. // Mix the generated samples into the output buffer neededSamples -= mixBuffer<stereo>(p, ch.data, ch.offset, rate, neededSamples, ch.length, ch.volume, ch.panning); |