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_GIG_DIMENSION_H__
21 #define __IPATCH_GIG_DIMENSION_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 
26 /* forward type declarations */
27 typedef struct _IpatchGigDimension IpatchGigDimension;
28 typedef struct _IpatchGigDimensionClass IpatchGigDimensionClass;
29 
30 /* GigaSampler dimension type */
31 typedef enum
32 {
33     IPATCH_GIG_DIMENSION_NONE            = 0x00, /* not in use (is this in files?) */
34 
35     /* MIDI controllers - see IpatchGigControlType (IpatchGigEffects.h) */
36 
37     IPATCH_GIG_DIMENSION_MOD_WHEEL       = 0x01,
38     IPATCH_GIG_DIMENSION_BREATH          = 0x02,
39     IPATCH_GIG_DIMENSION_FOOT            = 0x04,
40     IPATCH_GIG_DIMENSION_PORTAMENTO_TIME = 0x05,
41     IPATCH_GIG_DIMENSION_EFFECT_1        = 0x0C,
42     IPATCH_GIG_DIMENSION_EFFECT_2        = 0x0D,
43     IPATCH_GIG_DIMENSION_GEN_PURPOSE_1   = 0x10,
44     IPATCH_GIG_DIMENSION_GEN_PURPOSE_2   = 0x11,
45     IPATCH_GIG_DIMENSION_GEN_PURPOSE_3   = 0x12,
46     IPATCH_GIG_DIMENSION_GEN_PURPOSE_4   = 0x13,
47     IPATCH_GIG_DIMENSION_SUSTAIN_PEDAL   = 0x40,
48     IPATCH_GIG_DIMENSION_PORTAMENTO      = 0x41,
49     IPATCH_GIG_DIMENSION_SOSTENUTO       = 0x42,
50     IPATCH_GIG_DIMENSION_SOFT_PEDAL      = 0x43,
51     IPATCH_GIG_DIMENSION_GEN_PURPOSE_5   = 0x50,
52     IPATCH_GIG_DIMENSION_GEN_PURPOSE_6   = 0x51,
53     IPATCH_GIG_DIMENSION_GEN_PURPOSE_7   = 0x52,
54     IPATCH_GIG_DIMENSION_GEN_PURPOSE_8   = 0x53,
55     IPATCH_GIG_DIMENSION_EFFECT_DEPTH_1  = 0x5B,
56     IPATCH_GIG_DIMENSION_EFFECT_DEPTH_2  = 0x5C,
57     IPATCH_GIG_DIMENSION_EFFECT_DEPTH_3  = 0x5D,
58     IPATCH_GIG_DIMENSION_EFFECT_DEPTH_4  = 0x5E,
59     IPATCH_GIG_DIMENSION_EFFECT_DEPTH_5  = 0x5F,
60 
61     IPATCH_GIG_DIMENSION_CHANNEL         = 0x80, /* sample has more than 1 channel */
62     IPATCH_GIG_DIMENSION_LAYER           = 0x81, /* layer up to 8 zones (cross fade 2 or 4) */
63     IPATCH_GIG_DIMENSION_VELOCITY        = 0x82, /* key velocity (only type that allows specific ranges) */
64     IPATCH_GIG_DIMENSION_AFTER_TOUCH     = 0x83, /* channel MIDI after touch */
65     IPATCH_GIG_DIMENSION_RELEASE_TRIG    = 0x84, /* trigger on key release */
66     IPATCH_GIG_DIMENSION_KEYBOARD        = 0x85, /* key switching (FIXME WTF?) */
67     IPATCH_GIG_DIMENSION_ROUND_ROBIN     = 0x86, /* selects zones in sequence */
68     IPATCH_GIG_DIMENSION_RANDOM          = 0x87  /* selects random zone */
69 } IpatchGigDimensionType;
70 
71 /* maximum value for dimension type */
72 #define IPATCH_GIG_DIMENSION_TYPE_MAX   IPATCH_GIG_DIMENSION_RANDOM
73 
74 #include <libinstpatch/IpatchItem.h>
75 #include <libinstpatch/IpatchGigRegion.h>
76 
77 #define IPATCH_TYPE_GIG_DIMENSION   (ipatch_gig_dimension_get_type ())
78 #define IPATCH_GIG_DIMENSION(obj) \
79   (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_GIG_DIMENSION, \
80   IpatchGigDimension))
81 #define IPATCH_GIG_DIMENSION_CLASS(klass) \
82   (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_GIG_DIMENSION, \
83   IpatchGigDimensionClass))
84 #define IPATCH_IS_GIG_DIMENSION(obj) \
85   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_GIG_DIMENSION))
86 #define IPATCH_IS_GIG_DIMENSION_CLASS(klass) \
87   (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_GIG_DIMENSION))
88 #define IPATCH_GIG_DIMENSION_GET_CLASS(obj) \
89   (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_GIG_DIMENSION, \
90   IpatchGigDimensionClass))
91 
92 /* GigaSampler dimension (up to 5 per IpatchGigRegion) */
93 struct _IpatchGigDimension
94 {
95     IpatchItem parent_instance;
96 
97     char *name;			/* name of dimension or NULL */
98     guint8 type;			/* dimension type (IpatchGigDimensionType) */
99     guint8 split_count;		/* count of split bits for this dimension */
100 
101     /* convenience variables (derivable from other info) */
102     guint8 split_mask;		/* sub region index mask */
103     guint8 split_shift;		/* bit shift to first set bit in mask */
104 };
105 
106 /* GigaSampler dimension class */
107 struct _IpatchGigDimensionClass
108 {
109     IpatchItemClass parent_class;
110 };
111 
112 GType ipatch_gig_dimension_get_type(void);
113 IpatchGigDimension *ipatch_gig_dimension_new(void);
114 
115 IpatchGigDimension *ipatch_gig_dimension_first(IpatchIter *iter);
116 IpatchGigDimension *ipatch_gig_dimension_next(IpatchIter *iter);
117 
118 #endif
119