libfluidsynth
1.1.11
|
API for creating and managing SoundFont instruments in RAM. More...
Functions | |
FLUIDSYNTH_API fluid_sfont_t * | fluid_ramsfont_create_sfont (void) |
Create a fluid_sfont_t wrapping a fluid_ramsfont_t. More... | |
FLUIDSYNTH_API int | fluid_ramsfont_set_name (fluid_ramsfont_t *sfont, const char *name) |
Set a RAM SoundFont name. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
FLUIDSYNTH_API fluid_sample_t * | new_fluid_ramsample (void) |
Create new RAM SoundFont sample. More... | |
FLUIDSYNTH_API int | delete_fluid_ramsample (fluid_sample_t *sample) |
Delete a RAM SoundFont sample. More... | |
FLUIDSYNTH_API int | fluid_sample_set_name (fluid_sample_t *sample, const char *name) |
Set the name of a RAM SoundFont sample. More... | |
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. More... | |
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.
FLUIDSYNTH_API fluid_sfont_t* fluid_ramsfont_create_sfont | ( | void | ) |
Create a fluid_sfont_t wrapping a fluid_ramsfont_t.
References _fluid_sfont_t::data, _fluid_preset_t::data, delete_fluid_ramsample(), FLUID_ERR, FLUID_OK, fluid_sample_refcount, _fluid_sfont_t::free, _fluid_preset_t::free, _fluid_preset_t::get_banknum, _fluid_sfont_t::get_name, _fluid_preset_t::get_name, _fluid_preset_t::get_num, _fluid_sfont_t::get_preset, _fluid_sfont_t::iteration_next, _fluid_sfont_t::iteration_start, _fluid_preset_t::noteon, _fluid_preset_t::notify, and _fluid_preset_t::sfont.
FLUIDSYNTH_API int fluid_ramsfont_set_name | ( | fluid_ramsfont_t * | sfont, |
const char * | 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.
sfont | RAM SoundFont |
bank | Preset bank number |
num | Preset program number |
sample | Sample to use for instrument zone |
lokey | Lower MIDI key range of zone (0-127, <= hikey) |
hikey | Upper MIDI key range of zone (0-127, >= lokey) |
References FLUID_FAILED, and FLUID_OK.
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.
sfont | RAM SoundFont |
bank | Preset bank number |
num | Preset program number |
sample | Sample of the preset zone |
References FLUID_FAILED, and FLUID_OK.
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.
sfont | RAM SoundFont |
bank | Preset bank number |
num | Preset program number |
sample | Sample of the instrument zone. |
gen_type | Generator ID (fluid_gen_type) |
value | Generator value |
References FLUID_FAILED.
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.
sfont | RAM SoundFont |
bank | Preset bank number |
num | Preset program number |
sample | Sample of the instrument zone |
on | TRUE to enable looping, FALSE for one shot (loopstart and loopend not used) |
loopstart | Loop start, in frames (counted from 0) |
loopend | Loop end, in frames (counted from last frame, thus is < 0) |
References _fluid_mod_t::amount, _fluid_preset_t::data, FLUID_ERR, FLUID_FAILED, fluid_mod_test_identity(), FLUID_NUM_MOD, FLUID_OK, fluid_synth_alloc_voice(), fluid_synth_start_voice(), FLUID_VOICE_ADD, fluid_voice_gen_incr(), fluid_voice_gen_set(), fluid_voice_get_id(), fluid_voice_is_playing(), FLUID_VOICE_OVERWRITE, fluid_voice_update_param(), GEN_ENDADDRCOARSEOFS, GEN_ENDADDROFS, GEN_ENDLOOPADDRCOARSEOFS, GEN_ENDLOOPADDROFS, GEN_EXCLUSIVECLASS, GEN_KEYNUM, GEN_LAST, GEN_OVERRIDEROOTKEY, GEN_SAMPLEMODE, GEN_SET, GEN_STARTADDRCOARSEOFS, GEN_STARTADDROFS, GEN_STARTLOOPADDRCOARSEOFS, GEN_STARTLOOPADDROFS, GEN_UNUSED, GEN_VELOCITY, and _fluid_sample_t::name.
FLUIDSYNTH_API fluid_sample_t* new_fluid_ramsample | ( | void | ) |
Create new RAM SoundFont sample.
References FLUID_ERR.
FLUIDSYNTH_API int delete_fluid_ramsample | ( | fluid_sample_t * | sample | ) |
Delete a RAM SoundFont sample.
sample | Sample to delete |
References _fluid_sample_t::data, and FLUID_OK.
Referenced by fluid_ramsfont_create_sfont().
FLUIDSYNTH_API int fluid_sample_set_name | ( | fluid_sample_t * | sample, |
const char * | name | ||
) |
Set the name of a RAM SoundFont sample.
sample | RAM SoundFont sample |
name | Name to assign to sample (20 chars in length, 0 terminated) |
References FLUID_OK, and _fluid_sample_t::name.
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.
sample | RAM SoundFont sample |
data | Buffer containing 16 bit audio sample data |
nbframes | Number of samples in data |
copy_data | TRUE to copy the data, FALSE to use it directly |
rootkey | Root MIDI note of sample (0-127) |
WARNING: If copy_data is FALSE, data should have 8 unused frames at start and 8 unused frames at the end.
References _fluid_sample_t::data, _fluid_sample_t::end, FLUID_ERR, FLUID_FAILED, FLUID_OK, FLUID_SAMPLETYPE_MONO, _fluid_sample_t::loopend, _fluid_sample_t::loopstart, _fluid_sample_t::origpitch, _fluid_sample_t::pitchadj, _fluid_sample_t::samplerate, _fluid_sample_t::sampletype, _fluid_sample_t::start, and _fluid_sample_t::valid.