aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorSven Hesse2011-05-05 21:40:09 +0200
committerSven Hesse2011-05-06 16:47:48 +0200
commitf0087e46087f4a278f8dc2aae8b31800d439f9df (patch)
tree1e6864156de743a5c0d92ab21ad8eddc882121fb /engines
parent88d562a3615ad93af8dc2b0f40e28dc239108968 (diff)
downloadscummvm-rg350-f0087e46087f4a278f8dc2aae8b31800d439f9df.tar.gz
scummvm-rg350-f0087e46087f4a278f8dc2aae8b31800d439f9df.tar.bz2
scummvm-rg350-f0087e46087f4a278f8dc2aae8b31800d439f9df.zip
SWORD2: Replace SafeSubReadStream with the same-name class in Common
Diffstat (limited to 'engines')
-rw-r--r--engines/sword2/music.cpp40
1 files changed, 3 insertions, 37 deletions
diff --git a/engines/sword2/music.cpp b/engines/sword2/music.cpp
index 233d9369d2..ae6e2f1268 100644
--- a/engines/sword2/music.cpp
+++ b/engines/sword2/music.cpp
@@ -53,40 +53,6 @@
namespace Sword2 {
-/**
- * This class behaves like SeekableSubReadStream, except it remembers where the
- * previous read() or seek() took it, so that it can continue from that point
- * the next time. This is because we're frequently streaming two pieces of
- * music from the same file.
- */
-class SafeSubReadStream : public Common::SeekableSubReadStream {
-protected:
- uint32 _previousPos;
-public:
- SafeSubReadStream(SeekableReadStream *parentStream, uint32 begin, uint32 end);
- virtual uint32 read(void *dataPtr, uint32 dataSize);
- virtual bool seek(int32 offset, int whence = SEEK_SET);
-};
-
-SafeSubReadStream::SafeSubReadStream(SeekableReadStream *parentStream, uint32 begin, uint32 end)
- : SeekableSubReadStream(parentStream, begin, end, DisposeAfterUse::NO) {
- _previousPos = 0;
-}
-
-uint32 SafeSubReadStream::read(void *dataPtr, uint32 dataSize) {
- uint32 result;
- SeekableSubReadStream::seek(_previousPos);
- result = SeekableSubReadStream::read(dataPtr, dataSize);
- _previousPos = pos();
- return result;
-}
-
-bool SafeSubReadStream::seek(int32 offset, int whence) {
- bool result = SeekableSubReadStream::seek(offset, whence);
- _previousPos = pos();
- return result;
-}
-
static Audio::AudioStream *makeCLUStream(Common::File *fp, int size);
static Audio::AudioStream *makePSXCLUStream(Common::File *fp, int size);
@@ -197,19 +163,19 @@ static Audio::AudioStream *getAudioStream(SoundFileHandle *fh, const char *base,
return makeCLUStream(&fh->file, enc_len);
#ifdef USE_MAD
case kMP3Mode: {
- SafeSubReadStream *tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len);
+ Common::SafeSubReadStream *tmp = new Common::SafeSubReadStream(&fh->file, pos, pos + enc_len);
return Audio::makeMP3Stream(tmp, DisposeAfterUse::YES);
}
#endif
#ifdef USE_VORBIS
case kVorbisMode: {
- SafeSubReadStream *tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len);
+ Common::SafeSubReadStream *tmp = new Common::SafeSubReadStream(&fh->file, pos, pos + enc_len);
return Audio::makeVorbisStream(tmp, DisposeAfterUse::YES);
}
#endif
#ifdef USE_FLAC
case kFLACMode: {
- SafeSubReadStream *tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len);
+ Common::SafeSubReadStream *tmp = new Common::SafeSubReadStream(&fh->file, pos, pos + enc_len);
return Audio::makeFLACStream(tmp, DisposeAfterUse::YES);
}
#endif