aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
authorSven Hesse2007-01-31 14:53:46 +0000
committerSven Hesse2007-01-31 14:53:46 +0000
commit1880aa544126be80b95351a9ba3199f7b6721f9d (patch)
tree846ae417d9fd6a8cac1a7a8aabc84627ea7eda3b /engines/gob
parente3aeb0255b5ec8bf7e3b99b56fb77facb6cd6ce1 (diff)
downloadscummvm-rg350-1880aa544126be80b95351a9ba3199f7b6721f9d.tar.gz
scummvm-rg350-1880aa544126be80b95351a9ba3199f7b6721f9d.tar.bz2
scummvm-rg350-1880aa544126be80b95351a9ba3199f7b6721f9d.zip
Minor sound playing correction
svn-id: r25309
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/sound.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/engines/gob/sound.cpp b/engines/gob/sound.cpp
index 4be47fba80..787a948deb 100644
--- a/engines/gob/sound.cpp
+++ b/engines/gob/sound.cpp
@@ -199,8 +199,8 @@ void Snd::setSample(Snd::SoundDesc *sndDesc, int16 repCount, int16 frequency, in
_ratio = ((double) _freq) / _rate;
_offset = 0.0;
_frac = 0;
- _cur = 0;
- _last = 0;
+ _last = _cur;
+ _cur = _data[0];
_repCount = repCount;
_end = false;
_playingSound = 1;
@@ -236,6 +236,7 @@ void Snd::checkEndSample(void) {
nextCompositionPos();
else if ((_repCount == -1) || (--_repCount > 0)) {
_offset = 0.0;
+ _frac = 0.0;
_end = false;
_playingSound = 1;
} else {
@@ -259,6 +260,7 @@ int Snd::readBuffer(int16 *buffer, const int numSamples) {
*buffer++ = (int16) ((_last + (_cur - _last) * _frac) * _fadeVol);
_frac += _ratio;
+ _offset += _ratio;
while (_frac > 1) {
_frac -= 1;
_last = _cur;
@@ -279,8 +281,6 @@ int Snd::readBuffer(int16 *buffer, const int numSamples) {
}
}
}
-
- _offset += _ratio;
}
return numSamples;
}