ramsfont.h File Reference

API for creating and managing SoundFont instruments in RAM. More...

Functions

FLUIDSYNTH_API fluid_sfont_tfluid_ramsfont_create_sfont (void)
 Create a fluid_sfont_t wrapping a fluid_ramsfont_t.
FLUIDSYNTH_API int fluid_ramsfont_set_name (fluid_ramsfont_t *sfont, const char *name)
 Set a RAM SoundFont name.
FLUIDSYNTH_API int fluid_ramsfont_add_izone (fluid_ramsfont_t *sfont, unsigned int bank, unsigned int num, fluid_sample_t *sample, int lokey, int hikey)
 Creates one instrument zone for the sample inside the preset defined by bank and num.
FLUIDSYNTH_API int fluid_ramsfont_remove_izone (fluid_ramsfont_t *sfont, unsigned int bank, unsigned int num, fluid_sample_t *sample)
 Removes the instrument zone corresponding to bank, num and sample.
FLUIDSYNTH_API int fluid_ramsfont_izone_set_gen (fluid_ramsfont_t *sfont, unsigned int bank, unsigned int num, fluid_sample_t *sample, int gen_type, float value)
 Sets a generator on an instrument zone identified by bank, num and sample.
FLUIDSYNTH_API int fluid_ramsfont_izone_set_loop (fluid_ramsfont_t *sfont, unsigned int bank, unsigned int num, fluid_sample_t *sample, int on, float loopstart, float loopend)
 Sets loop start/end values of the instrument zone identified by bank, num and sample.
FLUIDSYNTH_API fluid_sample_tnew_fluid_ramsample (void)
 Create new RAM SoundFont sample.
FLUIDSYNTH_API int delete_fluid_ramsample (fluid_sample_t *sample)
 Delete a RAM SoundFont sample.
FLUIDSYNTH_API int fluid_sample_set_name (fluid_sample_t *sample, const char *name)
 Set the name of a RAM SoundFont sample.
FLUIDSYNTH_API int fluid_sample_set_sound_data (fluid_sample_t *sample, short *data, unsigned int nbframes, short copy_data, int rootkey)
 Assign sample data to a RAM SoundFont sample.

Detailed Description

API for creating and managing SoundFont instruments in RAM.

RAM SoundFonts live in ram. The samples are loaded from files or from RAM. A minimal API manages a soundFont structure, with presets, each preset having only one preset-zone, which instrument has potentially many instrument-zones. No global zones, and nor generator nor modulator other than the default ones are permitted. This may be extensible in the future.


Function Documentation

FLUIDSYNTH_API fluid_sfont_t* fluid_ramsfont_create_sfont ( void   ) 

Create a fluid_sfont_t wrapping a fluid_ramsfont_t.

Returns:
New fluid_sfont_t or NULL if out of memory
FLUIDSYNTH_API int fluid_ramsfont_set_name ( fluid_ramsfont_t sfont,
const char *  name 
)

Set a RAM SoundFont name.

Parameters:
sfont RAM SoundFont
Parameters:
name Name to assign (should be 20 chars in length with a NULL terminator)
Returns:
FLUID_OK
FLUIDSYNTH_API int fluid_ramsfont_add_izone ( fluid_ramsfont_t sfont,
unsigned int  bank,
unsigned int  num,
fluid_sample_t sample,
int  lokey,
int  hikey 
)

Creates one instrument zone for the sample inside the preset defined by bank and num.

Parameters:
sfont RAM SoundFont
Parameters:
bank Preset bank number
Parameters:
num Preset program number
Parameters:
sample Sample to use for instrument zone
Parameters:
lokey Lower MIDI key range of zone (0-127, <= hikey)
Parameters:
hikey Upper MIDI key range of zone (0-127, >= lokey)
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
FLUIDSYNTH_API int fluid_ramsfont_remove_izone ( fluid_ramsfont_t sfont,
unsigned int  bank,
unsigned int  num,
fluid_sample_t sample 
)

Removes the instrument zone corresponding to bank, num and sample.

Parameters:
sfont RAM SoundFont
Parameters:
bank Preset bank number
Parameters:
num Preset program number
Parameters:
sample Sample of the preset zone
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
FLUIDSYNTH_API int fluid_ramsfont_izone_set_gen ( fluid_ramsfont_t sfont,
unsigned int  bank,
unsigned int  num,
fluid_sample_t sample,
int  gen_type,
float  value 
)

Sets a generator on an instrument zone identified by bank, num and sample.

Parameters:
sfont RAM SoundFont
Parameters:
bank Preset bank number
Parameters:
num Preset program number
Parameters:
sample Sample of the instrument zone.
Parameters:
gen_type Generator ID (fluid_gen_type)
Parameters:
value Generator value
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
FLUIDSYNTH_API int fluid_ramsfont_izone_set_loop ( fluid_ramsfont_t sfont,
unsigned int  bank,
unsigned int  num,
fluid_sample_t sample,
int  on,
float  loopstart,
float  loopend 
)

Sets loop start/end values of the instrument zone identified by bank, num and sample.

Parameters:
sfont RAM SoundFont
Parameters:
bank Preset bank number
Parameters:
num Preset program number
Parameters:
sample Sample of the instrument zone
Parameters:
on TRUE to enable looping, FALSE for one shot (loopstart and loopend not used)
Parameters:
loopstart Loop start, in frames (counted from 0)
Parameters:
loopend Loop end, in frames (counted from last frame, thus is < 0)
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
FLUIDSYNTH_API fluid_sample_t* new_fluid_ramsample ( void   ) 

Create new RAM SoundFont sample.

Returns:
New RAM SoundFont sample or NULL if out of memory
FLUIDSYNTH_API int delete_fluid_ramsample ( fluid_sample_t sample  ) 

Delete a RAM SoundFont sample.

Parameters:
sample Sample to delete
Returns:
FLUID_OK
FLUIDSYNTH_API int fluid_sample_set_name ( fluid_sample_t sample,
const char *  name 
)

Set the name of a RAM SoundFont sample.

Parameters:
sample RAM SoundFont sample
Parameters:
name Name to assign to sample (20 chars in length, 0 terminated)
Returns:
FLUID_OK
FLUIDSYNTH_API int fluid_sample_set_sound_data ( fluid_sample_t sample,
short *  data,
unsigned int  nbframes,
short  copy_data,
int  rootkey 
)

Assign sample data to a RAM SoundFont sample.

Parameters:
sample RAM SoundFont sample
Parameters:
data Buffer containing 16 bit audio sample data
Parameters:
nbframes Number of samples in data
Parameters:
copy_data TRUE to copy the data, FALSE to use it directly
Parameters:
rootkey Root MIDI note of sample (0-127)
Returns:
FLUID_OK on success, FLUID_FAILED otherwise
WARNING: If copy_data is FALSE, data should have 8 unused frames at start and 8 unused frames at the end.
Generated on Tue Sep 27 17:27:11 2011 for libfluidsynth by  doxygen 1.6.3