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_VBANK_INST_H__
21 #define __IPATCH_VBANK_INST_H__
22 
23 #include <stdarg.h>
24 #include <glib.h>
25 #include <glib-object.h>
26 #include <libinstpatch/IpatchContainer.h>
27 #include <libinstpatch/IpatchVBankRegion.h>
28 
29 /* forward type declarations */
30 
31 typedef struct _IpatchVBankInst IpatchVBankInst;
32 typedef struct _IpatchVBankInstClass IpatchVBankInstClass;
33 
34 #define IPATCH_TYPE_VBANK_INST   (ipatch_vbank_inst_get_type ())
35 #define IPATCH_VBANK_INST(obj) \
36   (G_TYPE_CHECK_INSTANCE_CAST ((obj), IPATCH_TYPE_VBANK_INST, \
37   IpatchVBankInst))
38 #define IPATCH_VBANK_INST_CLASS(klass) \
39   (G_TYPE_CHECK_CLASS_CAST ((klass), IPATCH_TYPE_VBANK_INST, \
40   IpatchVBankInstClass))
41 #define IPATCH_IS_VBANK_INST(obj) \
42   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IPATCH_TYPE_VBANK_INST))
43 #define IPATCH_IS_VBANK_INST_CLASS(klass) \
44   (G_TYPE_CHECK_CLASS_TYPE ((klass), IPATCH_TYPE_VBANK_INST))
45 #define IPATCH_VBANK_INST_GET_CLASS(obj) \
46   (G_TYPE_INSTANCE_GET_CLASS ((obj), IPATCH_TYPE_VBANK_INST, \
47   IpatchVBankInstClass))
48 
49 /* Virtual bank instrument item */
50 struct _IpatchVBankInst
51 {
52     IpatchContainer parent_instance;
53 
54     char *name;			/* name of instrument */
55     guint16 bank;			/* MIDI bank map number */
56     guint16 program;		/* MIDI program number */
57     GSList *regions;		/* list of instrument regions */
58 };
59 
60 struct _IpatchVBankInstClass
61 {
62     IpatchContainerClass parent_class;
63 };
64 
65 /**
66  * IPATCH_VBANK_INST_NAME_SIZE: (skip)
67  *
68  * Maximum length of a virtual bank instrument name.
69  */
70 #define IPATCH_VBANK_INST_NAME_SIZE	64
71 
72 GType ipatch_vbank_inst_get_type(void);
73 IpatchVBankInst *ipatch_vbank_inst_new(void);
74 
75 #define ipatch_vbank_inst_get_regions(inst) \
76     ipatch_container_get_children (IPATCH_CONTAINER (inst), \
77 				   IPATCH_TYPE_VBANK_REGION)
78 
79 IpatchVBankInst *ipatch_vbank_inst_first(IpatchIter *iter);
80 IpatchVBankInst *ipatch_vbank_inst_next(IpatchIter *iter);
81 
82 void ipatch_vbank_inst_new_region(IpatchVBankInst *inst, IpatchItem *item);
83 
84 void ipatch_vbank_inst_set_midi_locale(IpatchVBankInst *inst,
85                                        int bank, int program);
86 void ipatch_vbank_inst_get_midi_locale(IpatchVBankInst *inst,
87                                        int *bank, int *program);
88 
89 int ipatch_vbank_inst_compare(const IpatchVBankInst *p1,
90                               const IpatchVBankInst *p2);
91 
92 #endif
93