Add files via upload
[fluidsynth-winbin.git] / bin32 / fluidsynth-1.1.2 / include / fluidsynth / mod.h
blob786df2c0ad2d5295244f6ed09828d34276f9f7d7
1 /* FluidSynth - A Software Synthesizer
3 * Copyright (C) 2003 Peter Hanappe and others.
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.
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.
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
21 #ifndef _FLUIDSYNTH_MOD_H
22 #define _FLUIDSYNTH_MOD_H
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 /**
29 * @file mod.h
30 * @brief SoundFont modulator functions and constants.
33 #define FLUID_NUM_MOD 64 /**< Maximum number of modulators in a voice */
35 /**
36 * Modulator structure. See SoundFont 2.04 PDF section 8.2.
38 struct _fluid_mod_t
40 unsigned char dest; /**< Destination generator to control */
41 unsigned char src1; /**< Source controller 1 */
42 unsigned char flags1; /**< Source controller 1 flags */
43 unsigned char src2; /**< Source controller 2 */
44 unsigned char flags2; /**< Source controller 2 flags */
45 double amount; /**< Multiplier amount */
46 /* The 'next' field allows to link modulators into a list. It is
47 * not used in fluid_voice.c, there each voice allocates memory for a
48 * fixed number of modulators. Since there may be a huge number of
49 * different zones, this is more efficient.
51 fluid_mod_t * next;
54 /**
55 * Flags defining the polarity, mapping function and type of a modulator source.
56 * Compare with SoundFont 2.04 PDF section 8.2.
58 * Note: Bit values do not correspond to the SoundFont spec! Also note that
59 * #FLUID_MOD_GC and #FLUID_MOD_CC are in the flags field instead of the source field.
61 enum fluid_mod_flags
63 FLUID_MOD_POSITIVE = 0, /**< Mapping function is positive */
64 FLUID_MOD_NEGATIVE = 1, /**< Mapping function is negative */
65 FLUID_MOD_UNIPOLAR = 0, /**< Mapping function is unipolar */
66 FLUID_MOD_BIPOLAR = 2, /**< Mapping function is bipolar */
67 FLUID_MOD_LINEAR = 0, /**< Linear mapping function */
68 FLUID_MOD_CONCAVE = 4, /**< Concave mapping function */
69 FLUID_MOD_CONVEX = 8, /**< Convex mapping function */
70 FLUID_MOD_SWITCH = 12, /**< Switch (on/off) mapping function */
71 FLUID_MOD_GC = 0, /**< General controller source type (#fluid_mod_src) */
72 FLUID_MOD_CC = 16 /**< MIDI CC controller (source will be a MIDI CC number) */
75 /**
76 * General controller (if #FLUID_MOD_GC in flags). This
77 * corresponds to SoundFont 2.04 PDF section 8.2.1
79 enum fluid_mod_src
81 FLUID_MOD_NONE = 0, /**< No source controller */
82 FLUID_MOD_VELOCITY = 2, /**< MIDI note-on velocity */
83 FLUID_MOD_KEY = 3, /**< MIDI note-on note number */
84 FLUID_MOD_KEYPRESSURE = 10, /**< MIDI key pressure */
85 FLUID_MOD_CHANNELPRESSURE = 13, /**< MIDI channel pressure */
86 FLUID_MOD_PITCHWHEEL = 14, /**< Pitch wheel */
87 FLUID_MOD_PITCHWHEELSENS = 16 /**< Pitch wheel sensitivity */
90 FLUIDSYNTH_API fluid_mod_t* fluid_mod_new(void);
91 FLUIDSYNTH_API void fluid_mod_delete(fluid_mod_t * mod);
93 FLUIDSYNTH_API void fluid_mod_set_source1(fluid_mod_t* mod, int src, int flags);
94 FLUIDSYNTH_API void fluid_mod_set_source2(fluid_mod_t* mod, int src, int flags);
95 FLUIDSYNTH_API void fluid_mod_set_dest(fluid_mod_t* mod, int dst);
96 FLUIDSYNTH_API void fluid_mod_set_amount(fluid_mod_t* mod, double amount);
98 FLUIDSYNTH_API int fluid_mod_get_source1(fluid_mod_t* mod);
99 FLUIDSYNTH_API int fluid_mod_get_flags1(fluid_mod_t* mod);
100 FLUIDSYNTH_API int fluid_mod_get_source2(fluid_mod_t* mod);
101 FLUIDSYNTH_API int fluid_mod_get_flags2(fluid_mod_t* mod);
102 FLUIDSYNTH_API int fluid_mod_get_dest(fluid_mod_t* mod);
103 FLUIDSYNTH_API double fluid_mod_get_amount(fluid_mod_t* mod);
105 FLUIDSYNTH_API int fluid_mod_test_identity(fluid_mod_t * mod1, fluid_mod_t * mod2);
108 #ifdef __cplusplus
110 #endif
111 #endif /* _FLUIDSYNTH_MOD_H */