mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-12-03 17:42:21 +00:00
Don't add effect control nodes to global node list
As effect control nodes are private to the effect and only ever accessed via the effect and port name, they don't need to be added to the global node list and can be cleaned up in the effect destructor.
This commit is contained in:
parent
ef29d03cc9
commit
7e553339e4
1 changed files with 17 additions and 2 deletions
|
@ -1319,8 +1319,25 @@ new_fluid_ladspa_effect(fluid_ladspa_fx_t *fx, const char *lib_name, const char
|
||||||
|
|
||||||
static void delete_fluid_ladspa_effect(fluid_ladspa_effect_t *effect)
|
static void delete_fluid_ladspa_effect(fluid_ladspa_effect_t *effect)
|
||||||
{
|
{
|
||||||
|
unsigned int i;
|
||||||
|
fluid_ladspa_node_t *node;
|
||||||
|
|
||||||
fluid_return_if_fail(effect != NULL);
|
fluid_return_if_fail(effect != NULL);
|
||||||
|
|
||||||
|
/* Control nodes are created automatically when the effect is instantiated and
|
||||||
|
* are private to this effect, so we can safely remove them here. Nodes connected
|
||||||
|
* to audio ports might be connected to other effects as well, so we simply remove
|
||||||
|
* any pointers to them from the effect. */
|
||||||
|
for(i = 0; i < effect->desc->PortCount; i++)
|
||||||
|
{
|
||||||
|
node = (fluid_ladspa_node_t *) effect->port_nodes[i];
|
||||||
|
|
||||||
|
if(node && node->type & FLUID_LADSPA_NODE_CONTROL)
|
||||||
|
{
|
||||||
|
delete_fluid_ladspa_node(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FLUID_FREE(effect->port_nodes);
|
FLUID_FREE(effect->port_nodes);
|
||||||
|
|
||||||
if(effect->handle != NULL && effect->desc != NULL && effect->desc->cleanup != NULL)
|
if(effect->handle != NULL && effect->desc != NULL && effect->desc->cleanup != NULL)
|
||||||
|
@ -1587,8 +1604,6 @@ static int create_control_port_nodes(fluid_ladspa_fx_t *fx, fluid_ladspa_effect_
|
||||||
return FLUID_FAILED;
|
return FLUID_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
fx->nodes = fluid_list_append(fx->nodes, node);
|
|
||||||
|
|
||||||
node->effect_buffer[0] = get_default_port_value(effect, i, fx->sample_rate);
|
node->effect_buffer[0] = get_default_port_value(effect, i, fx->sample_rate);
|
||||||
|
|
||||||
dir = (LADSPA_IS_PORT_INPUT(port_flags)) ? FLUID_LADSPA_INPUT : FLUID_LADSPA_OUTPUT;
|
dir = (LADSPA_IS_PORT_INPUT(port_flags)) ? FLUID_LADSPA_INPUT : FLUID_LADSPA_OUTPUT;
|
||||||
|
|
Loading…
Reference in a new issue