mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-12-03 09:32:02 +00:00
Avoid a few ifdefs by defining two separate sets of node<->buffer functions
This commit is contained in:
parent
4d256ce8cc
commit
3cc684e47e
1 changed files with 35 additions and 28 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue