mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-01-19 07:50:49 +00:00
Explicity create left and right host buffers
Makes it possible to create a single host buffer node for the effect sends.
This commit is contained in:
parent
4b2414761b
commit
87c37f305d
3 changed files with 29 additions and 47 deletions
|
@ -273,20 +273,20 @@ void delete_fluid_ladspa_fx(fluid_ladspa_fx_t *fx)
|
||||||
/**
|
/**
|
||||||
* Add host buffers to the LADSPA engine.
|
* Add host buffers to the LADSPA engine.
|
||||||
*
|
*
|
||||||
|
* @note The size of the buffers pointed to by the buffers array must be
|
||||||
|
* at least as large as the buffer size given to new_fluid_ladspa_fx.
|
||||||
|
*
|
||||||
* @param fx LADSPA fx instance
|
* @param fx LADSPA fx instance
|
||||||
* @param prefix common name prefix for the created nodes
|
* @param prefix common name prefix for the created nodes
|
||||||
* @param num_buffers count of buffers in the left and right arrays
|
* @param num_buffers number of of buffers buffer array
|
||||||
* @param left array of pointers to left side buffers
|
* @param buffers array of pointers to buffers
|
||||||
* @param right array of pointers to right side buffers
|
|
||||||
* @return FLUID_OK on success, otherwise FLUID_FAILED
|
* @return FLUID_OK on success, otherwise FLUID_FAILED
|
||||||
*/
|
*/
|
||||||
int fluid_ladspa_add_host_ports(fluid_ladspa_fx_t *fx, const char *prefix,
|
int fluid_ladspa_add_host_ports(fluid_ladspa_fx_t *fx, const char *prefix,
|
||||||
int buffer_count, int buffer_size, fluid_real_t *left[], fluid_real_t *right[])
|
int buffer_count, fluid_real_t *buffers[])
|
||||||
{
|
{
|
||||||
int i, c;
|
int i;
|
||||||
char name[99];
|
char name[99];
|
||||||
char *side;
|
|
||||||
fluid_real_t **bufs;
|
|
||||||
|
|
||||||
LADSPA_API_ENTER(fx);
|
LADSPA_API_ENTER(fx);
|
||||||
|
|
||||||
|
@ -295,37 +295,23 @@ int fluid_ladspa_add_host_ports(fluid_ladspa_fx_t *fx, const char *prefix,
|
||||||
LADSPA_API_RETURN(fx, FLUID_FAILED);
|
LADSPA_API_RETURN(fx, FLUID_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create left and right nodes for all channels */
|
/* Create nodes for all channels */
|
||||||
for (c = 0; c < buffer_count; c++)
|
for (i = 0; i < buffer_count; i++)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 2; i++)
|
/* If there is more than one buffer, then append a 1-based index to each node name */
|
||||||
|
if (buffer_count > 1) {
|
||||||
|
FLUID_SNPRINTF(name, sizeof(name), "%s%d", prefix, (i + 1));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (i == 0)
|
FLUID_STRNCPY(name, prefix, sizeof(name));
|
||||||
{
|
}
|
||||||
side = "L";
|
|
||||||
bufs = left;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
side = "R";
|
|
||||||
bufs = right;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If there is more than one channel, then append a 1-based index to each name */
|
if (new_fluid_ladspa_node(fx, name,
|
||||||
if (buffer_count > 1) {
|
FLUID_LADSPA_NODE_AUDIO | FLUID_LADSPA_NODE_HOST,
|
||||||
FLUID_SNPRINTF(name, sizeof(name), "%s%d:%s", prefix, (i + 1), side);
|
buffers[i]) == NULL)
|
||||||
}
|
{
|
||||||
else
|
return FLUID_FAILED;
|
||||||
{
|
|
||||||
FLUID_SNPRINTF(name, sizeof(name), "%s:%s", prefix, side);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_fluid_ladspa_node(fx, name,
|
|
||||||
FLUID_LADSPA_NODE_AUDIO | FLUID_LADSPA_NODE_HOST,
|
|
||||||
bufs[c]) == NULL)
|
|
||||||
{
|
|
||||||
return FLUID_FAILED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ int fluid_ladspa_reset(fluid_ladspa_fx_t *fx);
|
||||||
int fluid_ladspa_check(fluid_ladspa_fx_t *fx, char *err, int err_size);
|
int fluid_ladspa_check(fluid_ladspa_fx_t *fx, char *err, int err_size);
|
||||||
|
|
||||||
int fluid_ladspa_add_host_ports(fluid_ladspa_fx_t *fx, const char *prefix,
|
int fluid_ladspa_add_host_ports(fluid_ladspa_fx_t *fx, const char *prefix,
|
||||||
int buffer_count, int buffer_size, fluid_real_t *left[], fluid_real_t *right[]);
|
int buffer_count, fluid_real_t *buffers[]);
|
||||||
int fluid_ladspa_host_port_exists(fluid_ladspa_fx_t *fx, const char *name);
|
int fluid_ladspa_host_port_exists(fluid_ladspa_fx_t *fx, const char *name);
|
||||||
|
|
||||||
int fluid_ladspa_add_buffer(fluid_ladspa_fx_t *fx, const char *name);
|
int fluid_ladspa_add_buffer(fluid_ladspa_fx_t *fx, const char *name);
|
||||||
|
|
|
@ -631,27 +631,23 @@ void delete_fluid_rvoice_mixer(fluid_rvoice_mixer_t* mixer)
|
||||||
void fluid_rvoice_mixer_set_ladspa(fluid_rvoice_mixer_t* mixer,
|
void fluid_rvoice_mixer_set_ladspa(fluid_rvoice_mixer_t* mixer,
|
||||||
fluid_ladspa_fx_t *ladspa_fx, int audio_groups)
|
fluid_ladspa_fx_t *ladspa_fx, int audio_groups)
|
||||||
{
|
{
|
||||||
int buffer_size;
|
|
||||||
|
|
||||||
mixer->ladspa_fx = ladspa_fx;
|
mixer->ladspa_fx = ladspa_fx;
|
||||||
if (ladspa_fx == NULL)
|
if (ladspa_fx == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer_size = mixer->buffers.buf_blocks * FLUID_BUFSIZE;
|
fluid_ladspa_add_host_ports(ladspa_fx, "Main:L", audio_groups,
|
||||||
|
mixer->buffers.left_buf);
|
||||||
|
|
||||||
fluid_ladspa_add_host_ports(ladspa_fx, "Main", audio_groups, buffer_size,
|
fluid_ladspa_add_host_ports(ladspa_fx, "Main:R", audio_groups,
|
||||||
mixer->buffers.left_buf,
|
|
||||||
mixer->buffers.right_buf);
|
mixer->buffers.right_buf);
|
||||||
|
|
||||||
fluid_ladspa_add_host_ports(ladspa_fx, "Reverb", 1, buffer_size,
|
fluid_ladspa_add_host_ports(ladspa_fx, "Reverb:Send", 1,
|
||||||
&mixer->buffers.fx_left_buf[SYNTH_REVERB_CHANNEL],
|
&mixer->buffers.fx_left_buf[SYNTH_REVERB_CHANNEL]);
|
||||||
&mixer->buffers.fx_right_buf[SYNTH_REVERB_CHANNEL]);
|
|
||||||
|
|
||||||
fluid_ladspa_add_host_ports(ladspa_fx, "Chorus", 1, buffer_size,
|
fluid_ladspa_add_host_ports(ladspa_fx, "Chorus:Send", 1,
|
||||||
&mixer->buffers.fx_left_buf[SYNTH_REVERB_CHANNEL],
|
&mixer->buffers.fx_left_buf[SYNTH_REVERB_CHANNEL]);
|
||||||
&mixer->buffers.fx_right_buf[SYNTH_REVERB_CHANNEL]);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue