ScummVM API documentation
audio_cache.h
1
/* ScummVM - Graphic Adventure Engine
2
*
3
* ScummVM is the legal property of its developers, whose names
4
* are too numerous to list here. Please refer to the COPYRIGHT
5
* file distributed with this source distribution.
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*
20
*/
21
22
#ifndef BLADERUNNER_AUDIO_CACHE_H
23
#define BLADERUNNER_AUDIO_CACHE_H
24
25
#include "common/array.h"
26
#include "common/mutex.h"
27
28
namespace
BladeRunner
{
29
30
/*
31
* This is a poor imitation of Bladerunner's resource cache
32
*/
33
class
AudioCache
{
34
struct
cacheItem {
35
int32 hash;
36
int
refs;
37
uint lastAccess;
38
byte *data;
39
uint32 size;
40
};
41
42
Common::Mutex
_mutex;
43
Common::Array<cacheItem>
_cacheItems;
44
45
uint32 _totalSize;
46
uint32 _maxSize;
47
uint32 _accessCounter;
48
49
public
:
50
AudioCache
();
51
~
AudioCache
();
52
53
bool
canAllocate(uint32 size)
const
;
54
bool
dropOldest();
55
byte *findByHash(int32 hash);
56
void
storeByHash(int32 hash,
Common::SeekableReadStream
*stream);
57
58
void
incRef(int32 hash);
59
void
decRef(int32 hash);
60
};
61
62
}
// End of namespace BladeRunner
63
64
#endif
Common::Array< cacheItem >
BladeRunner
Definition:
actor.h:31
Common::SeekableReadStream
Definition:
stream.h:745
Common::Mutex
Definition:
mutex.h:67
BladeRunner::AudioCache
Definition:
audio_cache.h:33
engines
bladerunner
audio_cache.h
Generated on Thu Nov 14 2024 09:11:12 for ScummVM API documentation by
1.8.13