1 /*
2     TiMidity++ -- MIDI to WAVE converter and player
3     Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
4     Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
5 
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20 
21 /*================================================================
22  * sfitem.h
23  *	soundfont generator conversion table
24  *================================================================*/
25 
26 #ifndef SFITEM_H_DEF
27 #define SFITEM_H_DEF
28 
29 #include "sflayer.h"
30 #include "sffile.h"
31 
32 namespace TimidityPlus
33 {
34 
35 
36 typedef struct _LayerItem {
37 	int copy;	/* copy policy */
38 	int type;	/* conversion type */
39 	int minv;	/* minimum value */
40 	int maxv;	/* maximum value */
41 	int defv;	/* default value */
42 } LayerItem;
43 
44 /* copy policy */
45 enum {
46 	L_INHRT,	/* add to global */
47 	L_OVWRT,	/* overwrite on global */
48 	L_RANGE,	/* range */
49 	L_PRSET,	/* preset only */
50 	L_INSTR		/* instrument only */
51 };
52 
53 /* data type */
54 enum {
55 	T_NOP,		/* nothing */
56 	T_NOCONV,	/* no conversion */
57 	T_OFFSET,	/* address offset */
58 	T_HI_OFF,	/* address coarse offset (32k) */
59 	T_RANGE,	/* range; composite values (0-127/0-127) */
60 
61 	T_CUTOFF,	/* initial cutoff */
62 	T_FILTERQ,	/* initial resonance */
63 	T_TENPCT,	/* effects send */
64 	T_PANPOS,	/* panning position */
65 	T_ATTEN,	/* initial attenuation */
66 	T_SCALE,	/* scale tuning */
67 
68 	T_TIME,		/* envelope/LFO time */
69 	T_TM_KEY,	/* time change per key */
70 	T_FREQ,		/* LFO frequency */
71 	T_PSHIFT,	/* env/LFO pitch shift */
72 	T_CSHIFT,	/* env/LFO cutoff shift */
73 	T_TREMOLO,	/* LFO tremolo shift */
74 	T_MODSUST,	/* modulation env sustain level */
75 	T_VOLSUST,	/* volume env sustain level */
76 
77 	T_EOT		/* end of type */
78 };
79 
80 /* sbk->sf2 convertor function */
81 typedef int (*SBKConv)(int gen, int amount);
82 
83 /* macros for range operation */
84 #define RANGE(lo,hi)	(((hi)&0xff) << 8 | ((lo)&0xff))
85 #define LOWNUM(val)	((val) & 0xff)
86 #define HIGHNUM(val)	(((val) >> 8) & 0xff)
87 
88 /* layer type definitions */
89 extern const LayerItem static_layer_items[SF_EOF];
90 
91 extern int sbk_to_sf2(int oper, int amount, const LayerItem *);
92 
93 }
94 #endif
95