aboutsummaryrefslogtreecommitdiff
path: root/scumm/imuse_digi
diff options
context:
space:
mode:
authorMax Horn2004-02-14 12:01:07 +0000
committerMax Horn2004-02-14 12:01:07 +0000
commit7447ea8fb3fd4d39567899a033a06b9e8e759a3a (patch)
tree9e175f93f10193db65a543cd5369e58ae83584c5 /scumm/imuse_digi
parent99551bd74622bbf5c8a9dc15749140b24613e322 (diff)
downloadscummvm-rg350-7447ea8fb3fd4d39567899a033a06b9e8e759a3a.tar.gz
scummvm-rg350-7447ea8fb3fd4d39567899a033a06b9e8e759a3a.tar.bz2
scummvm-rg350-7447ea8fb3fd4d39567899a033a06b9e8e759a3a.zip
Explaining odd hacks with a comment is usually a good idea :-)
svn-id: r12875
Diffstat (limited to 'scumm/imuse_digi')
-rw-r--r--scumm/imuse_digi/dimuse.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp
index ee1e23669a..b07e60870a 100644
--- a/scumm/imuse_digi/dimuse.cpp
+++ b/scumm/imuse_digi/dimuse.cpp
@@ -296,8 +296,13 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
assert(channels == 1 || channels == 2);
assert(0 < freq && freq <= 65535);
- freq /= 25;
- freq *= 25;
+ // Round the frequency to a multiple of 25. This is done to
+ // ensure we don't run into data under-/overflows (this is a
+ // design limitation of the current IMuseDigital code, which
+ // pushes data 'blindly' into the mixer, instead of providing
+ // a pull based interface, i.e. a custom AudioInputStream
+ // subclass).
+ freq -= (fraq % 25);
_track[l].iteration = _track[l].pullSize = freq * channels;