diff --git a/src/bindings/fluid_ladspa.c b/src/bindings/fluid_ladspa.c index 7d62f925..bca44039 100644 --- a/src/bindings/fluid_ladspa.c +++ b/src/bindings/fluid_ladspa.c @@ -930,51 +930,58 @@ int fluid_ladspa_check(fluid_ladspa_fx_t *fx, char *err, int err_size) LADSPA_API_RETURN(fx, FLUID_OK); } +#ifdef WITH_FLOAT static FLUID_INLINE void buffer_to_node(fluid_real_t *buffer, fluid_ladspa_node_t *node) { -#ifndef WITH_FLOAT - int i; -#endif - /* If the node is not used by any plugin, then we don't need to fill it */ - if (node->num_outputs == 0) + if (node->num_outputs > 0) { - return; + FLUID_MEMCPY(node->buf, buffer, FLUID_BUFSIZE * sizeof(float)); + } +} + +static FLUID_INLINE void node_to_buffer(fluid_ladspa_node_t *node, fluid_real_t *buffer) +{ + /* If the node has no inputs, then we don't need to copy it to the node */ + if (node->num_inputs > 0) + { + FLUID_MEMCPY(buffer, node->buf, FLUID_BUFSIZE * sizeof(float)); + } +} + +#else /* WITH_FLOAT */ + +static FLUID_INLINE void buffer_to_node(fluid_real_t *buffer, fluid_ladspa_node_t *node) +{ + int i; + + /* If the node is not used by any plugin, then we don't need to fill it */ + if (node->num_outputs > 0) + { + for (i = 0; i < FLUID_BUFSIZE; i++) + { + node->buf[i] = (LADSPA_Data)buffer[i]; + } } - -#ifdef WITH_FLOAT - FLUID_MEMCPY(node->buf, buffer, FLUID_BUFSIZE * sizeof(float)); -#else - for (i = 0; i < FLUID_BUFSIZE; i++) - { - node->buf[i] = (LADSPA_Data)buffer[i]; - } -#endif } static FLUID_INLINE void node_to_buffer(fluid_ladspa_node_t *node, fluid_real_t *buffer) { -#ifndef WITH_FLOAT int i; -#endif /* If the node has no inputs, then we don't need to copy it to the node */ - if (node->num_inputs == 0) + if (node->num_inputs > 0) { - return; + for (i = 0; i < FLUID_BUFSIZE; i++) + { + buffer[i] = (fluid_real_t)node->buf[i]; + } } - -#ifdef WITH_FLOAT - FLUID_MEMCPY(buffer, node->buf, FLUID_BUFSIZE * sizeof(float)); -#else - for (i = 0; i < FLUID_BUFSIZE; i++) - { - buffer[i] = (fluid_real_t)node->buf[i]; - } -#endif } +#endif /* WITH_FLOAT */ + static void activate_plugin(fluid_ladspa_plugin_t *plugin) { if (!plugin->active)