COMMON: Add DisposablePtr<T>, which replaces many repeated implementations of a dispose flag.
This commit is contained in:
parent
2f23ff72c1
commit
a5a8833c05
16 changed files with 81 additions and 107 deletions
|
@ -41,8 +41,7 @@ namespace Audio {
|
|||
// <http://wiki.multimedia.cx/index.php?title=Microsoft_IMA_ADPCM>.
|
||||
|
||||
ADPCMStream::ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
|
||||
: _stream(stream),
|
||||
_disposeAfterUse(disposeAfterUse),
|
||||
: _stream(stream, disposeAfterUse),
|
||||
_startpos(stream->pos()),
|
||||
_endpos(_startpos + size),
|
||||
_channels(channels),
|
||||
|
@ -52,11 +51,6 @@ ADPCMStream::ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Fl
|
|||
reset();
|
||||
}
|
||||
|
||||
ADPCMStream::~ADPCMStream() {
|
||||
if (_disposeAfterUse == DisposeAfterUse::YES)
|
||||
delete _stream;
|
||||
}
|
||||
|
||||
void ADPCMStream::reset() {
|
||||
memset(&_status, 0, sizeof(_status));
|
||||
_blockPos[0] = _blockPos[1] = _blockAlign; // To make sure first header is read
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue