1 /*
2  * libInstPatch
3  * Copyright (C) 1999-2014 Element Green <element@elementsofsound.org>
4  *
5  * Author of this file: (C) 2012 BALATON Zoltan <balaton@eik.bme.hu>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; version 2.1
10  * of the License only.
11  *
12  * This library 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 Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  * 02110-1301, USA or on the web at http://www.gnu.org.
21  */
22 #ifndef __IPATCH_SLI_SAMPLE_H__
23 #define __IPATCH_SLI_SAMPLE_H__
24 
25 #include <stdarg.h>
26 #include <glib.h>
27 #include <glib-object.h>
28 #include <libinstpatch/IpatchItem.h>
29 #include <libinstpatch/IpatchSampleData.h>
30 
31 /* forward type declarations */
32 
33 typedef struct _IpatchSLISample IpatchSLISample;
34 typedef struct _IpatchSLISampleClass IpatchSLISampleClass;
35 
36 #define IPATCH_TYPE_SLI_SAMPLE   (ipatch_sli_sample_get_type ())
37 #define IPATCH_SLI_SAMPLE(obj) \
38   (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_SLI_SAMPLE, \
39   IpatchSLISample))
40 #define IPATCH_SLI_SAMPLE_CLASS(klass) \
41   (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_SLI_SAMPLE, \
42   IpatchSLISampleClass))
43 #define IPATCH_IS_SLI_SAMPLE(obj) \
44   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_SLI_SAMPLE))
45 #define IPATCH_IS_SLI_SAMPLE_CLASS(klass) \
46   (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_SLI_SAMPLE))
47 #define IPATCH_SLI_SAMPLE_GET_CLASS(obj) \
48   (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_SLI_SAMPLE, \
49   IpatchSLISampleClass))
50 
51 /* Spectralis sample item */
52 struct _IpatchSLISample
53 {
54     IpatchItem parent_instance;
55 
56     IpatchSampleData *sample_data; /* sample data object */
57     char *name;			/* name of sample */
58     guint32 rate;                 /* sample rate */
59     guint32 loop_start;		/* loop start offset (in samples) */
60     guint32 loop_end;		/* loop end offset (in samples) */
61     guint8 root_note;		/* root midi note number */
62     gint8 fine_tune;		/* fine tuning in cents */
63 };
64 
65 struct _IpatchSLISampleClass
66 {
67     IpatchItemClass parent_class;
68 };
69 
70 GType ipatch_sli_sample_get_type(void);
71 IpatchSLISample *ipatch_sli_sample_new(void);
72 
73 IpatchSLISample *ipatch_sli_sample_first(IpatchIter *iter);
74 IpatchSLISample *ipatch_sli_sample_next(IpatchIter *iter);
75 
76 void ipatch_sli_sample_set_name(IpatchSLISample *sample,
77                                 const char *name);
78 char *ipatch_sli_sample_get_name(IpatchSLISample *sample);
79 
80 void ipatch_sli_sample_set_data(IpatchSLISample *sample,
81                                 IpatchSampleData *sampledata);
82 IpatchSampleData *ipatch_sli_sample_get_data(IpatchSLISample *sample);
83 IpatchSampleData *ipatch_sli_sample_peek_data(IpatchSLISample *sample);
84 
85 void ipatch_sli_sample_set_blank(IpatchSLISample *sample);
86 
87 #endif
88