|
libfluidsynth 2.5.4
|
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 | |
| void | fluid_voice_add_mod (fluid_voice_t *voice, fluid_mod_t *mod, int mode) |
| Adds a modulator to the voice if the modulator has valid sources. | |
| float | fluid_voice_gen_get (fluid_voice_t *voice, int gen) |
| Get the value of a generator. | |
| void | fluid_voice_gen_incr (fluid_voice_t *voice, int gen, float val) |
| Offset the value of a generator. | |
| void | fluid_voice_gen_set (fluid_voice_t *voice, int gen, float val) |
| Set the value of a generator. | |
| int | fluid_voice_get_actual_key (const fluid_voice_t *voice) |
| Return the effective MIDI key of the playing voice. | |
| int | fluid_voice_get_actual_velocity (const fluid_voice_t *voice) |
| Return the effective MIDI velocity of the playing voice. | |
| int | fluid_voice_get_channel (const fluid_voice_t *voice) |
| Return the MIDI channel the voice is playing on. | |
| unsigned int | fluid_voice_get_id (const fluid_voice_t *voice) |
| Get the unique ID of the noteon-event. | |
| int | fluid_voice_get_key (const fluid_voice_t *voice) |
| Return the MIDI key from the starting noteon event. | |
| int | fluid_voice_get_velocity (const fluid_voice_t *voice) |
| Return the MIDI velocity from the starting noteon event. | |
| int | fluid_voice_is_on (const fluid_voice_t *voice) |
| Check if a voice is ON. | |
| int | fluid_voice_is_playing (const fluid_voice_t *voice) |
| Check if a voice is producing sound. | |
| int | fluid_voice_is_sostenuto (const fluid_voice_t *voice) |
| Check if a voice keeps playing after it has received a noteoff due to being held by sostenuto. | |
| int | fluid_voice_is_sustained (const fluid_voice_t *voice) |
| Check if a voice keeps playing after it has received a noteoff due to being held by sustain. | |
| int | fluid_voice_optimize_sample (fluid_sample_t *s) |
| Calculate the peak volume of a sample for voice off optimization. | |
| void | fluid_voice_update_param (fluid_voice_t *voice, int gen) |
| Update all the synthesis parameters which depend on generator gen. | |
Synthesis voice manipulation functions.
The interface to the synthesizer's voices. Examples on using them can be found in the source code of the default SoundFont loader (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.
| void fluid_voice_add_mod | ( | fluid_voice_t * | voice, |
| fluid_mod_t * | mod, | ||
| int | mode ) |
Adds a modulator to the voice if the modulator has valid sources.
| 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. |
| 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) |
| 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 |
| 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 |
| int fluid_voice_get_actual_key | ( | const fluid_voice_t * | voice | ) |
Return the effective MIDI key of the playing voice.
| voice | Voice instance |
If the voice was started from an instrument which uses a fixed key generator, it returns that. Otherwise returns the same value as fluid_voice_get_key.
| int fluid_voice_get_actual_velocity | ( | const fluid_voice_t * | voice | ) |
Return the effective MIDI velocity of the playing voice.
| voice | Voice instance |
If the voice was started from an instrument which uses a fixed velocity generator, it returns that. Otherwise it returns the same value as fluid_voice_get_velocity.
| int fluid_voice_get_channel | ( | const fluid_voice_t * | voice | ) |
Return the MIDI channel the voice is playing on.
| voice | Voice instance |
| unsigned int fluid_voice_get_id | ( | const fluid_voice_t * | voice | ) |
Get the unique ID of the noteon-event.
| voice | Voice instance |
A SoundFont loader may store pointers to voices it has created for realtime control during the operation of a voice (for example: parameter changes in SoundFont editor). The synth uses a pool of voices internally which are 'recycled' and never deallocated.
However, before modifying an existing voice, check
Otherwise the voice has finished playing.
| int fluid_voice_get_key | ( | const fluid_voice_t * | voice | ) |
Return the MIDI key from the starting noteon event.
| voice | Voice instance |
| int fluid_voice_get_velocity | ( | const fluid_voice_t * | voice | ) |
Return the MIDI velocity from the starting noteon event.
| voice | Voice instance |
| int fluid_voice_is_on | ( | const fluid_voice_t * | voice | ) |
Check if a voice is ON.
A voice is in ON state as soon as a call to fluid_synth_start_voice() has been made (which is typically done in a fluid_preset_t's noteon function). A voice stays ON as long as it has not received a noteoff event.
| voice | Voice instance |
| int fluid_voice_is_playing | ( | const fluid_voice_t * | voice | ) |
Check if a voice is producing sound.
Like fluid_voice_is_on() this will return TRUE once a call to fluid_synth_start_voice() has been made. Contrary to fluid_voice_is_on(), this might also return TRUE after the voice received a noteoff event, as it may still be playing in release phase, or because it has been sustained or sostenuto'ed.
| voice | Voice instance |
| int fluid_voice_is_sostenuto | ( | const fluid_voice_t * | voice | ) |
Check if a voice keeps playing after it has received a noteoff due to being held by sostenuto.
| voice | Voice instance |
| int fluid_voice_is_sustained | ( | const fluid_voice_t * | voice | ) |
Check if a voice keeps playing after it has received a noteoff due to being held by sustain.
| voice | Voice instance |
| 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.
| 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) |
Calling this function is only necessary after changing a generator of an already playing voice.