Update Fluidsynth to 2.0.1
[ardour.git] / libs / fluidsynth / fluidsynth / mod.h
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 Lesser General Public License
7  * as published by the Free Software Foundation; either version 2.1 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  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  * 02110-1301, USA
19  */
20
21 #ifndef _FLUIDSYNTH_MOD_H
22 #define _FLUIDSYNTH_MOD_H
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 /**
29  * @file mod.h
30  * @brief SoundFont modulator functions and constants.
31  */
32
33
34 /**
35  * Flags defining the polarity, mapping function and type of a modulator source.
36  * Compare with SoundFont 2.04 PDF section 8.2.
37  *
38  * Note: Bit values do not correspond to the SoundFont spec!  Also note that
39  * #FLUID_MOD_GC and #FLUID_MOD_CC are in the flags field instead of the source field.
40  */
41 enum fluid_mod_flags
42 {
43     FLUID_MOD_POSITIVE = 0,       /**< Mapping function is positive */
44     FLUID_MOD_NEGATIVE = 1,       /**< Mapping function is negative */
45     FLUID_MOD_UNIPOLAR = 0,       /**< Mapping function is unipolar */
46     FLUID_MOD_BIPOLAR = 2,        /**< Mapping function is bipolar */
47     FLUID_MOD_LINEAR = 0,         /**< Linear mapping function */
48     FLUID_MOD_CONCAVE = 4,        /**< Concave mapping function */
49     FLUID_MOD_CONVEX = 8,         /**< Convex mapping function */
50     FLUID_MOD_SWITCH = 12,        /**< Switch (on/off) mapping function */
51     FLUID_MOD_GC = 0,             /**< General controller source type (#fluid_mod_src) */
52     FLUID_MOD_CC = 16,             /**< MIDI CC controller (source will be a MIDI CC number) */
53
54     FLUID_MOD_SIN = 0x80,            /**< Custom non-standard sinus mapping function */
55 };
56
57 /**
58  * General controller (if #FLUID_MOD_GC in flags).  This
59  * corresponds to SoundFont 2.04 PDF section 8.2.1
60  */
61 enum fluid_mod_src
62 {
63     FLUID_MOD_NONE = 0,                   /**< No source controller */
64     FLUID_MOD_VELOCITY = 2,               /**< MIDI note-on velocity */
65     FLUID_MOD_KEY = 3,                    /**< MIDI note-on note number */
66     FLUID_MOD_KEYPRESSURE = 10,           /**< MIDI key pressure */
67     FLUID_MOD_CHANNELPRESSURE = 13,       /**< MIDI channel pressure */
68     FLUID_MOD_PITCHWHEEL = 14,            /**< Pitch wheel */
69     FLUID_MOD_PITCHWHEELSENS = 16         /**< Pitch wheel sensitivity */
70 };
71
72 FLUIDSYNTH_API fluid_mod_t *new_fluid_mod(void);
73 FLUIDSYNTH_API void delete_fluid_mod(fluid_mod_t *mod);
74 FLUIDSYNTH_API size_t fluid_mod_sizeof(void);
75
76 FLUIDSYNTH_API void fluid_mod_set_source1(fluid_mod_t *mod, int src, int flags);
77 FLUIDSYNTH_API void fluid_mod_set_source2(fluid_mod_t *mod, int src, int flags);
78 FLUIDSYNTH_API void fluid_mod_set_dest(fluid_mod_t *mod, int dst);
79 FLUIDSYNTH_API void fluid_mod_set_amount(fluid_mod_t *mod, double amount);
80
81 FLUIDSYNTH_API int fluid_mod_get_source1(const fluid_mod_t *mod);
82 FLUIDSYNTH_API int fluid_mod_get_flags1(const fluid_mod_t *mod);
83 FLUIDSYNTH_API int fluid_mod_get_source2(const fluid_mod_t *mod);
84 FLUIDSYNTH_API int fluid_mod_get_flags2(const fluid_mod_t *mod);
85 FLUIDSYNTH_API int fluid_mod_get_dest(const fluid_mod_t *mod);
86 FLUIDSYNTH_API double fluid_mod_get_amount(const fluid_mod_t *mod);
87
88 FLUIDSYNTH_API int fluid_mod_test_identity(const fluid_mod_t *mod1, const fluid_mod_t *mod2);
89 FLUIDSYNTH_API int fluid_mod_has_source(const fluid_mod_t *mod, int cc, int ctrl);
90 FLUIDSYNTH_API int fluid_mod_has_dest(const fluid_mod_t *mod, int gen);
91
92 FLUIDSYNTH_API void fluid_mod_clone(fluid_mod_t *mod, const fluid_mod_t *src);
93
94 #ifdef __cplusplus
95 }
96 #endif
97 #endif /* _FLUIDSYNTH_MOD_H */
98