Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
gsldatacache.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __GSL_DATA_CACHE_H__
3 #define __GSL_DATA_CACHE_H__
4 
5 #include <bse/gslcommon.hh>
6 
7 /* --- macros --- */
8 #define GSL_DATA_CACHE_NODE_SIZE(dcache) (((GslDataCache*) (dcache))->node_size)
9 
10 
11 /* --- typedefs & structures --- */
12 typedef gfloat GslDataType;
13 typedef struct _GslDataCacheNode GslDataCacheNode;
15 {
16  GslDataHandle *dhandle;
17  guint open_count;
18  Bse::Mutex mutex;
19  guint ref_count;
20  guint node_size; /* power of 2, const for all dcaches */
21  guint padding; /* n_values around blocks */
22  guint max_age;
23  gboolean high_persistency; /* valid for opened caches only */
24  guint n_nodes;
25  GslDataCacheNode **nodes;
26 };
28 {
29  int64 offset;
30  guint ref_count;
31  guint age;
32  GslDataType *data; /* NULL while busy */
33 };
34 typedef enum
35 {
36  GSL_DATA_CACHE_REQUEST = FALSE, /* node->data may be NULL and will be filled */
37  GSL_DATA_CACHE_DEMAND_LOAD = TRUE, /* blocks until node->data != NULL */
38  GSL_DATA_CACHE_PEEK = 2 /* may return NULL node, data != NULL otherwise */
39 } GslDataCacheRequest;
40 
41 
42 /* --- prototypes --- */
43 GslDataCache* gsl_data_cache_new (GslDataHandle *dhandle,
44  guint padding);
45 GslDataCache* gsl_data_cache_ref (GslDataCache *dcache);
46 void gsl_data_cache_unref (GslDataCache *dcache);
47 void gsl_data_cache_open (GslDataCache *dcache);
48 void gsl_data_cache_close (GslDataCache *dcache);
49 GslDataCacheNode* gsl_data_cache_ref_node (GslDataCache *dcache,
50  int64 offset,
51  GslDataCacheRequest load_request);
52 void gsl_data_cache_unref_node (GslDataCache *dcache,
53  GslDataCacheNode *node);
54 void gsl_data_cache_free_olders (GslDataCache *dcache,
55  guint max_age);
56 GslDataCache* gsl_data_cache_from_dhandle (GslDataHandle *dhandle,
57  guint min_padding);
58 
59 #endif /* __GSL_DATA_CACHE_H__ */
Definition: gsldatacache.hh:14
Definition: gsldatacache.hh:27
int64_t int64