aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorSven Hesse2013-04-28 17:31:53 +0200
committerSven Hesse2013-04-28 17:31:53 +0200
commit2c5a0008badb2c89d1c3f62f7c8b105b22ed8a19 (patch)
treecfd39e49248a6e7266f2e9d0aaa1fd2139850f34 /audio
parent1108d202f97d7ddd29ee826647af5b0063c51afd (diff)
downloadscummvm-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.
Diffstat (limited to 'audio')
-rw-r--r--audio/mods/paula.cpp9
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);