# include/fluidsynth/ramsfont.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_RAMSFONT_H
    00022 #define _FLUIDSYNTH_RAMSFONT_H
    00023
    00024 #ifdef __cplusplus
    00025 extern "C" {
    00026 #endif
    00027
    00028
    00029 /********************************************************************************/
    00030 /********************************************************************************/
    00031 /* ram soundfonts:
    00032         October 2002 - Antoine Schmitt
    00033
    00034         ram soundfonts live in ram. The samples are loaded from files
    00035         or from RAM.  A minimal API manages a soundFont structure,
    00036         with presets, each preset having only one preset-zone, which
    00037         instrument has potentially many instrument-zones.  No global
    00038         zones, and nor generator nor modulator other than the default
    00039         ones are permitted.  This may be extensible in the future.
    00040 */
    00041 /********************************************************************************/
    00042 /********************************************************************************/
    00043
    00044 /*
    00045    We are not using the sfloader protocol, as we need more arguments
    00046    than what it provides.
    00047 */
    00048
    00050 FLUIDSYNTH_API fluid_sfont_t* fluid_ramsfont_create_sfont(void);
    00051
    00052 /***********************
    00053  * ramsfont specific API
    00054  ***********************/
    00055 FLUIDSYNTH_API int fluid_ramsfont_set_name(fluid_ramsfont_t* sfont, char * name);
    00056
    00057 /* Creates one instrument zone for the sample inside the preset defined
    00058  *     by bank/num
    00059  *     \returns 0 if success
    00060  */
    00061 FLUIDSYNTH_API
    00062 int fluid_ramsfont_add_izone(fluid_ramsfont_t* sfont,
    00063                                 unsigned int bank, unsigned int num, fluid_sample_t* sample,
    00064                                 int lokey, int hikey);
    00065
    00066 /* Removes the instrument zone corresponding to bank/num and to the sample
    00067  *     \returns 0 if success
    00068  */
    00069 FLUIDSYNTH_API
    00070 int fluid_ramsfont_remove_izone(fluid_ramsfont_t* sfont,
    00071                                 unsigned int bank, unsigned int num, fluid_sample_t* sample);
    00072
    00073 /* Sets a generator on an instrument zone
    00074  *     \returns 0 if success
    00075  */
    00076 FLUIDSYNTH_API
    00077 int fluid_ramsfont_izone_set_gen(fluid_ramsfont_t* sfont,
    00078                                 unsigned int bank, unsigned int num, fluid_sample_t* sample,
    00079                                 int gen_type, float value);
    00080
    00081 /* Utility : sets the loop start/end values
    00082  *     \on = 0 or 1; if 0, loopstart and loopend are not used
    00083  *     \loopstart and loopend are floats, in frames
    00084  *     \loopstart is counted from frame 0
    00085  *     \loopend is counted from the last frame, thus is < 0
    00086  *     \returns 0 if success
    00087  */
    00088 FLUIDSYNTH_API
    00089 int fluid_ramsfont_izone_set_loop(fluid_ramsfont_t* sfont,
    00090                                 unsigned int bank, unsigned int num, fluid_sample_t* sample,
    00091                                 int on, float loopstart, float loopend);
    00092
    00093 /***************************************
    00094  * sample_t specific API for ramsfont
    00095  ***************************************/
    00096 FLUIDSYNTH_API fluid_sample_t* new_fluid_ramsample(void);
    00097 FLUIDSYNTH_API int delete_fluid_ramsample(fluid_sample_t* sample);
    00098 FLUIDSYNTH_API int fluid_sample_set_name(fluid_sample_t* sample, char * name);
    00099
    00100 /* Sets the sound data of the sample
    00101  *     Warning : if copy_data is FALSE, data should have 8 unused frames at start
    00102  *     and 8 unused frames at the end.
    00103  */
    00104 FLUIDSYNTH_API
    00105 int fluid_sample_set_sound_data(fluid_sample_t* sample, short *data,
    00106                                unsigned int nbframes, short copy_data, int rootkey);
    00107
    00108
    00109 #ifdef __cplusplus
    00110 }
    00111 #endif
    00112
    00113 #endif /* _FLUIDSYNTH_RAMSFONT_H */