mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-04-19 06:02:03 +00:00
add individual reverb setters to synth API
This commit is contained in:
parent
17aacf4fd9
commit
77749637d2
2 changed files with 50 additions and 8 deletions
|
@ -146,10 +146,12 @@ FLUIDSYNTH_API int fluid_synth_get_bank_offset(fluid_synth_t* synth, int sfont_i
|
|||
*/
|
||||
|
||||
/** Set the parameters for the built-in reverb unit */
|
||||
FLUIDSYNTH_API void fluid_synth_set_reverb_roomsize(fluid_synth_t* synth, double roomsize);
|
||||
FLUIDSYNTH_API void fluid_synth_set_reverb_damp(fluid_synth_t* synth, double damping);
|
||||
FLUIDSYNTH_API void fluid_synth_set_reverb_width(fluid_synth_t* synth, double width);
|
||||
FLUIDSYNTH_API void fluid_synth_set_reverb_level(fluid_synth_t* synth, double level);
|
||||
FLUIDSYNTH_API int fluid_synth_set_reverb(fluid_synth_t* synth, double roomsize,
|
||||
double damping, double width, double level);
|
||||
FLUIDSYNTH_API int fluid_synth_set_reverb_roomsize(fluid_synth_t* synth, double roomsize);
|
||||
FLUIDSYNTH_API int fluid_synth_set_reverb_damp(fluid_synth_t* synth, double damping);
|
||||
FLUIDSYNTH_API int fluid_synth_set_reverb_width(fluid_synth_t* synth, double width);
|
||||
FLUIDSYNTH_API int fluid_synth_set_reverb_level(fluid_synth_t* synth, double level);
|
||||
|
||||
/** Turn on (1) / off (0) the built-in reverb unit */
|
||||
FLUIDSYNTH_API void fluid_synth_set_reverb_on(fluid_synth_t* synth, int on);
|
||||
|
|
|
@ -3842,18 +3842,55 @@ fluid_synth_set_reverb_preset(fluid_synth_t* synth, int num)
|
|||
* @param damping Reverb damping value (0.0-1.0)
|
||||
* @param width Reverb width value (0.0-100.0)
|
||||
* @param level Reverb level value (0.0-1.0)
|
||||
* @return FLUID_OK on success, FLUID_FAILED otherwise
|
||||
*
|
||||
* @note Not realtime safe and therefore should not be called from synthesis
|
||||
* context at the risk of stalling audio output.
|
||||
*/
|
||||
void
|
||||
int
|
||||
fluid_synth_set_reverb(fluid_synth_t* synth, double roomsize, double damping,
|
||||
double width, double level)
|
||||
{
|
||||
fluid_synth_set_reverb_full (synth, FLUID_REVMODEL_SET_ALL,
|
||||
return fluid_synth_set_reverb_full (synth, FLUID_REVMODEL_SET_ALL,
|
||||
roomsize, damping, width, level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set reverb roomsize. See fluid_synth_set_reverb() for further info.
|
||||
* @return FLUID_OK on success, FLUID_FAILED otherwise
|
||||
*/
|
||||
int fluid_synth_set_reverb_roomsize(fluid_synth_t* synth, double roomsize)
|
||||
{
|
||||
return fluid_synth_set_reverb_full(synth, FLUID_REVMODEL_SET_ROOMSIZE, roomsize, 0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set reverb damping. See fluid_synth_set_reverb() for further info.
|
||||
* @return FLUID_OK on success, FLUID_FAILED otherwise
|
||||
*/
|
||||
int fluid_synth_set_reverb_damp(fluid_synth_t* synth, double damping)
|
||||
{
|
||||
return fluid_synth_set_reverb_full(synth, FLUID_REVMODEL_SET_DAMPING, 0, damping, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set reverb width. See fluid_synth_set_reverb() for further info.
|
||||
* @return FLUID_OK on success, FLUID_FAILED otherwise
|
||||
*/
|
||||
int fluid_synth_set_reverb_width(fluid_synth_t* synth, double width)
|
||||
{
|
||||
return fluid_synth_set_reverb_full(synth, FLUID_REVMODEL_SET_WIDTH, 0, 0, width, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set reverb level. See fluid_synth_set_reverb() for further info.
|
||||
* @return FLUID_OK on success, FLUID_FAILED otherwise
|
||||
*/
|
||||
int fluid_synth_set_reverb_level(fluid_synth_t* synth, double level)
|
||||
{
|
||||
return fluid_synth_set_reverb_full(synth, FLUID_REVMODEL_SET_LEVEL, 0, 0, 0, level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set one or more reverb parameters.
|
||||
* @param synth FluidSynth instance
|
||||
|
@ -3871,6 +3908,8 @@ int
|
|||
fluid_synth_set_reverb_full(fluid_synth_t* synth, int set, double roomsize,
|
||||
double damping, double width, double level)
|
||||
{
|
||||
int ret;
|
||||
|
||||
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
|
||||
|
||||
if (!(set & FLUID_REVMODEL_SET_ALL))
|
||||
|
@ -3892,12 +3931,13 @@ fluid_synth_set_reverb_full(fluid_synth_t* synth, int set, double roomsize,
|
|||
if (set & FLUID_REVMODEL_SET_LEVEL)
|
||||
fluid_atomic_float_set (&synth->reverb_level, level);
|
||||
|
||||
fluid_rvoice_eventhandler_push5(synth->eventhandler,
|
||||
/* finally enqueue an rvoice event to the mixer to actual update reverb */
|
||||
ret = fluid_rvoice_eventhandler_push5(synth->eventhandler,
|
||||
fluid_rvoice_mixer_set_reverb_params,
|
||||
synth->eventhandler->mixer, set,
|
||||
roomsize, damping, width, level, 0.0f);
|
||||
|
||||
FLUID_API_RETURN(FLUID_OK);
|
||||
FLUID_API_RETURN(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue