diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/vag.cpp | 10 | ||||
-rw-r--r-- | sound/vag.h | 7 |
2 files changed, 7 insertions, 10 deletions
diff --git a/sound/vag.cpp b/sound/vag.cpp index 483ac36bb8..c4ff55efa2 100644 --- a/sound/vag.cpp +++ b/sound/vag.cpp @@ -27,11 +27,10 @@ namespace Audio { -VagStream::VagStream(Common::SeekableReadStream *stream, bool loop, int rate) : _stream(stream) { +VagStream::VagStream(Common::SeekableReadStream *stream, int rate) : _stream(stream) { _samplesRemaining = 0; _predictor = 0; _s1 = _s2 = 0.0; - _loop = loop; _rate = rate; } @@ -109,17 +108,16 @@ int VagStream::readBuffer(int16 *buffer, const int numSamples) { _samplesRemaining = 28 - i; } - if (_loop && _stream->eos()) - rewind(); - return samplesDecoded; } -void VagStream::rewind() { +bool VagStream::rewind() { _stream->seek(0); _samplesRemaining = 0; _predictor = 0; _s1 = _s2 = 0.0; + + return true; } } diff --git a/sound/vag.h b/sound/vag.h index 3bbda156e7..bd3b174729 100644 --- a/sound/vag.h +++ b/sound/vag.h @@ -38,21 +38,20 @@ namespace Audio { -class VagStream : public Audio::AudioStream { +class VagStream : public Audio::RewindableAudioStream { public: - VagStream(Common::SeekableReadStream *stream, bool loop = false, int rate = 11025); + VagStream(Common::SeekableReadStream *stream, int rate = 11025); ~VagStream(); bool isStereo() const { return false; } bool endOfData() const { return _stream->pos() == _stream->size(); } int getRate() const { return _rate; } int readBuffer(int16 *buffer, const int numSamples); - void rewind(); + bool rewind(); private: Common::SeekableReadStream *_stream; - bool _loop; byte _predictor; double _samples[28]; byte _samplesRemaining; |