Main Page   Data Structures   File List   Data Fields   Globals  

sfont.h

Go to the documentation of this file.
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_SFONT_H
00022 #define _FLUIDSYNTH_SFONT_H
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 
00029 
00063   enum {
00064     FLUID_PRESET_SELECTED,
00065     FLUID_PRESET_UNSELECTED,
00066     FLUID_SAMPLE_DONE
00067   };
00068 
00069 
00070 /*
00071  * fluid_sfloader_t
00072  */
00073 
00074 struct _fluid_sfloader_t {
00075   void* data;
00076   int (*free)(fluid_sfloader_t* loader);
00077   fluid_sfont_t* (*load)(fluid_sfloader_t* loader, const char* filename);
00078 };
00079 
00080 
00081 /*
00082  * fluid_sfont_t
00083  */
00084 
00085 struct _fluid_sfont_t {
00086   void* data;
00087   unsigned int id;
00088 
00092   int (*free)(fluid_sfont_t* sfont);
00093 
00094   char* (*get_name)(fluid_sfont_t* sfont);
00095   fluid_preset_t* (*get_preset)(fluid_sfont_t* sfont, unsigned int bank, unsigned int prenum);
00096   void (*iteration_start)(fluid_sfont_t* sfont);
00097 
00098   /* return 0 when no more presets are available, 1 otherwise */
00099   int (*iteration_next)(fluid_sfont_t* sfont, fluid_preset_t* preset);
00100 };
00101 
00102 #define fluid_sfont_get_id(_sf) ((_sf)->id)
00103 
00104 
00105 /*
00106  * fluid_preset_t 
00107  */
00108 
00109 struct _fluid_preset_t {
00110   void* data;
00111   fluid_sfont_t* sfont;
00112   int (*free)(fluid_preset_t* preset);
00113   char* (*get_name)(fluid_preset_t* preset);
00114   int (*get_banknum)(fluid_preset_t* preset);
00115   int (*get_num)(fluid_preset_t* preset);
00116 
00118   int (*noteon)(fluid_preset_t* preset, fluid_synth_t* synth, int chan, int key, int vel);
00119 
00122   int (*notify)(fluid_preset_t* preset, int reason, int chan);
00123 };
00124 
00125 
00126 /*
00127  * fluid_sample_t
00128  */
00129 
00130 struct _fluid_sample_t
00131 {
00132   char name[21];
00133   unsigned int start;
00134   unsigned int end;
00135   unsigned int loopstart;
00136   unsigned int loopend;
00137   unsigned int samplerate;
00138   int origpitch;
00139   int pitchadj;
00140   int sampletype;
00141   int valid;
00142   short* data;
00143 
00147   /* Set this to zero, when submitting a new sample. */
00148   int amplitude_that_reaches_noise_floor_is_valid; 
00149   double amplitude_that_reaches_noise_floor;
00150 
00152   unsigned int refcount;
00153 
00156   int (*notify)(fluid_sample_t* sample, int reason);
00157 
00159   void* userdata;
00160 };
00161 
00162 
00163 #define fluid_sample_refcount(_sample) ((_sample)->refcount)
00164 
00165 
00168 #define FLUID_SAMPLETYPE_MONO   1
00169 #define FLUID_SAMPLETYPE_RIGHT  2
00170 #define FLUID_SAMPLETYPE_LEFT   4
00171 #define FLUID_SAMPLETYPE_LINKED 8
00172 #define FLUID_SAMPLETYPE_ROM    0x8000
00173 
00174 
00175 
00176 #ifdef __cplusplus
00177 }
00178 #endif
00179 
00180 #endif /* _FLUIDSYNTH_SFONT_H */

Generated on Thu Mar 13 19:09:34 2003 for libfluidsynth by doxygen1.2.15