diff options
author | Thomas Fach-Pedersen | 2015-02-10 17:51:16 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-09-29 22:33:38 +0200 |
commit | 35ea84935ff3259aaa09946f0447a75e9b617086 (patch) | |
tree | 99498b9e6842bd38fb67aef9e27195cc1485d6ad /engines/bladerunner/audio_player.h | |
parent | 2d8f421597d3bd31f76695f322c2c324774c567a (diff) | |
download | scummvm-rg350-35ea84935ff3259aaa09946f0447a75e9b617086.tar.gz scummvm-rg350-35ea84935ff3259aaa09946f0447a75e9b617086.tar.bz2 scummvm-rg350-35ea84935ff3259aaa09946f0447a75e9b617086.zip |
BLADERUNNER: Split aud_decoder into aud_stream and adpcm_decoder
Diffstat (limited to 'engines/bladerunner/audio_player.h')
-rw-r--r-- | engines/bladerunner/audio_player.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/engines/bladerunner/audio_player.h b/engines/bladerunner/audio_player.h index 32c7dbb2d8..eb4c75dbb3 100644 --- a/engines/bladerunner/audio_player.h +++ b/engines/bladerunner/audio_player.h @@ -24,6 +24,8 @@ #define BLADERUNNER_AUDIO_H #include "audio/mixer.h" +#include "common/array.h" +#include "common/mutex.h" #include "common/str.h" #include "common/types.h" @@ -34,6 +36,41 @@ class AudioCache; #define TRACKS 6 +/* + * This is a poor imitation of Bladerunner's resource cache + */ +class AudioCache { + struct cacheItem { + int32 hash; + int refs; + uint lastAccess; + byte *data; + uint32 size; + }; + + Common::Mutex _mutex; + Common::Array<cacheItem> _cacheItems; + + uint32 _totalSize; + uint32 _maxSize; + uint32 _accessCounter; +public: + AudioCache() : + _totalSize(0), + _maxSize(2457600), + _accessCounter(0) + {} + ~AudioCache(); + + bool canAllocate(uint32 size); + bool dropOldest(); + byte *findByHash(int32 hash); + void storeByHash(int32 hash, Common::SeekableReadStream *stream); + + void incRef(int32 hash); + void decRef(int32 hash); +}; + class AudioPlayer { BladeRunnerEngine *_vm; AudioCache *_cache; |