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 { 00076 void* data; 00077 00081 int (*free)(fluid_sfloader_t* loader); 00082 00084 fluid_sfont_t* (*load)(fluid_sfloader_t* loader, const char* filename); 00085 }; 00086 00087 00088 /* 00089 * fluid_sfont_t 00090 */ 00091 00092 struct _fluid_sfont_t { 00093 void* data; 00094 unsigned int id; 00095 00099 int (*free)(fluid_sfont_t* sfont); 00100 00102 char* (*get_name)(fluid_sfont_t* sfont); 00103 00107 fluid_preset_t* (*get_preset)(fluid_sfont_t* sfont, unsigned int bank, unsigned int prenum); 00108 00109 void (*iteration_start)(fluid_sfont_t* sfont); 00110 00111 /* return 0 when no more presets are available, 1 otherwise */ 00112 int (*iteration_next)(fluid_sfont_t* sfont, fluid_preset_t* preset); 00113 }; 00114 00115 #define fluid_sfont_get_id(_sf) ((_sf)->id) 00116 00117 00118 /* 00119 * fluid_preset_t 00120 */ 00121 00122 struct _fluid_preset_t { 00123 void* data; 00124 fluid_sfont_t* sfont; 00125 int (*free)(fluid_preset_t* preset); 00126 char* (*get_name)(fluid_preset_t* preset); 00127 int (*get_banknum)(fluid_preset_t* preset); 00128 int (*get_num)(fluid_preset_t* preset); 00129 00131 int (*noteon)(fluid_preset_t* preset, fluid_synth_t* synth, int chan, int key, int vel); 00132 00135 int (*notify)(fluid_preset_t* preset, int reason, int chan); 00136 }; 00137 00138 00139 /* 00140 * fluid_sample_t 00141 */ 00142 00143 struct _fluid_sample_t 00144 { 00145 char name[21]; 00146 unsigned int start; 00147 unsigned int end; 00148 unsigned int loopstart; 00149 unsigned int loopend; 00150 unsigned int samplerate; 00151 int origpitch; 00152 int pitchadj; 00153 int sampletype; 00154 int valid; 00155 short* data; 00156 00160 /* Set this to zero, when submitting a new sample. */ 00161 int amplitude_that_reaches_noise_floor_is_valid; 00162 double amplitude_that_reaches_noise_floor; 00163 00165 unsigned int refcount; 00166 00169 int (*notify)(fluid_sample_t* sample, int reason); 00170 00172 void* userdata; 00173 }; 00174 00175 00176 #define fluid_sample_refcount(_sample) ((_sample)->refcount) 00177 00178 00181 #define FLUID_SAMPLETYPE_MONO 1 00182 #define FLUID_SAMPLETYPE_RIGHT 2 00183 #define FLUID_SAMPLETYPE_LEFT 4 00184 #define FLUID_SAMPLETYPE_LINKED 8 00185 #define FLUID_SAMPLETYPE_ROM 0x8000 00186 00187 00188 00189 #ifdef __cplusplus 00190 } 00191 #endif 00192 00193 #endif /* _FLUIDSYNTH_SFONT_H */

Generated on Sat Jun 11 17:30:08 2005 for libfluidsynth by doxygen 1.3.8