1/* FluidSynth - A Software Synthesizer 2 * 3 * Copyright (C) 2003 Peter Hanappe and others. 4 * 5 * SoundFont loading code borrowed from Smurf SoundFont Editor by Josh Green 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Library General Public License 9 * as published by the Free Software Foundation; either version 2 of 10 * the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, but 13 * WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Library General Public License for more details. 16 * 17 * You should have received a copy of the GNU Library General Public 18 * License along with this library; if not, write to the Free 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 20 * 02111-1307, USA 21 */ 22 23 24#ifndef _FLUID_DEFSFONT_H 25#define _FLUID_DEFSFONT_H 26 27 28#include "fluidsynth.h" 29#include "fluidsynth_priv.h" 30#include "fluid_list.h" 31 32 33 34/********************************************************************************/ 35/********************************************************************************/ 36/********************************************************************************/ 37/********************************************************************************/ 38/********************************************************************************/ 39 40/*-----------------------------------sfont.h----------------------------*/ 41 42#define SF_SAMPMODES_LOOP 1 43#define SF_SAMPMODES_UNROLL 2 44 45#define SF_MIN_SAMPLERATE 400 46#define SF_MAX_SAMPLERATE 50000 47 48#define SF_MIN_SAMPLE_LENGTH 32 49 50/* Sound Font structure defines */ 51 52typedef struct _SFVersion 53{ /* version structure */ 54 unsigned short major; 55 unsigned short minor; 56} 57SFVersion; 58 59typedef struct _SFMod 60{ /* Modulator structure */ 61 unsigned short src; /* source modulator */ 62 unsigned short dest; /* destination generator */ 63 signed short amount; /* signed, degree of modulation */ 64 unsigned short amtsrc; /* second source controls amnt of first */ 65 unsigned short trans; /* transform applied to source */ 66} 67SFMod; 68 69typedef union _SFGenAmount 70{ /* Generator amount structure */ 71 signed short sword; /* signed 16 bit value */ 72 unsigned short uword; /* unsigned 16 bit value */ 73 struct 74 { 75 unsigned char lo; /* low value for ranges */ 76 unsigned char hi; /* high value for ranges */ 77 } 78 range; 79} 80SFGenAmount; 81 82typedef struct _SFGen 83{ /* Generator structure */ 84 unsigned short id; /* generator ID */ 85 SFGenAmount amount; /* generator value */ 86} 87SFGen; 88 89typedef struct _SFZone 90{ /* Sample/instrument zone structure */ 91 fluid_list_t *instsamp; /* instrument/sample pointer for zone */ 92 fluid_list_t *gen; /* list of generators */ 93 fluid_list_t *mod; /* list of modulators */ 94} 95SFZone; 96 97typedef struct _SFSample 98{ /* Sample structure */ 99 char name[21]; /* Name of sample */ 100 unsigned char samfile; /* Loaded sfont/sample buffer = 0/1 */ 101 unsigned int start; /* Offset in sample area to start of sample */ 102 unsigned int end; /* Offset from start to end of sample, 103 this is the last point of the 104 sample, the SF spec has this as the 105 1st point after, corrected on 106 load/save */ 107 unsigned int loopstart; /* Offset from start to start of loop */ 108 unsigned int loopend; /* Offset from start to end of loop, 109 marks the first point after loop, 110 whose sample value is ideally 111 equivalent to loopstart */ 112 unsigned int samplerate; /* Sample rate recorded at */ 113 unsigned char origpitch; /* root midi key number */ 114 signed char pitchadj; /* pitch correction in cents */ 115 unsigned short sampletype; /* 1 mono,2 right,4 left,linked 8,0x8000=ROM */ 116} 117SFSample; 118 119typedef struct _SFInst 120{ /* Instrument structure */ 121 char name[21]; /* Name of instrument */ 122 fluid_list_t *zone; /* list of instrument zones */ 123} 124SFInst; 125 126typedef struct _SFPreset 127{ /* Preset structure */ 128 char name[21]; /* preset name */ 129 unsigned short prenum; /* preset number */ 130 unsigned short bank; /* bank number */ 131 unsigned int libr; /* Not used (preserved) */ 132 unsigned int genre; /* Not used (preserved) */ 133 unsigned int morph; /* Not used (preserved) */ 134 fluid_list_t *zone; /* list of preset zones */ 135} 136SFPreset; 137 138/* NOTE: sffd is also used to determine if sound font is new (NULL) */ 139typedef struct _SFData 140{ /* Sound font data structure */ 141 SFVersion version; /* sound font version */ 142 SFVersion romver; /* ROM version */ 143 unsigned int samplepos; /* position within sffd of the sample chunk */ 144 unsigned int samplesize; /* length within sffd of the sample chunk */ 145 char *fname; /* file name */ 146 FILE *sffd; /* loaded sfont file descriptor */ 147 fluid_list_t *info; /* linked list of info strings (1st byte is ID) */ 148 fluid_list_t *preset; /* linked list of preset info */ 149 fluid_list_t *inst; /* linked list of instrument info */ 150 fluid_list_t *sample; /* linked list of sample info */ 151} 152SFData; 153 154/* sf file chunk IDs */ 155enum 156{ UNKN_ID, RIFF_ID, LIST_ID, SFBK_ID, 157 INFO_ID, SDTA_ID, PDTA_ID, /* info/sample/preset */ 158 159 IFIL_ID, ISNG_ID, INAM_ID, IROM_ID, /* info ids (1st byte of info strings) */ 160 IVER_ID, ICRD_ID, IENG_ID, IPRD_ID, /* more info ids */ 161 ICOP_ID, ICMT_ID, ISFT_ID, /* and yet more info ids */ 162 163 SNAM_ID, SMPL_ID, /* sample ids */ 164 PHDR_ID, PBAG_ID, PMOD_ID, PGEN_ID, /* preset ids */ 165 IHDR_ID, IBAG_ID, IMOD_ID, IGEN_ID, /* instrument ids */ 166 SHDR_ID /* sample info */ 167}; 168 169/* generator types */ 170typedef enum 171{ Gen_StartAddrOfs, Gen_EndAddrOfs, Gen_StartLoopAddrOfs, 172 Gen_EndLoopAddrOfs, Gen_StartAddrCoarseOfs, Gen_ModLFO2Pitch, 173 Gen_VibLFO2Pitch, Gen_ModEnv2Pitch, Gen_FilterFc, Gen_FilterQ, 174 Gen_ModLFO2FilterFc, Gen_ModEnv2FilterFc, Gen_EndAddrCoarseOfs, 175 Gen_ModLFO2Vol, Gen_Unused1, Gen_ChorusSend, Gen_ReverbSend, Gen_Pan, 176 Gen_Unused2, Gen_Unused3, Gen_Unused4, 177 Gen_ModLFODelay, Gen_ModLFOFreq, Gen_VibLFODelay, Gen_VibLFOFreq, 178 Gen_ModEnvDelay, Gen_ModEnvAttack, Gen_ModEnvHold, Gen_ModEnvDecay, 179 Gen_ModEnvSustain, Gen_ModEnvRelease, Gen_Key2ModEnvHold, 180 Gen_Key2ModEnvDecay, Gen_VolEnvDelay, Gen_VolEnvAttack, 181 Gen_VolEnvHold, Gen_VolEnvDecay, Gen_VolEnvSustain, Gen_VolEnvRelease, 182 Gen_Key2VolEnvHold, Gen_Key2VolEnvDecay, Gen_Instrument, 183 Gen_Reserved1, Gen_KeyRange, Gen_VelRange, 184 Gen_StartLoopAddrCoarseOfs, Gen_Keynum, Gen_Velocity, 185 Gen_Attenuation, Gen_Reserved2, Gen_EndLoopAddrCoarseOfs, 186 Gen_CoarseTune, Gen_FineTune, Gen_SampleId, Gen_SampleModes, 187 Gen_Reserved3, Gen_ScaleTune, Gen_ExclusiveClass, Gen_OverrideRootKey, 188 Gen_Dummy 189} 190Gen_Type; 191 192#define Gen_MaxValid Gen_Dummy - 1 /* maximum valid generator */ 193#define Gen_Count Gen_Dummy /* count of generators */ 194#define GenArrSize sizeof(SFGenAmount)*Gen_Count /* gen array size */ 195 196/* generator unit type */ 197typedef enum 198{ 199 None, /* No unit type */ 200 Unit_Smpls, /* in samples */ 201 Unit_32kSmpls, /* in 32k samples */ 202 Unit_Cent, /* in cents (1/100th of a semitone) */ 203 Unit_HzCent, /* in Hz Cents */ 204 Unit_TCent, /* in Time Cents */ 205 Unit_cB, /* in centibels (1/100th of a decibel) */ 206 Unit_Percent, /* in percentage */ 207 Unit_Semitone, /* in semitones */ 208 Unit_Range /* a range of values */ 209} 210Gen_Unit; 211 212/* global data */ 213 214extern unsigned short badgen[]; /* list of bad generators */ 215extern unsigned short badpgen[]; /* list of bad preset generators */ 216 217/* functions */ 218void sfont_init_chunks (void); 219 220void sfont_close (SFData * sf); 221void sfont_free_zone (SFZone * zone); 222int sfont_preset_compare_func (void* a, void* b); 223 224void sfont_zone_delete (SFData * sf, fluid_list_t ** zlist, SFZone * zone); 225 226fluid_list_t *gen_inlist (int gen, fluid_list_t * genlist); 227int gen_valid (int gen); 228int gen_validp (int gen); 229 230 231/*-----------------------------------sffile.h----------------------------*/ 232/* 233 File structures and routines (used to be in sffile.h) 234*/ 235 236#define CHNKIDSTR(id) &idlist[(id - 1) * 4] 237 238/* sfont file chunk sizes */ 239#define SFPHDRSIZE 38 240#define SFBAGSIZE 4 241#define SFMODSIZE 10 242#define SFGENSIZE 4 243#define SFIHDRSIZE 22 244#define SFSHDRSIZE 46 245 246/* sfont file data structures */ 247typedef struct _SFChunk 248{ /* RIFF file chunk structure */ 249 unsigned int id; /* chunk id */ 250 unsigned int size; /* size of the following chunk */ 251} 252SFChunk; 253 254typedef struct _SFPhdr 255{ 256 unsigned char name[20]; /* preset name */ 257 unsigned short preset; /* preset number */ 258 unsigned short bank; /* bank number */ 259 unsigned short pbagndx; /* index into preset bag */ 260 unsigned int library; /* just for preserving them */ 261 unsigned int genre; /* Not used */ 262 unsigned int morphology; /* Not used */ 263} 264SFPhdr; 265 266typedef struct _SFBag 267{ 268 unsigned short genndx; /* index into generator list */ 269 unsigned short modndx; /* index into modulator list */ 270} 271SFBag; 272 273typedef struct _SFIhdr 274{ 275 char name[20]; /* Name of instrument */ 276 unsigned short ibagndx; /* Instrument bag index */ 277} 278SFIhdr; 279 280typedef struct _SFShdr 281{ /* Sample header loading struct */ 282 char name[20]; /* Sample name */ 283 unsigned int start; /* Offset to start of sample */ 284 unsigned int end; /* Offset to end of sample */ 285 unsigned int loopstart; /* Offset to start of loop */ 286 unsigned int loopend; /* Offset to end of loop */ 287 unsigned int samplerate; /* Sample rate recorded at */ 288 unsigned char origpitch; /* root midi key number */ 289 signed char pitchadj; /* pitch correction in cents */ 290 unsigned short samplelink; /* Not used */ 291 unsigned short sampletype; /* 1 mono,2 right,4 left,linked 8,0x8000=ROM */ 292} 293SFShdr; 294 295/* data */ 296extern char idlist[]; 297 298/* functions */ 299SFData *sfload_file (const char * fname); 300 301 302 303/********************************************************************************/ 304/********************************************************************************/ 305/********************************************************************************/ 306/********************************************************************************/ 307/********************************************************************************/ 308 309/* GLIB - Library of useful routines for C programming 310 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald 311 * 312 * This library is free software; you can redistribute it and/or 313 * modify it under the terms of the GNU Library General Public 314 * License as published by the Free Software Foundation; either 315 * version 2 of the License, or (at your option) any later version. 316 * 317 * This library is distributed in the hope that it will be useful, 318 * but WITHOUT ANY WARRANTY; without even the implied warranty of 319 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 320 * Library General Public License for more details. 321 * 322 * You should have received a copy of the GNU Library General Public 323 * License along with this library; if not, write to the 324 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 325 * Boston, MA 02111-1307, USA. 326 */ 327 328 329/* Provide definitions for some commonly used macros. 330 * Some of them are only provided if they haven't already 331 * been defined. It is assumed that if they are already 332 * defined then the current definition is correct. 333 */ 334#ifndef FALSE 335#define FALSE (0) 336#endif 337 338#ifndef TRUE 339#define TRUE (!FALSE) 340#endif 341 342#define GPOINTER_TO_INT(p) ((int) (p)) 343#define GINT_TO_POINTER(i) ((void *) (i)) 344 345char* g_strdup (const char *str); 346 347 348 349 350 351/* Provide simple macro statement wrappers (adapted from Perl): 352 * G_STMT_START { statements; } G_STMT_END; 353 * can be used as a single statement, as in 354 * if (x) G_STMT_START { ... } G_STMT_END; else ... 355 * 356 * For gcc we will wrap the statements within `({' and `})' braces. 357 * For SunOS they will be wrapped within `if (1)' and `else (void) 0', 358 * and otherwise within `do' and `while (0)'. 359 */ 360#if !(defined (G_STMT_START) && defined (G_STMT_END)) 361# if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus) 362# define G_STMT_START (void)( 363# define G_STMT_END ) 364# else 365# if (defined (sun) || defined (__sun__)) 366# define G_STMT_START if (1) 367# define G_STMT_END else (void)0 368# else 369# define G_STMT_START do 370# define G_STMT_END while (0) 371# endif 372# endif 373#endif 374 375 376/* Basic bit swapping functions 377 */ 378#define GUINT16_SWAP_LE_BE_CONSTANT(val) ((unsigned short) ( \ 379 (((unsigned short) (val) & (unsigned short) 0x00ffU) << 8) | \ 380 (((unsigned short) (val) & (unsigned short) 0xff00U) >> 8))) 381#define GUINT32_SWAP_LE_BE_CONSTANT(val) ((unsigned int) ( \ 382 (((unsigned int) (val) & (unsigned int) 0x000000ffU) << 24) | \ 383 (((unsigned int) (val) & (unsigned int) 0x0000ff00U) << 8) | \ 384 (((unsigned int) (val) & (unsigned int) 0x00ff0000U) >> 8) | \ 385 (((unsigned int) (val) & (unsigned int) 0xff000000U) >> 24))) 386 387#define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val)) 388#define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val)) 389 390#define GINT16_TO_LE(val) ((signed short) (val)) 391#define GUINT16_TO_LE(val) ((unsigned short) (val)) 392#define GINT16_TO_BE(val) ((signed short) GUINT16_SWAP_LE_BE (val)) 393#define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) 394#define GINT32_TO_LE(val) ((signed int) (val)) 395#define GUINT32_TO_LE(val) ((unsigned int) (val)) 396#define GINT32_TO_BE(val) ((signed int) GUINT32_SWAP_LE_BE (val)) 397#define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val)) 398 399/* The G*_TO_?E() macros are defined in glibconfig.h. 400 * The transformation is symmetric, so the FROM just maps to the TO. 401 */ 402#define GINT16_FROM_LE(val) (GINT16_TO_LE (val)) 403#define GUINT16_FROM_LE(val) (GUINT16_TO_LE (val)) 404#define GINT16_FROM_BE(val) (GINT16_TO_BE (val)) 405#define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val)) 406#define GINT32_FROM_LE(val) (GINT32_TO_LE (val)) 407#define GUINT32_FROM_LE(val) (GUINT32_TO_LE (val)) 408#define GINT32_FROM_BE(val) (GINT32_TO_BE (val)) 409#define GUINT32_FROM_BE(val) (GUINT32_TO_BE (val)) 410 411 412/*-----------------------------------util.h----------------------------*/ 413/* 414 Utility functions (formerly in util.h) 415 */ 416#define FAIL 0 417#define OK 1 418 419enum 420{ ErrWarn, ErrFatal, ErrStatus, ErrCorr, ErrEof, ErrMem, Errno, 421 ErrRead, ErrWrite 422}; 423 424#define ErrMax ErrWrite 425#define ErrnoStart Errno 426#define ErrnoEnd ErrWrite 427 428int gerr (int ev, char * fmt, ...); 429int safe_fread (void *buf, int count, FILE * fd); 430int safe_fwrite (void *buf, int count, FILE * fd); 431int safe_fseek (FILE * fd, long ofs, int whence); 432 433 434/********************************************************************************/ 435/********************************************************************************/ 436/********************************************************************************/ 437/********************************************************************************/ 438/********************************************************************************/ 439 440 441 442/*************************************************************** 443 * 444 * FORWARD DECLARATIONS 445 */ 446typedef struct _fluid_defsfont_t fluid_defsfont_t; 447typedef struct _fluid_defpreset_t fluid_defpreset_t; 448typedef struct _fluid_preset_zone_t fluid_preset_zone_t; 449typedef struct _fluid_inst_t fluid_inst_t; 450typedef struct _fluid_inst_zone_t fluid_inst_zone_t; 451 452/* 453 454 Public interface 455 456 */ 457 458fluid_sfloader_t* new_fluid_defsfloader(void); 459int delete_fluid_defsfloader(fluid_sfloader_t* loader); 460fluid_sfont_t* fluid_defsfloader_load(fluid_sfloader_t* loader, const char* filename); 461 462 463int fluid_defsfont_sfont_delete(fluid_sfont_t* sfont); 464char* fluid_defsfont_sfont_get_name(fluid_sfont_t* sfont); 465fluid_preset_t* fluid_defsfont_sfont_get_preset(fluid_sfont_t* sfont, unsigned int bank, unsigned int prenum); 466void fluid_defsfont_sfont_iteration_start(fluid_sfont_t* sfont); 467int fluid_defsfont_sfont_iteration_next(fluid_sfont_t* sfont, fluid_preset_t* preset); 468 469 470int fluid_defpreset_preset_delete(fluid_preset_t* preset); 471char* fluid_defpreset_preset_get_name(fluid_preset_t* preset); 472int fluid_defpreset_preset_get_banknum(fluid_preset_t* preset); 473int fluid_defpreset_preset_get_num(fluid_preset_t* preset); 474int fluid_defpreset_preset_noteon(fluid_preset_t* preset, fluid_synth_t* synth, int chan, int key, int vel); 475 476 477/* 478 * fluid_defsfont_t 479 */ 480struct _fluid_defsfont_t 481{ 482 char* filename; /* the filename of this soundfont */ 483 unsigned int samplepos; /* the position in the file at which the sample data starts */ 484 unsigned int samplesize; /* the size of the sample data */ 485 short* sampledata; /* the sample data, loaded in ram */ 486 fluid_list_t* sample; /* the samples in this soundfont */ 487 fluid_defpreset_t* preset; /* the presets of this soundfont */ 488 489 fluid_preset_t iter_preset; /* preset interface used in the iteration */ 490 fluid_defpreset_t* iter_cur; /* the current preset in the iteration */ 491}; 492 493 494fluid_defsfont_t* new_fluid_defsfont(void); 495int delete_fluid_defsfont(fluid_defsfont_t* sfont); 496int fluid_defsfont_load(fluid_defsfont_t* sfont, const char* file); 497char* fluid_defsfont_get_name(fluid_defsfont_t* sfont); 498fluid_defpreset_t* fluid_defsfont_get_preset(fluid_defsfont_t* sfont, unsigned int bank, unsigned int prenum); 499void fluid_defsfont_iteration_start(fluid_defsfont_t* sfont); 500int fluid_defsfont_iteration_next(fluid_defsfont_t* sfont, fluid_preset_t* preset); 501int fluid_defsfont_load_sampledata(fluid_defsfont_t* sfont); 502int fluid_defsfont_add_sample(fluid_defsfont_t* sfont, fluid_sample_t* sample); 503int fluid_defsfont_add_preset(fluid_defsfont_t* sfont, fluid_defpreset_t* preset); 504fluid_sample_t* fluid_defsfont_get_sample(fluid_defsfont_t* sfont, char *s); 505 506 507/* 508 * fluid_preset_t 509 */ 510struct _fluid_defpreset_t 511{ 512 fluid_defpreset_t* next; 513 fluid_defsfont_t* sfont; /* the soundfont this preset belongs to */ 514 char name[21]; /* the name of the preset */ 515 unsigned int bank; /* the bank number */ 516 unsigned int num; /* the preset number */ 517 fluid_preset_zone_t* global_zone; /* the global zone of the preset */ 518 fluid_preset_zone_t* zone; /* the chained list of preset zones */ 519}; 520 521fluid_defpreset_t* new_fluid_defpreset(fluid_defsfont_t* sfont); 522int delete_fluid_defpreset(fluid_defpreset_t* preset); 523fluid_defpreset_t* fluid_defpreset_next(fluid_defpreset_t* preset); 524int fluid_defpreset_import_sfont(fluid_defpreset_t* preset, SFPreset* sfpreset, fluid_defsfont_t* sfont); 525int fluid_defpreset_set_global_zone(fluid_defpreset_t* preset, fluid_preset_zone_t* zone); 526int fluid_defpreset_add_zone(fluid_defpreset_t* preset, fluid_preset_zone_t* zone); 527fluid_preset_zone_t* fluid_defpreset_get_zone(fluid_defpreset_t* preset); 528fluid_preset_zone_t* fluid_defpreset_get_global_zone(fluid_defpreset_t* preset); 529int fluid_defpreset_get_banknum(fluid_defpreset_t* preset); 530int fluid_defpreset_get_num(fluid_defpreset_t* preset); 531char* fluid_defpreset_get_name(fluid_defpreset_t* preset); 532int fluid_defpreset_noteon(fluid_defpreset_t* preset, fluid_synth_t* synth, int chan, int key, int vel); 533 534/* 535 * fluid_preset_zone 536 */ 537struct _fluid_preset_zone_t 538{ 539 fluid_preset_zone_t* next; 540 char* name; 541 fluid_inst_t* inst; 542 int keylo; 543 int keyhi; 544 int vello; 545 int velhi; 546 fluid_gen_t gen[GEN_LAST]; 547 fluid_mod_t * mod; /* List of modulators */ 548}; 549 550fluid_preset_zone_t* new_fluid_preset_zone(char* name); 551int delete_fluid_preset_zone(fluid_preset_zone_t* zone); 552fluid_preset_zone_t* fluid_preset_zone_next(fluid_preset_zone_t* preset); 553int fluid_preset_zone_import_sfont(fluid_preset_zone_t* zone, SFZone* sfzone, fluid_defsfont_t* sfont); 554int fluid_preset_zone_inside_range(fluid_preset_zone_t* zone, int key, int vel); 555fluid_inst_t* fluid_preset_zone_get_inst(fluid_preset_zone_t* zone); 556 557/* 558 * fluid_inst_t 559 */ 560struct _fluid_inst_t 561{ 562 char name[21]; 563 fluid_inst_zone_t* global_zone; 564 fluid_inst_zone_t* zone; 565}; 566 567fluid_inst_t* new_fluid_inst(void); 568int delete_fluid_inst(fluid_inst_t* inst); 569int fluid_inst_import_sfont(fluid_inst_t* inst, SFInst *sfinst, fluid_defsfont_t* sfont); 570int fluid_inst_set_global_zone(fluid_inst_t* inst, fluid_inst_zone_t* zone); 571int fluid_inst_add_zone(fluid_inst_t* inst, fluid_inst_zone_t* zone); 572fluid_inst_zone_t* fluid_inst_get_zone(fluid_inst_t* inst); 573fluid_inst_zone_t* fluid_inst_get_global_zone(fluid_inst_t* inst); 574 575/* 576 * fluid_inst_zone_t 577 */ 578struct _fluid_inst_zone_t 579{ 580 fluid_inst_zone_t* next; 581 char* name; 582 fluid_sample_t* sample; 583 int keylo; 584 int keyhi; 585 int vello; 586 int velhi; 587 fluid_gen_t gen[GEN_LAST]; 588 fluid_mod_t * mod; /* List of modulators */ 589}; 590 591fluid_inst_zone_t* new_fluid_inst_zone(char* name); 592int delete_fluid_inst_zone(fluid_inst_zone_t* zone); 593fluid_inst_zone_t* fluid_inst_zone_next(fluid_inst_zone_t* zone); 594int fluid_inst_zone_import_sfont(fluid_inst_zone_t* zone, SFZone *sfzone, fluid_defsfont_t* sfont); 595int fluid_inst_zone_inside_range(fluid_inst_zone_t* zone, int key, int vel); 596fluid_sample_t* fluid_inst_zone_get_sample(fluid_inst_zone_t* zone); 597 598 599 600fluid_sample_t* new_fluid_sample(void); 601int delete_fluid_sample(fluid_sample_t* sample); 602int fluid_sample_import_sfont(fluid_sample_t* sample, SFSample* sfsample, fluid_defsfont_t* sfont); 603int fluid_sample_in_rom(fluid_sample_t* sample); 604 605 606#endif /* _FLUID_SFONT_H */ 607