libfluidsynth  2.0.2
Functions
ladspa.h File Reference

Functions for manipulating the ladspa effects unit. More...

Functions

FLUIDSYNTH_API int fluid_ladspa_is_active (fluid_ladspa_fx_t *fx)
 Check if the LADSPA engine is currently used to render audio. More...
 
FLUIDSYNTH_API int fluid_ladspa_activate (fluid_ladspa_fx_t *fx)
 Activate the LADSPA fx instance and each configured effect. More...
 
FLUIDSYNTH_API int fluid_ladspa_deactivate (fluid_ladspa_fx_t *fx)
 Deactivate a LADSPA fx instance and all configured effects. More...
 
FLUIDSYNTH_API int fluid_ladspa_reset (fluid_ladspa_fx_t *fx)
 Reset the LADSPA effects engine: Deactivate LADSPA if currently active, remove all effects, remove all user nodes and unload all libraries. More...
 
FLUIDSYNTH_API int fluid_ladspa_check (fluid_ladspa_fx_t *fx, char *err, int err_size)
 Do a sanity check for problems in the LADSPA setup. More...
 
FLUIDSYNTH_API int fluid_ladspa_host_port_exists (fluid_ladspa_fx_t *fx, const char *name)
 Check if a named host port exists. More...
 
FLUIDSYNTH_API int fluid_ladspa_add_buffer (fluid_ladspa_fx_t *fx, const char *name)
 Create and add a new audio buffer. More...
 
FLUIDSYNTH_API int fluid_ladspa_buffer_exists (fluid_ladspa_fx_t *fx, const char *name)
 Check if a named user buffer exists. More...
 
FLUIDSYNTH_API int fluid_ladspa_add_effect (fluid_ladspa_fx_t *fx, const char *effect_name, const char *lib_name, const char *plugin_name)
 Create an effect, i.e. More...
 
FLUIDSYNTH_API 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. More...
 
FLUIDSYNTH_API 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). More...
 
FLUIDSYNTH_API 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. More...
 
FLUIDSYNTH_API 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. More...
 
FLUIDSYNTH_API int fluid_ladspa_effect_link (fluid_ladspa_fx_t *fx, const char *effect_name, const char *port_name, const char *name)
 Connect an effect port to a host port or buffer. More...
 

Detailed Description

Functions for manipulating the ladspa effects unit.

This header defines useful functions for programatically 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.

Function Documentation

◆ fluid_ladspa_is_active()

FLUIDSYNTH_API int fluid_ladspa_is_active ( fluid_ladspa_fx_t fx)

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

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.

Parameters
fxLADSPA fx instance
Returns
TRUE if LADSPA effects engine is active, otherwise FALSE

Referenced by fluid_ladspa_activate(), fluid_ladspa_add_buffer(), fluid_ladspa_add_effect(), fluid_ladspa_check(), fluid_ladspa_effect_link(), and fluid_ladspa_reset().

◆ fluid_ladspa_activate()

FLUIDSYNTH_API int fluid_ladspa_activate ( fluid_ladspa_fx_t fx)

Activate the LADSPA fx instance and each configured effect.

Parameters
fxLADSPA fx instance
Returns
FLUID_OK if activation succeeded or already active, otherwise FLUID_FAILED

References FLUID_ERR, FLUID_FAILED, fluid_ladspa_check(), fluid_ladspa_is_active(), and FLUID_OK.

Referenced by fluid_ladspa_check().

◆ fluid_ladspa_deactivate()

FLUIDSYNTH_API int fluid_ladspa_deactivate ( fluid_ladspa_fx_t fx)

Deactivate a LADSPA fx instance and all configured effects.

Note
This function may sleep.
Parameters
fxLADSPA fx instance
Returns
FLUID_OK if deactivation succeeded, otherwise FLUID_FAILED

References FLUID_FAILED, and FLUID_OK.

Referenced by fluid_ladspa_check(), and fluid_ladspa_reset().

◆ fluid_ladspa_reset()

FLUIDSYNTH_API int fluid_ladspa_reset ( fluid_ladspa_fx_t fx)

Reset the LADSPA effects engine: Deactivate LADSPA if currently active, remove all effects, remove all user nodes and unload all libraries.

Parameters
fxLADSPA fx instance
Returns
FLUID_OK on success, otherwise FLUID_FAILED

References FLUID_ERR, FLUID_FAILED, fluid_ladspa_deactivate(), fluid_ladspa_is_active(), and FLUID_OK.

Referenced by fluid_ladspa_check().

◆ fluid_ladspa_check()

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

Do a sanity check for problems in the LADSPA setup.

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).

Parameters
fxLADSPA fx instance
errexternally provided buffer for the error message. Set to NULL if you don't need an error message.
err_sizesize of the err buffer
Returns
FLUID_OK if setup is valid, otherwise FLUID_FAILED (err will contain the error message)

References FLUID_ERR, FLUID_FAILED, fluid_ladspa_activate(), fluid_ladspa_add_buffer(), fluid_ladspa_add_effect(), fluid_ladspa_buffer_exists(), fluid_ladspa_deactivate(), fluid_ladspa_effect_can_mix(), fluid_ladspa_effect_link(), fluid_ladspa_effect_port_exists(), fluid_ladspa_effect_set_control(), fluid_ladspa_effect_set_mix(), fluid_ladspa_host_port_exists(), fluid_ladspa_is_active(), fluid_ladspa_reset(), and FLUID_OK.

Referenced by fluid_ladspa_activate().

◆ fluid_ladspa_host_port_exists()

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

Check if a named host port exists.

Parameters
fxLADSPA fx instance
namethe port name
Returns
TRUE if the host port exists, otherwise FALSE

Referenced by fluid_ladspa_check().

◆ fluid_ladspa_add_buffer()

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

Create and add a new audio buffer.

Parameters
fxLADSPA effects instance
namename of the new buffer
Returns
FLUID_OK on success, FLUID_FAILED on error

References FLUID_FAILED, fluid_ladspa_is_active(), and FLUID_OK.

Referenced by fluid_ladspa_check().

◆ fluid_ladspa_buffer_exists()

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

Check if a named user buffer exists.

Parameters
fxLADSPA fx instance
namethe buffer name
Returns
TRUE if the buffer exists, otherwise FALSE

Referenced by fluid_ladspa_check().

◆ fluid_ladspa_add_effect()

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

Create an effect, i.e.

an instance of a LADSPA plugin

Parameters
fxLADSPA effects instance
effect_namename of the effect
lib_namefilename of ladspa plugin library
plugin_nameoptional, plugin name if there is more than one plugin in the library
Returns
FLUID_OK on success, otherwise FLUID_FAILED

References FLUID_ERR, FLUID_FAILED, fluid_ladspa_is_active(), and FLUID_OK.

Referenced by fluid_ladspa_check().

◆ fluid_ladspa_effect_can_mix()

FLUIDSYNTH_API 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
fxLADSPA fx
namethe name of the effect
Returns
TRUE if mix mode is supported, otherwise FALSE

Referenced by fluid_ladspa_check(), and fluid_ladspa_effect_set_mix().

◆ fluid_ladspa_effect_set_mix()

FLUIDSYNTH_API 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
fxLADSPA fx instance
namethe name of the effect
mix(boolean) if to enable mix mode
gainthe gain to apply to the effect output before adding to output.
Returns
FLUID_OK on success, otherwise FLUID_FAILED

References FLUID_ERR, FLUID_FAILED, fluid_ladspa_effect_can_mix(), and FLUID_OK.

Referenced by fluid_ladspa_check().

◆ fluid_ladspa_effect_port_exists()

FLUIDSYNTH_API 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
fxLADSPA fx instance
effect_namename of the effect
port_namethe port name
Returns
TRUE if port was found, otherwise FALSE

Referenced by fluid_ladspa_check().

◆ fluid_ladspa_effect_set_control()

FLUIDSYNTH_API 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
fxLADSPA fx instance
effect_namename of the effect
port_namename of the port
valfloating point value
Returns
FLUID_OK on success, FLUID_FAILED on error

References FLUID_FAILED, and FLUID_OK.

Referenced by fluid_ladspa_check().

◆ fluid_ladspa_effect_link()

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

Connect an effect port to a host port or buffer.

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.
Parameters
fxLADSPA effects instance
effect_namename of the effect
port_namethe port name to connect to (case-insensitive prefix match)
namethe host port or buffer to connect to (case-insensitive)
Returns
FLUID_OK on success, otherwise FLUID_FAILED

References FLUID_ERR, FLUID_FAILED, fluid_ladspa_is_active(), and FLUID_OK.

Referenced by fluid_ladspa_check().