From 1880aa544126be80b95351a9ba3199f7b6721f9d Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Wed, 31 Jan 2007 14:53:46 +0000 Subject: Minor sound playing correction svn-id: r25309 --- engines/gob/sound.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/gob') 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; } -- cgit v1.2.3