Skip to content

Effect - LADSPA

Functions for configuring the LADSPA effects unit.

This header defines useful functions for programmatically manipulating the ladspa effects unit of the synth that can be retrieved via fluid_synth_get_ladspa_fx().

Using any of those functions requires fluidsynth to be compiled with LADSPA support. Else all of those functions are useless dummies.

Functions

fluid_ladspa_activate()

int fluid_ladspa_activate(fluid_ladspa_fx_t *fx)

Activate the LADSPA fx instance and each configured effect.

Parameters:

Name Description
fx LADSPA fx instance

Returns: FLUID_OK if activation succeeded or already active, otherwise FLUID_FAILED

fluid_ladspa_add_buffer()

int fluid_ladspa_add_buffer(fluid_ladspa_fx_t *fx, const char *name)

Create and add a new audio buffer.

Parameters:

Name Description
fx LADSPA effects instance
name name of the new buffer

Returns: FLUID_OK on success, FLUID_FAILED on error

fluid_ladspa_add_effect()

int fluid_ladspa_add_effect(fluid_ladspa_fx_t *fx, const char *effect_name, const char *lib_name, const char *plugin_name)

Create an instance of a LADSPA plugin as an effect.

Parameters:

Name Description
fx LADSPA effects instance
effect_name name of the effect
lib_name filename of ladspa plugin library
plugin_name optional, plugin name if there is more than one plugin in the library

Returns: FLUID_OK on success, otherwise FLUID_FAILED

fluid_ladspa_buffer_exists()

int fluid_ladspa_buffer_exists(fluid_ladspa_fx_t *fx, const char *name)

Check if a named user buffer exists.

Parameters:

Name Description
fx LADSPA fx instance
name the buffer name

Returns: TRUE if the buffer exists, otherwise FALSE

fluid_ladspa_check()

int fluid_ladspa_check(fluid_ladspa_fx_t *fx, char *err, int err_size)

Do a sanity check for problems in the LADSPA setup.

Parameters:

Name Description
fx LADSPA fx instance
err externally provided buffer for the error message. Set to NULL if you don't need an error message.
err_size size of the err buffer

Returns: FLUID_OK if setup is valid, otherwise FLUID_FAILED (err will contain the error message)

If the check detects problems and the err pointer is not NULL, a description of the first found problem is written to that string (up to err_size - 1 characters).

fluid_ladspa_deactivate()

int fluid_ladspa_deactivate(fluid_ladspa_fx_t *fx)

Deactivate a LADSPA fx instance and all configured effects.

Parameters:

Name Description
fx LADSPA fx instance

Returns: FLUID_OK if deactivation succeeded, otherwise FLUID_FAILED

Note

This function may sleep.

fluid_ladspa_effect_can_mix()

int fluid_ladspa_effect_can_mix(fluid_ladspa_fx_t *fx, const char *name)

Check if the effect plugin supports the run_adding and set_run_adding_gain interfaces necessary for output mixing.

Parameters:

Name Description
fx LADSPA fx
name the name of the effect

Returns: TRUE if mix mode is supported, otherwise FALSE

int fluid_ladspa_effect_link(fluid_ladspa_fx_t *fx, const char *effect_name, const char *port_name, const char *name)

Connect an effect audio port to a host port or buffer.

Parameters:

Name Description
fx LADSPA effects instance
effect_name name of the effect
port_name the audio port name to connect to (case-insensitive prefix match)
name the host port or buffer to connect to (case-insensitive)

Returns: FLUID_OK on success, otherwise FLUID_FAILED

Note

There is no corresponding disconnect function. If the connections need to be changed, clear everything with fluid_ladspa_reset and start again from scratch.

fluid_ladspa_effect_port_exists()

int fluid_ladspa_effect_port_exists(fluid_ladspa_fx_t *fx, const char *effect_name, const char *port_name)

Check if the named port exists on an effect.

Parameters:

Name Description
fx LADSPA fx instance
effect_name name of the effect
port_name the port name

Returns: TRUE if port was found, otherwise FALSE

fluid_ladspa_effect_set_control()

int fluid_ladspa_effect_set_control(fluid_ladspa_fx_t *fx, const char *effect_name, const char *port_name, float val)

Set the value of an effect control port.

Parameters:

Name Description
fx LADSPA fx instance
effect_name name of the effect
port_name name of the port
val floating point value

Returns: FLUID_OK on success, FLUID_FAILED on error

fluid_ladspa_effect_set_mix()

int fluid_ladspa_effect_set_mix(fluid_ladspa_fx_t *fx, const char *name, int mix, float gain)

Set if the effect should replace everything in the output buffers (mix = 0, default) or add to the buffers with a fixed gain (mix = 1).

Parameters:

Name Description
fx LADSPA fx instance
name the name of the effect
mix (boolean) if to enable mix mode
gain the gain to apply to the effect output before adding to output.

Returns: FLUID_OK on success, otherwise FLUID_FAILED

fluid_ladspa_host_port_exists()

int fluid_ladspa_host_port_exists(fluid_ladspa_fx_t *fx, const char *name)

Check if a named host port exists.

Parameters:

Name Description
fx LADSPA fx instance
name the port name

Returns: TRUE if the host port exists, otherwise FALSE

fluid_ladspa_is_active()

int fluid_ladspa_is_active(fluid_ladspa_fx_t *fx)

Check if the LADSPA engine is currently used to render audio.

Parameters:

Name Description
fx LADSPA fx instance

Returns: TRUE if LADSPA effects engine is active, otherwise FALSE

If an engine is active, the only allowed user actions are deactivation or setting values of control ports on effects. Anything else, especially adding or removing effects, buffers or ports, is only allowed in deactivated state.

fluid_ladspa_reset()

int fluid_ladspa_reset(fluid_ladspa_fx_t *fx)

Reset the LADSPA effects engine.

Parameters:

Name Description
fx LADSPA fx instance

Returns: FLUID_OK on success, otherwise FLUID_FAILED

Deactivate LADSPA if currently active, remove all effects, remove all user nodes and unload all libraries.

fluid_synth_get_ladspa_fx()

fluid_ladspa_fx_t * fluid_synth_get_ladspa_fx(fluid_synth_t *synth)

Return the LADSPA effects instance used by FluidSynth.

Parameters:

Name Description
synth FluidSynth instance

Returns: pointer to LADSPA fx or NULL if compiled without LADSPA support or LADSPA is not active