1 /*
2  * libInstPatch
3  * Copyright (C) 1999-2014 Element Green <element@elementsofsound.org>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public License
7  * as published by the Free Software Foundation; version 2.1
8  * of the License only.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  * 02110-1301, USA or on the web at http://www.gnu.org.
19  */
20 #ifndef __IPATCH_SAMPLE_STORE_RAM_H__
21 #define __IPATCH_SAMPLE_STORE_RAM_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 #include <libinstpatch/IpatchSampleStore.h>
26 
27 /* forward type declarations */
28 
29 typedef struct _IpatchSampleStoreRam IpatchSampleStoreRam;
30 typedef struct _IpatchSampleStoreRamClass IpatchSampleStoreRamClass;
31 
32 #define IPATCH_TYPE_SAMPLE_STORE_RAM (ipatch_sample_store_ram_get_type ())
33 #define IPATCH_SAMPLE_STORE_RAM(obj) \
34   (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SAMPLE_STORE_RAM, \
35   IpatchSampleStoreRam))
36 #define IPATCH_SAMPLE_STORE_RAM_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SAMPLE_STORE_RAM, \
38   IpatchSampleStoreRamClass))
39 #define IPATCH_IS_SAMPLE_STORE_RAM(obj) \
40   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SAMPLE_STORE_RAM))
41 #define IPATCH_IS_SAMPLE_STORE_RAM_CLASS(klass) \
42   (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SAMPLE_STORE_RAM))
43 
44 /* RAM sample store instance */
45 struct _IpatchSampleStoreRam
46 {
47     IpatchSampleStore parent_instance;
48     gpointer location;    /* Pointer to the sample data in memory */
49 };
50 
51 /* RAM sample store class */
52 struct _IpatchSampleStoreRamClass
53 {
54     IpatchSampleStoreClass parent_class;
55 };
56 
57 /**
58  * IpatchSampleStoreRamFlags:
59  * @IPATCH_SAMPLE_STORE_RAM_ALLOCATED: Indicates if sample data was allocated
60  *   and therefore should be freed when finalized.
61  *
62  * Flags crammed into #IpatchItem flags field.
63  */
64 typedef enum
65 {
66     IPATCH_SAMPLE_STORE_RAM_ALLOCATED = 1 << IPATCH_SAMPLE_STORE_UNUSED_FLAG_SHIFT
67 } IpatchSampleStoreRamFlags;
68 
69 /**
70  * IPATCH_SAMPLE_STORE_RAM_UNUSED_FLAG_SHIFT: (skip)
71  */
72 /* we reserve 1 bits for defined flags above and 3 bits for future expansion */
73 #define IPATCH_SAMPLE_STORE_RAM_UNUSED_FLAG_SHIFT \
74   (IPATCH_SAMPLE_STORE_UNUSED_FLAG_SHIFT + 4)
75 
76 GType ipatch_sample_store_ram_get_type(void);
77 IpatchSample *ipatch_sample_store_ram_new(gpointer location, gboolean free_data);
78 IpatchSample *ipatch_sample_store_ram_get_blank(void);
79 
80 #endif
81