aboutsummaryrefslogtreecommitdiff
path: root/engines/sword2
diff options
context:
space:
mode:
authorMax Horn2009-10-18 19:41:59 +0000
committerMax Horn2009-10-18 19:41:59 +0000
commit2bbf708deaf2d60c70786ec1ef2f9ea0d1f0bd4a (patch)
tree3aac193c0b0419c50f72690bdfa77016ea413464 /engines/sword2
parent64861f1e40ee5084bcbfa3e5bd3adbe746d7dfc5 (diff)
downloadscummvm-rg350-2bbf708deaf2d60c70786ec1ef2f9ea0d1f0bd4a.tar.gz
scummvm-rg350-2bbf708deaf2d60c70786ec1ef2f9ea0d1f0bd4a.tar.bz2
scummvm-rg350-2bbf708deaf2d60c70786ec1ef2f9ea0d1f0bd4a.zip
Introduced new type Common::DisposeAfterUse::Flag
svn-id: r45233
Diffstat (limited to 'engines/sword2')
-rw-r--r--engines/sword2/music.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/engines/sword2/music.cpp b/engines/sword2/music.cpp
index fee75f7638..be3d6f4174 100644
--- a/engines/sword2/music.cpp
+++ b/engines/sword2/music.cpp
@@ -50,22 +50,23 @@
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.
-
+/**
+ * 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, bool disposeParentStream);
+ 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, bool disposeParentStream)
- : SeekableSubReadStream(parentStream, begin, end, disposeParentStream) {
+SafeSubReadStream::SafeSubReadStream(SeekableReadStream *parentStream, uint32 begin, uint32 end)
+ : SeekableSubReadStream(parentStream, begin, end, Common::DisposeAfterUse::NO) {
_previousPos = 0;
}
@@ -197,17 +198,17 @@ static Audio::AudioStream *getAudioStream(SoundFileHandle *fh, const char *base,
return makeCLUStream(&fh->file, enc_len);
#ifdef USE_MAD
case kMP3Mode:
- tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len, false);
+ tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len);
return Audio::makeMP3Stream(tmp, true);
#endif
#ifdef USE_VORBIS
case kVorbisMode:
- tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len, false);
+ tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len);
return Audio::makeVorbisStream(tmp, true);
#endif
#ifdef USE_FLAC
case kFlacMode:
- tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len, false);
+ tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len);
return Audio::makeFlacStream(tmp, true);
#endif
default:
@@ -301,7 +302,7 @@ Audio::AudioStream *makePSXCLUStream(Common::File *file, int size) {
byte *buffer = (byte *)malloc(size);
file->read(buffer, size);
- return new Audio::VagStream(new Common::MemoryReadStream(buffer, size, true));
+ return new Audio::VagStream(new Common::MemoryReadStream(buffer, size, Common::DisposeAfterUse::YES));
}
// ----------------------------------------------------------------------------