1/* FluidSynth - A Software Synthesizer 2 * 3 * Copyright (C) 2003 Peter Hanappe and others. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public License 7 * as published by the Free Software Foundation; either version 2 of 8 * the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public 16 * License along with this library; if not, write to the Free 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18 * 02111-1307, USA 19 */ 20 21#ifndef _FLUIDSYNTH_RAMSFONT_H 22#define _FLUIDSYNTH_RAMSFONT_H 23 24#ifdef __cplusplus 25extern "C" { 26#endif 27 28 29/********************************************************************************/ 30/********************************************************************************/ 31/* ram soundfonts: 32 October 2002 - Antoine Schmitt 33 34 ram soundfonts live in ram. The samples are loaded from files 35 or from RAM. A minimal API manages a soundFont structure, 36 with presets, each preset having only one preset-zone, which 37 instrument has potentially many instrument-zones. No global 38 zones, and nor generator nor modulator other than the default 39 ones are permitted. This may be extensible in the future. 40*/ 41/********************************************************************************/ 42/********************************************************************************/ 43 44/* 45 We are not using the sfloader protocol, as we need more arguments 46 than what it provides. 47*/ 48 49/** Creates a fluid_sfont_t wrapping an fluid_ramsfont_t */ 50FLUIDSYNTH_API fluid_sfont_t* fluid_ramsfont_create_sfont(void); 51 52/*********************** 53 * ramsfont specific API 54 ***********************/ 55FLUIDSYNTH_API int fluid_ramsfont_set_name(fluid_ramsfont_t* sfont, char * name); 56 57/* Creates one instrument zone for the sample inside the preset defined 58 * by bank/num 59 * \returns 0 if success 60 */ 61FLUIDSYNTH_API 62int fluid_ramsfont_add_izone(fluid_ramsfont_t* sfont, 63 unsigned int bank, unsigned int num, fluid_sample_t* sample, 64 int lokey, int hikey); 65 66/* Removes the instrument zone corresponding to bank/num and to the sample 67 * \returns 0 if success 68 */ 69FLUIDSYNTH_API 70int fluid_ramsfont_remove_izone(fluid_ramsfont_t* sfont, 71 unsigned int bank, unsigned int num, fluid_sample_t* sample); 72 73/* Sets a generator on an instrument zone 74 * \returns 0 if success 75 */ 76FLUIDSYNTH_API 77int fluid_ramsfont_izone_set_gen(fluid_ramsfont_t* sfont, 78 unsigned int bank, unsigned int num, fluid_sample_t* sample, 79 int gen_type, float value); 80 81/* Utility : sets the loop start/end values 82 * \on = 0 or 1; if 0, loopstart and loopend are not used 83 * \loopstart and loopend are floats, in frames 84 * \loopstart is counted from frame 0 85 * \loopend is counted from the last frame, thus is < 0 86 * \returns 0 if success 87 */ 88FLUIDSYNTH_API 89int fluid_ramsfont_izone_set_loop(fluid_ramsfont_t* sfont, 90 unsigned int bank, unsigned int num, fluid_sample_t* sample, 91 int on, float loopstart, float loopend); 92 93/*************************************** 94 * sample_t specific API for ramsfont 95 ***************************************/ 96FLUIDSYNTH_API fluid_sample_t* new_fluid_ramsample(void); 97FLUIDSYNTH_API int delete_fluid_ramsample(fluid_sample_t* sample); 98FLUIDSYNTH_API int fluid_sample_set_name(fluid_sample_t* sample, char * name); 99 100/* Sets the sound data of the sample 101 * Warning : if copy_data is FALSE, data should have 8 unused frames at start 102 * and 8 unused frames at the end. 103 */ 104FLUIDSYNTH_API 105int fluid_sample_set_sound_data(fluid_sample_t* sample, short *data, 106 unsigned int nbframes, short copy_data, int rootkey); 107 108 109#ifdef __cplusplus 110} 111#endif 112 113#endif /* _FLUIDSYNTH_RAMSFONT_H */ 114