1/* FluidSynth - A Software Synthesizer
2 *
3 * Copyright (C) 2003  Peter Hanappe and others.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public License
7 * as published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the Free
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 * 02111-1307, USA
19 */
20
21#ifndef _FLUIDSYNTH_GEN_H
22#define _FLUIDSYNTH_GEN_H
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/**
29 * @file gen.h
30 * @brief Functions and defines for SoundFont generator effects.
31 */
32
33/**
34 * Generator (effect) numbers (Soundfont 2.01 specifications section 8.1.3)
35 */
36enum fluid_gen_type {
37  GEN_STARTADDROFS,		/**< Sample start address offset (0-32767) */
38  GEN_ENDADDROFS,		/**< Sample end address offset (-32767-0) */
39  GEN_STARTLOOPADDROFS,		/**< Sample loop start address offset (-32767-32767) */
40  GEN_ENDLOOPADDROFS,		/**< Sample loop end address offset (-32767-32767) */
41  GEN_STARTADDRCOARSEOFS,	/**< Sample start address coarse offset (X 32768) */
42  GEN_MODLFOTOPITCH,		/**< Modulation LFO to pitch */
43  GEN_VIBLFOTOPITCH,		/**< Vibrato LFO to pitch */
44  GEN_MODENVTOPITCH,		/**< Modulation envelope to pitch */
45  GEN_FILTERFC,			/**< Filter cutoff */
46  GEN_FILTERQ,			/**< Filter Q */
47  GEN_MODLFOTOFILTERFC,		/**< Modulation LFO to filter cutoff */
48  GEN_MODENVTOFILTERFC,		/**< Modulation envelope to filter cutoff */
49  GEN_ENDADDRCOARSEOFS,		/**< Sample end address coarse offset (X 32768) */
50  GEN_MODLFOTOVOL,		/**< Modulation LFO to volume */
51  GEN_UNUSED1,			/**< Unused */
52  GEN_CHORUSSEND,		/**< Chorus send amount */
53  GEN_REVERBSEND,		/**< Reverb send amount */
54  GEN_PAN,			/**< Stereo panning */
55  GEN_UNUSED2,			/**< Unused */
56  GEN_UNUSED3,			/**< Unused */
57  GEN_UNUSED4,			/**< Unused */
58  GEN_MODLFODELAY,		/**< Modulation LFO delay */
59  GEN_MODLFOFREQ,		/**< Modulation LFO frequency */
60  GEN_VIBLFODELAY,		/**< Vibrato LFO delay */
61  GEN_VIBLFOFREQ,		/**< Vibrato LFO frequency */
62  GEN_MODENVDELAY,		/**< Modulation envelope delay */
63  GEN_MODENVATTACK,		/**< Modulation envelope attack */
64  GEN_MODENVHOLD,		/**< Modulation envelope hold */
65  GEN_MODENVDECAY,		/**< Modulation envelope decay */
66  GEN_MODENVSUSTAIN,		/**< Modulation envelope sustain */
67  GEN_MODENVRELEASE,		/**< Modulation envelope release */
68  GEN_KEYTOMODENVHOLD,		/**< Key to modulation envelope hold */
69  GEN_KEYTOMODENVDECAY,		/**< Key to modulation envelope decay */
70  GEN_VOLENVDELAY,		/**< Volume envelope delay */
71  GEN_VOLENVATTACK,		/**< Volume envelope attack */
72  GEN_VOLENVHOLD,		/**< Volume envelope hold */
73  GEN_VOLENVDECAY,		/**< Volume envelope decay */
74  GEN_VOLENVSUSTAIN,		/**< Volume envelope sustain */
75  GEN_VOLENVRELEASE,		/**< Volume envelope release */
76  GEN_KEYTOVOLENVHOLD,		/**< Key to volume envelope hold */
77  GEN_KEYTOVOLENVDECAY,		/**< Key to volume envelope decay */
78  GEN_INSTRUMENT,		/**< Instrument ID (shouldn't be set by user) */
79  GEN_RESERVED1,		/**< Reserved */
80  GEN_KEYRANGE,			/**< MIDI note range */
81  GEN_VELRANGE,			/**< MIDI velocity range */
82  GEN_STARTLOOPADDRCOARSEOFS,	/**< Sample start loop address coarse offset (X 32768) */
83  GEN_KEYNUM,			/**< Fixed MIDI note number */
84  GEN_VELOCITY,			/**< Fixed MIDI velocity value */
85  GEN_ATTENUATION,		/**< Initial volume attenuation */
86  GEN_RESERVED2,		/**< Reserved */
87  GEN_ENDLOOPADDRCOARSEOFS,	/**< Sample end loop address coarse offset (X 32768) */
88  GEN_COARSETUNE,		/**< Coarse tuning */
89  GEN_FINETUNE,			/**< Fine tuning */
90  GEN_SAMPLEID,			/**< Sample ID (shouldn't be set by user) */
91  GEN_SAMPLEMODE,		/**< Sample mode flags */
92  GEN_RESERVED3,		/**< Reserved */
93  GEN_SCALETUNE,		/**< Scale tuning */
94  GEN_EXCLUSIVECLASS,		/**< Exclusive class number */
95  GEN_OVERRIDEROOTKEY,		/**< Sample root note override */
96
97  /* the initial pitch is not a "standard" generator. It is not
98   * mentioned in the list of generator in the SF2 specifications. It
99   * is used, however, as the destination for the default pitch wheel
100   * modulator. */
101  GEN_PITCH,			/**< Pitch (NOTE: Not a real SoundFont generator) */
102  GEN_LAST			/**< Value defines the count of generators (#fluid_gen_type) */
103};
104
105
106/**
107 * SoundFont generator structure.
108 */
109typedef struct _fluid_gen_t
110{
111  unsigned char flags; /**< Is the generator set or not (#fluid_gen_flags) */
112  double val;          /**< The nominal value */
113  double mod;          /**< Change by modulators */
114  double nrpn;         /**< Change by NRPN messages */
115} fluid_gen_t;
116
117/**
118 * Enum value for 'flags' field of #_fluid_gen_t (not really flags).
119 */
120enum fluid_gen_flags
121{
122  GEN_UNUSED,		/**< Generator value is not set */
123  GEN_SET,		/**< Generator value is set */
124  GEN_ABS_NRPN		/**< DOCME */
125};
126
127FLUIDSYNTH_API int fluid_gen_set_default_values(fluid_gen_t* gen);
128
129
130
131#ifdef __cplusplus
132}
133#endif
134#endif /* _FLUIDSYNTH_GEN_H */
135
136