aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/audio_player.h
diff options
context:
space:
mode:
authorPeter Kohaut2019-02-10 23:34:54 +0100
committerPeter Kohaut2019-02-11 22:48:07 +0100
commitb14fbaa72b3218862a533dd7f7c0e97e1bed4df7 (patch)
treea35c91bfe2eac6b3f084ef5b8f80ed2d3b002aff /engines/bladerunner/audio_player.h
parent22e5913f18f597aab343ca4555714a340d86d3c8 (diff)
downloadscummvm-rg350-b14fbaa72b3218862a533dd7f7c0e97e1bed4df7.tar.gz
scummvm-rg350-b14fbaa72b3218862a533dd7f7c0e97e1bed4df7.tar.bz2
scummvm-rg350-b14fbaa72b3218862a533dd7f7c0e97e1bed4df7.zip
BLADERUNNER: Cleanup of audio code
Separated audio cache. Fixed bug in the audio cache where still used sound might get freed. Fixes crashes when engine is unloading which were caused by a race condition between the timer code and engine teardown code.
Diffstat (limited to 'engines/bladerunner/audio_player.h')
-rw-r--r--engines/bladerunner/audio_player.h39
1 files changed, 0 insertions, 39 deletions
diff --git a/engines/bladerunner/audio_player.h b/engines/bladerunner/audio_player.h
index 34059e33f3..580bdbcb79 100644
--- a/engines/bladerunner/audio_player.h
+++ b/engines/bladerunner/audio_player.h
@@ -35,43 +35,6 @@ namespace BladeRunner {
class BladeRunnerEngine;
class AudioCache;
-/*
- * 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) const;
- bool dropOldest();
- byte *findByHash(int32 hash);
- void storeByHash(int32 hash, Common::SeekableReadStream *stream);
-
- void incRef(int32 hash);
- void decRef(int32 hash);
-};
-
-
enum AudioPlayerFlags {
kAudioPlayerLoop = 1,
kAudioPlayerOverrideVolume = 2
@@ -84,7 +47,6 @@ class AudioPlayer {
bool isActive;
int channel;
int priority;
- int32 hash;
int volume;
int pan;
Audio::AudioStream *stream;
@@ -93,7 +55,6 @@ class AudioPlayer {
BladeRunnerEngine *_vm;
Common::Mutex _mutex;
- AudioCache *_cache;
Track _tracks[kTracks];
int _sfxVolume;