diff options
Diffstat (limited to 'engines/bladerunner/aud_stream.cpp')
-rw-r--r-- | engines/bladerunner/aud_stream.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/engines/bladerunner/aud_stream.cpp b/engines/bladerunner/aud_stream.cpp index e859b3347e..c74421bbd0 100644 --- a/engines/bladerunner/aud_stream.cpp +++ b/engines/bladerunner/aud_stream.cpp @@ -41,11 +41,15 @@ AudStream::AudStream(AudioCache *cache, int32 hash) void AudStream::init(byte *data) { _data = data; - _end = _data + READ_LE_UINT32(_data + 2) + 12; - assert(_end - _data >= 12); - + _frequency = READ_LE_UINT16(_data); + _size = READ_LE_UINT32(_data + 2); + _sizeDecompressed = READ_LE_UINT32(_data + 6); + _flags = *(_data + 10); _compressionType = *(_data + 11); + _end = _data + _size + 12; + assert(_end - _data >= 12); + _deafBlockRemain = 0; _p = _data + 12; } @@ -113,4 +117,16 @@ bool AudStream::rewind() { return true; } +int AudStream::getLength() +{ + int bytesPerSecond = _frequency; + if (_flags & 1) { // 16 bit + bytesPerSecond *= 2; + } + if (_flags & 2) { // stereo + bytesPerSecond *= 2; + } + return (1000 * _sizeDecompressed) / bytesPerSecond; +} + } // End of namespace BladeRunner |