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_MOD_H 22#define _FLUIDSYNTH_MOD_H 23 24#ifdef __cplusplus 25extern "C" { 26#endif 27 28 /* Modulator-related definitions */ 29 30 /* Maximum number of modulators in a voice */ 31#define FLUID_NUM_MOD 64 32 33 /* 34 * fluid_mod_t 35 */ 36struct _fluid_mod_t 37{ 38 unsigned char dest; 39 unsigned char src1; 40 unsigned char flags1; 41 unsigned char src2; 42 unsigned char flags2; 43 double amount; 44 /* The 'next' field allows to link modulators into a list. It is 45 * not used in fluid_voice.c, there each voice allocates memory for a 46 * fixed number of modulators. Since there may be a huge number of 47 * different zones, this is more efficient. 48 */ 49 fluid_mod_t * next; 50}; 51 52/* Flags telling the polarity of a modulator. Compare with SF2.01 53 section 8.2. Note: The numbers of the bits are different! (for 54 example: in the flags of a SF modulator, the polarity bit is bit 55 nr. 9) */ 56enum fluid_mod_flags 57{ 58 FLUID_MOD_POSITIVE = 0, 59 FLUID_MOD_NEGATIVE = 1, 60 FLUID_MOD_UNIPOLAR = 0, 61 FLUID_MOD_BIPOLAR = 2, 62 FLUID_MOD_LINEAR = 0, 63 FLUID_MOD_CONCAVE = 4, 64 FLUID_MOD_CONVEX = 8, 65 FLUID_MOD_SWITCH = 12, 66 FLUID_MOD_GC = 0, 67 FLUID_MOD_CC = 16 68}; 69 70/* Flags telling the source of a modulator. This corresponds to 71 * SF2.01 section 8.2.1 */ 72enum fluid_mod_src 73{ 74 FLUID_MOD_NONE = 0, 75 FLUID_MOD_VELOCITY = 2, 76 FLUID_MOD_KEY = 3, 77 FLUID_MOD_KEYPRESSURE = 10, 78 FLUID_MOD_CHANNELPRESSURE = 13, 79 FLUID_MOD_PITCHWHEEL = 14, 80 FLUID_MOD_PITCHWHEELSENS = 16 81}; 82 83/* Allocates memory for a new modulator */ 84FLUIDSYNTH_API fluid_mod_t * fluid_mod_new(void); 85 86/* Frees the modulator */ 87FLUIDSYNTH_API void fluid_mod_delete(fluid_mod_t * mod); 88 89 90FLUIDSYNTH_API void fluid_mod_set_source1(fluid_mod_t* mod, int src, int flags); 91FLUIDSYNTH_API void fluid_mod_set_source2(fluid_mod_t* mod, int src, int flags); 92FLUIDSYNTH_API void fluid_mod_set_dest(fluid_mod_t* mod, int dst); 93FLUIDSYNTH_API void fluid_mod_set_amount(fluid_mod_t* mod, double amount); 94 95FLUIDSYNTH_API int fluid_mod_get_source1(fluid_mod_t* mod); 96FLUIDSYNTH_API int fluid_mod_get_flags1(fluid_mod_t* mod); 97FLUIDSYNTH_API int fluid_mod_get_source2(fluid_mod_t* mod); 98FLUIDSYNTH_API int fluid_mod_get_flags2(fluid_mod_t* mod); 99FLUIDSYNTH_API int fluid_mod_get_dest(fluid_mod_t* mod); 100FLUIDSYNTH_API double fluid_mod_get_amount(fluid_mod_t* mod); 101 102 103/* Determines, if two modulators are 'identical' (all parameters 104 except the amount match) */ 105FLUIDSYNTH_API int fluid_mod_test_identity(fluid_mod_t * mod1, fluid_mod_t * mod2); 106 107 108#ifdef __cplusplus 109} 110#endif 111#endif /* _FLUIDSYNTH_MOD_H */ 112 113