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 typedef struct _LayerItem {
33 	int copy;	/* copy policy */
34 	int type;	/* conversion type */
35 	int minv;	/* minimum value */
36 	int maxv;	/* maximum value */
37 	int defv;	/* default value */
38 } LayerItem;
39 
40 /* copy policy */
41 enum {
42 	L_INHRT,	/* add to global */
43 	L_OVWRT,	/* overwrite on global */
44 	L_RANGE,	/* range */
45 	L_PRSET,	/* preset only */
46 	L_INSTR		/* instrument only */
47 };
48 
49 /* data type */
50 enum {
51 	T_NOP,		/* nothing */
52 	T_NOCONV,	/* no conversion */
53 	T_OFFSET,	/* address offset */
54 	T_HI_OFF,	/* address coarse offset (32k) */
55 	T_RANGE,	/* range; composite values (0-127/0-127) */
56 
57 	T_CUTOFF,	/* initial cutoff */
58 	T_FILTERQ,	/* initial resonance */
59 	T_TENPCT,	/* effects send */
60 	T_PANPOS,	/* panning position */
61 	T_ATTEN,	/* initial attenuation */
62 	T_SCALE,	/* scale tuning */
63 
64 	T_TIME,		/* envelope/LFO time */
65 	T_TM_KEY,	/* time change per key */
66 	T_FREQ,		/* LFO frequency */
67 	T_PSHIFT,	/* env/LFO pitch shift */
68 	T_CSHIFT,	/* env/LFO cutoff shift */
69 	T_TREMOLO,	/* LFO tremolo shift */
70 	T_MODSUST,	/* modulation env sustain level */
71 	T_VOLSUST,	/* volume env sustain level */
72 
73 	T_EOT		/* end of type */
74 };
75 
76 /* sbk->sf2 convertor function */
77 typedef int (*SBKConv)(int gen, int amount);
78 
79 /* macros for range operation */
80 #define RANGE(lo,hi)	(((hi)&0xff) << 8 | ((lo)&0xff))
81 #define LOWNUM(val)	((val) & 0xff)
82 #define HIGHNUM(val)	(((val) >> 8) & 0xff)
83 
84 /* layer type definitions */
85 extern LayerItem layer_items[SF_EOF];
86 
87 extern int sbk_to_sf2(int oper, int amount);
88 
89 #endif
90