mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-10 06:51:54 +00:00
replace fluid_synth_set_gen with fluid_synth_set_gen2
This commit is contained in:
parent
c36a1a6c09
commit
24143ee02d
2 changed files with 22 additions and 42 deletions
|
@ -208,9 +208,7 @@ enum fluid_interp {
|
|||
|
||||
/* Generator interface */
|
||||
|
||||
FLUIDSYNTH_API
|
||||
int fluid_synth_set_gen(fluid_synth_t* synth, int chan, int param, float value);
|
||||
FLUIDSYNTH_API int fluid_synth_set_gen2 (fluid_synth_t* synth, int chan,
|
||||
FLUIDSYNTH_API int fluid_synth_set_gen (fluid_synth_t* synth, int chan,
|
||||
int param, float value,
|
||||
int absolute, int normalized);
|
||||
FLUIDSYNTH_API float fluid_synth_get_gen(fluid_synth_t* synth, int chan, int param);
|
||||
|
|
|
@ -4690,24 +4690,40 @@ fluid_synth_get_settings(fluid_synth_t* synth)
|
|||
return synth->settings;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a SoundFont generator (effect) value on a MIDI channel in real-time.
|
||||
* @param synth FluidSynth instance
|
||||
* @param chan MIDI channel number (0 to MIDI channel count - 1)
|
||||
* @param param SoundFont generator ID (#fluid_gen_type)
|
||||
* @param value Offset generator value to assign to the MIDI channel
|
||||
* @param value Offset or absolute generator value to assign to the MIDI channel
|
||||
* @param absolute FALSE to assign a relative value, TRUE to assign an absolute value
|
||||
* @param normalized FALSE if value is specified in the native units of the generator,
|
||||
* TRUE to take the value as a 0.0-1.0 range and apply it to the valid
|
||||
* generator effect range (scaled and shifted as necessary).
|
||||
* @return FLUID_OK on success, FLUID_FAILED otherwise
|
||||
* @since @NEXT_RELEASE@
|
||||
*
|
||||
* Parameter numbers and ranges are described in the SoundFont 2.01
|
||||
* specification PDF, paragraph 8.1.3, page 48. See #fluid_gen_type.
|
||||
* This function allows for setting all effect parameters in real time on a
|
||||
* MIDI channel. Setting absolute to non-zero will cause the value to override
|
||||
* any generator values set in the instruments played on the MIDI channel.
|
||||
* See SoundFont 2.01 spec, paragraph 8.1.3, page 48 for details on SoundFont
|
||||
* generator parameters and valid ranges.
|
||||
*
|
||||
* @note The old behaviour of fluid_synth_set_gen() assumed \c absolute and \c normalized to
|
||||
* be FALSE.
|
||||
*/
|
||||
int
|
||||
fluid_synth_set_gen(fluid_synth_t* synth, int chan, int param, float value)
|
||||
fluid_synth_set_gen(fluid_synth_t* synth, int chan, int param,
|
||||
float value, int absolute, int normalized)
|
||||
{
|
||||
float v;
|
||||
fluid_return_val_if_fail (param >= 0 && param < GEN_LAST, FLUID_FAILED);
|
||||
FLUID_API_ENTRY_CHAN(FLUID_FAILED);
|
||||
|
||||
fluid_synth_set_gen_LOCAL (synth, chan, param, value, FALSE);
|
||||
v = normalized ? fluid_gen_scale(param, value) : value;
|
||||
|
||||
fluid_synth_set_gen_LOCAL (synth, chan, param, v, absolute);
|
||||
|
||||
FLUID_API_RETURN(FLUID_OK);
|
||||
}
|
||||
|
@ -4730,40 +4746,6 @@ fluid_synth_set_gen_LOCAL (fluid_synth_t* synth, int chan, int param, float valu
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a SoundFont generator (effect) value on a MIDI channel in real-time.
|
||||
* @param synth FluidSynth instance
|
||||
* @param chan MIDI channel number (0 to MIDI channel count - 1)
|
||||
* @param param SoundFont generator ID (#fluid_gen_type)
|
||||
* @param value Offset or absolute generator value to assign to the MIDI channel
|
||||
* @param absolute 0 to assign a relative value, non-zero to assign an absolute value
|
||||
* @param normalized 0 if value is specified in the native units of the generator,
|
||||
* non-zero to take the value as a 0.0-1.0 range and apply it to the valid
|
||||
* generator effect range (scaled and shifted as necessary).
|
||||
* @return FLUID_OK on success, FLUID_FAILED otherwise
|
||||
* @since 1.1.0
|
||||
*
|
||||
* This function allows for setting all effect parameters in real time on a
|
||||
* MIDI channel. Setting absolute to non-zero will cause the value to override
|
||||
* any generator values set in the instruments played on the MIDI channel.
|
||||
* See SoundFont 2.01 spec, paragraph 8.1.3, page 48 for details on SoundFont
|
||||
* generator parameters and valid ranges.
|
||||
*/
|
||||
int
|
||||
fluid_synth_set_gen2(fluid_synth_t* synth, int chan, int param,
|
||||
float value, int absolute, int normalized)
|
||||
{
|
||||
float v;
|
||||
fluid_return_val_if_fail (param >= 0 && param < GEN_LAST, FLUID_FAILED);
|
||||
FLUID_API_ENTRY_CHAN(FLUID_FAILED);
|
||||
|
||||
v = normalized ? fluid_gen_scale(param, value) : value;
|
||||
|
||||
fluid_synth_set_gen_LOCAL (synth, chan, param, v, absolute);
|
||||
|
||||
FLUID_API_RETURN(FLUID_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get generator value assigned to a MIDI channel.
|
||||
* @param synth FluidSynth instance
|
||||
|
|
Loading…
Reference in a new issue