aboutsummaryrefslogtreecommitdiff
path: root/audio/audiostream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'audio/audiostream.cpp')
-rw-r--r--audio/audiostream.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/audio/audiostream.cpp b/audio/audiostream.cpp
index 547aa77526..1c63ce97bf 100644
--- a/audio/audiostream.cpp
+++ b/audio/audiostream.cpp
@@ -93,7 +93,7 @@ SeekableAudioStream *SeekableAudioStream::openStreamFile(const Common::String &b
#pragma mark -
LoopingAudioStream::LoopingAudioStream(RewindableAudioStream *stream, uint loops, DisposeAfterUse::Flag disposeAfterUse)
- : _parent(stream), _disposeAfterUse(disposeAfterUse), _loops(loops), _completeIterations(0) {
+ : _parent(stream, disposeAfterUse), _loops(loops), _completeIterations(0) {
assert(stream);
if (!stream->rewind()) {
@@ -102,11 +102,6 @@ LoopingAudioStream::LoopingAudioStream(RewindableAudioStream *stream, uint loops
}
}
-LoopingAudioStream::~LoopingAudioStream() {
- if (_disposeAfterUse == DisposeAfterUse::YES)
- delete _parent;
-}
-
int LoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
if ((_loops && _completeIterations == _loops) || !numSamples)
return 0;
@@ -169,7 +164,7 @@ SubLoopingAudioStream::SubLoopingAudioStream(SeekableAudioStream *stream,
const Timestamp loopStart,
const Timestamp loopEnd,
DisposeAfterUse::Flag disposeAfterUse)
- : _parent(stream), _disposeAfterUse(disposeAfterUse), _loops(loops),
+ : _parent(stream, disposeAfterUse), _loops(loops),
_pos(0, getRate() * (isStereo() ? 2 : 1)),
_loopStart(convertTimeToStreamPos(loopStart, getRate(), isStereo())),
_loopEnd(convertTimeToStreamPos(loopEnd, getRate(), isStereo())),
@@ -180,11 +175,6 @@ SubLoopingAudioStream::SubLoopingAudioStream(SeekableAudioStream *stream,
_done = true;
}
-SubLoopingAudioStream::~SubLoopingAudioStream() {
- if (_disposeAfterUse == DisposeAfterUse::YES)
- delete _parent;
-}
-
int SubLoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
if (_done)
return 0;
@@ -225,7 +215,7 @@ int SubLoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
#pragma mark -
SubSeekableAudioStream::SubSeekableAudioStream(SeekableAudioStream *parent, const Timestamp start, const Timestamp end, DisposeAfterUse::Flag disposeAfterUse)
- : _parent(parent), _disposeAfterUse(disposeAfterUse),
+ : _parent(parent, disposeAfterUse),
_start(convertTimeToStreamPos(start, getRate(), isStereo())),
_pos(0, getRate() * (isStereo() ? 2 : 1)),
_length(convertTimeToStreamPos(end, getRate(), isStereo()) - _start) {
@@ -234,11 +224,6 @@ SubSeekableAudioStream::SubSeekableAudioStream(SeekableAudioStream *parent, cons
_parent->seek(_start);
}
-SubSeekableAudioStream::~SubSeekableAudioStream() {
- if (_disposeAfterUse)
- delete _parent;
-}
-
int SubSeekableAudioStream::readBuffer(int16 *buffer, const int numSamples) {
int framesLeft = MIN(_length.frameDiff(_pos), numSamples);
int framesRead = _parent->readBuffer(buffer, framesLeft);