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_REGION_H__ 21 #define __IPATCH_GIG_REGION_H__ 22 23 #include <stdarg.h> 24 #include <glib.h> 25 #include <glib-object.h> 26 27 /* forward type declarations */ 28 typedef struct _IpatchGigRegion IpatchGigRegion; 29 typedef struct _IpatchGigRegionClass IpatchGigRegionClass; 30 31 #include <libinstpatch/IpatchContainer.h> 32 #include <libinstpatch/IpatchGigEffects.h> 33 #include <libinstpatch/IpatchGigSample.h> 34 #include <libinstpatch/IpatchGigDimension.h> 35 #include <libinstpatch/IpatchGigSubRegion.h> 36 37 #define IPATCH_TYPE_GIG_REGION (ipatch_gig_region_get_type ()) 38 #define IPATCH_GIG_REGION(obj) \ 39 (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_GIG_REGION, \ 40 IpatchGigRegion)) 41 #define IPATCH_GIG_REGION_CLASS(klass) \ 42 (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_GIG_REGION, \ 43 IpatchGigRegionClass)) 44 #define IPATCH_IS_GIG_REGION(obj) \ 45 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_GIG_REGION)) 46 #define IPATCH_IS_GIG_REGION_CLASS(klass) \ 47 (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_GIG_REGION)) 48 #define IPATCH_GIG_REGION_GET_CLASS(obj) \ 49 (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_GIG_REGION, \ 50 IpatchGigRegionClass)) 51 52 /* GigaSampler region object */ 53 struct _IpatchGigRegion 54 { 55 IpatchContainer parent_instance; 56 57 /*< private >*/ 58 59 guint8 note_range_low; /* MIDI note range low value */ 60 guint8 note_range_high; /* MIDI note range high value */ 61 guint8 velocity_range_low; /* MIDI velocity range low value */ 62 guint8 velocity_range_high; /* MIDI velocity range high value */ 63 64 guint16 key_group; /* Exclusive key group number or 0 */ 65 guint16 layer_group; /* layer group (descriptive only) */ 66 67 guint16 phase_group; /* Phase locked group number or 0 */ 68 guint16 channel; /* channel ID (IpatchDLS2RegionChannelType) */ 69 70 IpatchDLS2Info *info; /* info string values */ 71 72 guint8 dimension_count; /* dimension count (0-5) */ 73 guint8 sub_region_count; /* 2 ^ sum (dimensions[].split_count) (1-32) */ 74 IpatchGigDimension *dimensions[5]; /* [dimension_count] */ 75 IpatchGigSubRegion *sub_regions[32]; /* [sub_region_count] */ 76 guint8 chunk_3ddp[10]; /* FIXME - what is it? (16 bits / dimension?) */ 77 }; 78 79 /* GigaSampler region class */ 80 struct _IpatchGigRegionClass 81 { 82 IpatchContainerClass parent_class; 83 }; 84 85 /* Flags crammed into IpatchItem flags (ditched 2 - 16 bit flag fields) */ 86 /* FIXME - Are these used in GigaSampler files? */ 87 typedef enum 88 { 89 IPATCH_GIG_REGION_SELF_NON_EXCLUSIVE = 1 << IPATCH_CONTAINER_UNUSED_FLAG_SHIFT, 90 IPATCH_GIG_REGION_PHASE_MASTER = 1 << (IPATCH_CONTAINER_UNUSED_FLAG_SHIFT + 1), 91 IPATCH_GIG_REGION_MULTI_CHANNEL = 1 << (IPATCH_CONTAINER_UNUSED_FLAG_SHIFT + 2) 92 } IpatchGigRegionFlags; 93 94 /** 95 * IPATCH_GIG_REGION_FLAG_MASK: (skip) 96 */ 97 #define IPATCH_GIG_REGION_FLAG_MASK (0x0F << IPATCH_CONTAINER_UNUSED_FLAG_SHIFT) 98 99 /** 100 * IPATCH_GIG_REGION_UNUSED_FLAG_SHIFT: (skip) 101 */ 102 /* 3 flags + 1 for expansion */ 103 #define IPATCH_GIG_REGION_UNUSED_FLAG_SHIFT \ 104 (IPATCH_CONTAINER_UNUSED_FLAG_SHIFT + 4) 105 106 107 GType ipatch_gig_region_get_type(void); 108 IpatchGigRegion *ipatch_gig_region_new(void); 109 110 IpatchGigRegion *ipatch_gig_region_first(IpatchIter *iter); 111 IpatchGigRegion *ipatch_gig_region_next(IpatchIter *iter); 112 113 void ipatch_gig_region_set_note_range(IpatchGigRegion *region, 114 int low, int high); 115 void ipatch_gig_region_set_velocity_range(IpatchGigRegion *region, 116 int low, int high); 117 118 void ipatch_gig_region_new_dimension(IpatchGigRegion *region, 119 IpatchGigDimensionType type, 120 int split_count); 121 void ipatch_gig_region_remove_dimension(IpatchGigRegion *region, 122 int dim_index, int split_index); 123 #endif 124