# include/fluidsynth/mod.h

    00001 /* FluidSynth - A Software Synthesizer
    00002  *
    00003  * Copyright (C) 2003  Peter Hanappe and others.
    00004  *
    00005  * This library is free software; you can redistribute it and/or
    00006  * modify it under the terms of the GNU Library General Public License
    00007  * as published by the Free Software Foundation; either version 2 of
    00008  * the License, or (at your option) any later version.
    00009  *
    00010  * This library is distributed in the hope that it will be useful, but
    00011  * WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013  * Library General Public License for more details.
    00014  *
    00015  * You should have received a copy of the GNU Library General Public
    00016  * License along with this library; if not, write to the Free
    00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    00018  * 02111-1307, USA
    00019  */
    00020
    00021 #ifndef _FLUIDSYNTH_MOD_H
    00022 #define _FLUIDSYNTH_MOD_H
    00023
    00024 #ifdef __cplusplus
    00025 extern "C" {
    00026 #endif
    00027
    00028   /* Modulator-related definitions */
    00029
    00030   /* Maximum number of modulators in a voice */
    00031 #define FLUID_NUM_MOD           64
    00032
    00033   /*
    00034    *  fluid_mod_t
    00035    */
    00036 struct _fluid_mod_t
    00037 {
    00038   unsigned char dest;
    00039   unsigned char src1;
    00040   unsigned char flags1;
    00041   unsigned char src2;
    00042   unsigned char flags2;
    00043   double amount;
    00044   /* The 'next' field allows to link modulators into a list.  It is
    00045    * not used in fluid_voice.c, there each voice allocates memory for a
    00046    * fixed number of modulators.  Since there may be a huge number of
    00047    * different zones, this is more efficient.
    00048    */
    00049   fluid_mod_t * next;
    00050 };
    00051
    00052 /* Flags telling the polarity of a modulator.  Compare with SF2.01
    00053    section 8.2. Note: The numbers of the bits are different!  (for
    00054    example: in the flags of a SF modulator, the polarity bit is bit
    00055    nr. 9) */
    00056 enum fluid_mod_flags
    00057 {
    00058   FLUID_MOD_POSITIVE = 0,
    00059   FLUID_MOD_NEGATIVE = 1,
    00060   FLUID_MOD_UNIPOLAR = 0,
    00061   FLUID_MOD_BIPOLAR = 2,
    00062   FLUID_MOD_LINEAR = 0,
    00063   FLUID_MOD_CONCAVE = 4,
    00064   FLUID_MOD_CONVEX = 8,
    00065   FLUID_MOD_SWITCH = 12,
    00066   FLUID_MOD_GC = 0,
    00067   FLUID_MOD_CC = 16
    00068 };
    00069
    00070 /* Flags telling the source of a modulator.  This corresponds to
    00071  * SF2.01 section 8.2.1 */
    00072 enum fluid_mod_src
    00073 {
    00074   FLUID_MOD_NONE = 0,
    00075   FLUID_MOD_VELOCITY = 2,
    00076   FLUID_MOD_KEY = 3,
    00077   FLUID_MOD_KEYPRESSURE = 10,
    00078   FLUID_MOD_CHANNELPRESSURE = 13,
    00079   FLUID_MOD_PITCHWHEEL = 14,
    00080   FLUID_MOD_PITCHWHEELSENS = 16
    00081 };
    00082
    00083 /* Allocates memory for a new modulator */
    00084 FLUIDSYNTH_API fluid_mod_t * fluid_mod_new(void);
    00085
    00086 /* Frees the modulator */
    00087 FLUIDSYNTH_API void fluid_mod_delete(fluid_mod_t * mod);
    00088
    00089
    00090 FLUIDSYNTH_API void fluid_mod_set_source1(fluid_mod_t* mod, int src, int flags);
    00091 FLUIDSYNTH_API void fluid_mod_set_source2(fluid_mod_t* mod, int src, int flags);
    00092 FLUIDSYNTH_API void fluid_mod_set_dest(fluid_mod_t* mod, int dst);
    00093 FLUIDSYNTH_API void fluid_mod_set_amount(fluid_mod_t* mod, double amount);
    00094
    00095 FLUIDSYNTH_API int fluid_mod_get_source1(fluid_mod_t* mod);
    00096 FLUIDSYNTH_API int fluid_mod_get_flags1(fluid_mod_t* mod);
    00097 FLUIDSYNTH_API int fluid_mod_get_source2(fluid_mod_t* mod);
    00098 FLUIDSYNTH_API int fluid_mod_get_flags2(fluid_mod_t* mod);
    00099 FLUIDSYNTH_API int fluid_mod_get_dest(fluid_mod_t* mod);
    00100 FLUIDSYNTH_API double fluid_mod_get_amount(fluid_mod_t* mod);
    00101
    00102
    00103 /* Determines, if two modulators are 'identical' (all parameters
    00104    except the amount match) */
    00105 FLUIDSYNTH_API int fluid_mod_test_identity(fluid_mod_t * mod1, fluid_mod_t * mod2);
    00106
    00107
    00108 #ifdef __cplusplus
    00109 }
    00110 #endif
    00111 #endif /* _FLUIDSYNTH_MOD_H */
    00112