Synthesis voice manipulation functions. More...
Enumerations | |
enum | fluid_voice_add_mod { FLUID_VOICE_OVERWRITE, FLUID_VOICE_ADD, FLUID_VOICE_DEFAULT } |
Enum used with fluid_voice_add_mod() to specify how to handle duplicate modulators. More... | |
Functions | |
FLUIDSYNTH_API void | fluid_voice_update_param (fluid_voice_t *voice, int gen) |
Update all the synthesis parameters, which depend on generator gen. | |
FLUIDSYNTH_API void | fluid_voice_add_mod (fluid_voice_t *voice, fluid_mod_t *mod, int mode) |
Adds a modulator to the voice. | |
FLUIDSYNTH_API void | fluid_voice_gen_set (fluid_voice_t *voice, int gen, float val) |
Set the value of a generator. | |
FLUIDSYNTH_API float | fluid_voice_gen_get (fluid_voice_t *voice, int gen) |
Get the value of a generator. | |
FLUIDSYNTH_API void | fluid_voice_gen_incr (fluid_voice_t *voice, int gen, float val) |
Offset the value of a generator. | |
FLUIDSYNTH_API unsigned int | fluid_voice_get_id (fluid_voice_t *voice) |
Get the unique ID of the noteon-event. | |
FLUIDSYNTH_API int | fluid_voice_is_playing (fluid_voice_t *voice) |
Check if a voice is still playing. | |
FLUIDSYNTH_API int | fluid_voice_optimize_sample (fluid_sample_t *s) |
Calculate the peak volume of a sample for voice off optimization. |
Synthesis voice manipulation functions.
The interface to the synthesizer's voices. Examples on using them can be found in fluid_defsfont.c. Most of these functions should only be called from within synthesis context, such as the SoundFont loader's noteon method.
enum fluid_voice_add_mod |
Enum used with fluid_voice_add_mod() to specify how to handle duplicate modulators.
FLUIDSYNTH_API void fluid_voice_update_param | ( | fluid_voice_t * | voice, | |
int | gen | |||
) |
Update all the synthesis parameters, which depend on generator gen.
voice | Voice instance | |
gen | Generator id (fluid_gen_type) |
This is only necessary after changing a generator of an already operating voice. Most applications will not need this function.
References fluid_voice_update_param(), GEN_ATTENUATION, GEN_CHORUSSEND, GEN_COARSETUNE, GEN_ENDADDRCOARSEOFS, GEN_ENDADDROFS, GEN_ENDLOOPADDRCOARSEOFS, GEN_ENDLOOPADDROFS, GEN_FILTERFC, GEN_FILTERQ, GEN_FINETUNE, GEN_KEYNUM, GEN_KEYTOMODENVDECAY, GEN_KEYTOMODENVHOLD, GEN_KEYTOVOLENVDECAY, GEN_KEYTOVOLENVHOLD, GEN_MODENVATTACK, GEN_MODENVDECAY, GEN_MODENVDELAY, GEN_MODENVHOLD, GEN_MODENVRELEASE, GEN_MODENVSUSTAIN, GEN_MODENVTOFILTERFC, GEN_MODENVTOPITCH, GEN_MODLFODELAY, GEN_MODLFOFREQ, GEN_MODLFOTOFILTERFC, GEN_MODLFOTOPITCH, GEN_MODLFOTOVOL, GEN_OVERRIDEROOTKEY, GEN_PAN, GEN_PITCH, GEN_REVERBSEND, GEN_STARTADDRCOARSEOFS, GEN_STARTADDROFS, GEN_STARTLOOPADDRCOARSEOFS, GEN_STARTLOOPADDROFS, GEN_VELOCITY, GEN_VIBLFODELAY, GEN_VIBLFOFREQ, GEN_VIBLFOTOPITCH, GEN_VOLENVATTACK, GEN_VOLENVDECAY, GEN_VOLENVDELAY, GEN_VOLENVHOLD, GEN_VOLENVRELEASE, and GEN_VOLENVSUSTAIN.
Referenced by fluid_voice_update_param().
FLUIDSYNTH_API void fluid_voice_add_mod | ( | fluid_voice_t * | voice, | |
fluid_mod_t * | mod, | |||
int | mode | |||
) |
Adds a modulator to the voice.
voice | Voice instance | |
mod | Modulator info (copied) | |
mode | Determines how to handle an existing identical modulator FLUID_VOICE_ADD to add (offset) the modulator amounts, FLUID_VOICE_OVERWRITE to replace the modulator, FLUID_VOICE_DEFAULT when adding a default modulator - no duplicate should exist so don't check. |
References _fluid_mod_t::amount, _fluid_mod_t::flags1, FLUID_MOD_CC, fluid_mod_test_identity(), FLUID_NUM_MOD, FLUID_VOICE_ADD, FLUID_VOICE_OVERWRITE, FLUID_WARN, and _fluid_mod_t::src1.
FLUIDSYNTH_API void fluid_voice_gen_set | ( | fluid_voice_t * | voice, | |
int | i, | |||
float | val | |||
) |
Set the value of a generator.
voice | Voice instance | |
i | Generator ID (fluid_gen_type) | |
val | Generator value |
References fluid_voice_gen_set(), GEN_SAMPLEMODE, and GEN_SET.
Referenced by fluid_voice_gen_set().
FLUIDSYNTH_API float fluid_voice_gen_get | ( | fluid_voice_t * | voice, | |
int | gen | |||
) |
Get the value of a generator.
voice | Voice instance | |
gen | Generator ID (fluid_gen_type) |
References fluid_voice_gen_get().
Referenced by fluid_voice_gen_get().
FLUIDSYNTH_API void fluid_voice_gen_incr | ( | fluid_voice_t * | voice, | |
int | i, | |||
float | val | |||
) |
Offset the value of a generator.
voice | Voice instance | |
i | Generator ID (fluid_gen_type) | |
val | Value to add to the existing value |
References fluid_voice_gen_incr(), and GEN_SET.
Referenced by fluid_voice_gen_incr().
FLUIDSYNTH_API unsigned int fluid_voice_get_id | ( | fluid_voice_t * | voice | ) |
Get the unique ID of the noteon-event.
voice | Voice instance |
A SoundFont loader may store the voice processes it has created for real-time control during the operation of a voice (for example: parameter changes in SoundFont editor). The synth uses a pool of voices, which are 'recycled' and never deallocated.
Before modifying an existing voice, check
Otherwise the voice has finished playing.
References fluid_voice_get_id().
Referenced by fluid_voice_get_id().
FLUIDSYNTH_API int fluid_voice_is_playing | ( | fluid_voice_t * | voice | ) |
Check if a voice is still playing.
voice | Voice instance |
References fluid_voice_is_playing().
Referenced by delete_fluid_synth(), and fluid_voice_is_playing().
FLUIDSYNTH_API int fluid_voice_optimize_sample | ( | fluid_sample_t * | s | ) |
Calculate the peak volume of a sample for voice off optimization.
s | Sample to optimize |
If the peak volume during the loop is known, then the voice can be released earlier during the release phase. Otherwise, the voice will operate (inaudibly), until the envelope is at the nominal turnoff point. So it's a good idea to call fluid_voice_optimize_sample() on each sample once.
References _fluid_sample_t::amplitude_that_reaches_noise_floor, _fluid_sample_t::amplitude_that_reaches_noise_floor_is_valid, _fluid_sample_t::data, FLUID_OK, fluid_voice_optimize_sample(), _fluid_sample_t::loopend, _fluid_sample_t::loopstart, and _fluid_sample_t::valid.
Referenced by fluid_voice_optimize_sample().