Update Fluidsynth to 2.0.1
[ardour.git] / libs / fluidsynth / fluidsynth / voice.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_VOICE_H
22 #define _FLUIDSYNTH_VOICE_H
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 /**
29  * @file voice.h
30  * @brief Synthesis voice manipulation functions.
31  *
32  * The interface to the synthesizer's voices.
33  * Examples on using them can be found in fluid_defsfont.c.
34  * Most of these functions should only be called from within synthesis context,
35  * such as the SoundFont loader's noteon method.
36  */
37
38
39 /**
40  * Enum used with fluid_voice_add_mod() to specify how to handle duplicate modulators.
41  */
42 enum fluid_voice_add_mod
43 {
44     FLUID_VOICE_OVERWRITE,        /**< Overwrite any existing matching modulator */
45     FLUID_VOICE_ADD,              /**< Add (sum) modulator amounts */
46     FLUID_VOICE_DEFAULT           /**< For default modulators only, no need to check for duplicates */
47 };
48
49 FLUIDSYNTH_API void fluid_voice_add_mod(fluid_voice_t *voice, fluid_mod_t *mod, int mode);
50 FLUIDSYNTH_API float fluid_voice_gen_get(fluid_voice_t *voice, int gen);
51 FLUIDSYNTH_API void fluid_voice_gen_set(fluid_voice_t *voice, int gen, float val);
52 FLUIDSYNTH_API void fluid_voice_gen_incr(fluid_voice_t *voice, int gen, float val);
53
54 FLUIDSYNTH_API unsigned int fluid_voice_get_id(const fluid_voice_t *voice);
55 FLUIDSYNTH_API int fluid_voice_get_channel(const fluid_voice_t *voice);
56 FLUIDSYNTH_API int fluid_voice_get_key(const fluid_voice_t *voice);
57 FLUIDSYNTH_API int fluid_voice_get_actual_key(const fluid_voice_t *voice);
58 FLUIDSYNTH_API int fluid_voice_get_velocity(const fluid_voice_t *voice);
59 FLUIDSYNTH_API int fluid_voice_get_actual_velocity(const fluid_voice_t *voice);
60 FLUIDSYNTH_API int fluid_voice_is_playing(const fluid_voice_t *voice);
61 FLUIDSYNTH_API int fluid_voice_is_on(const fluid_voice_t *voice);
62 FLUIDSYNTH_API int fluid_voice_is_sustained(const fluid_voice_t *voice);
63 FLUIDSYNTH_API int fluid_voice_is_sostenuto(const fluid_voice_t *voice);
64 FLUIDSYNTH_API int fluid_voice_optimize_sample(fluid_sample_t *s);
65 FLUIDSYNTH_API void fluid_voice_update_param(fluid_voice_t *voice, int gen);
66
67
68 #ifdef __cplusplus
69 }
70 #endif
71 #endif /* _FLUIDSYNTH_VOICE_H */
72