Add command setchanfxmapout in fluid_cmd.c

- fix a bug in fluid_setchanmap().
- in fluid_synth_mixer_set_mapping check out_from_fx  in range
  [0..synth->audio_group[.
This commit is contained in:
jjceresa 2020-09-08 07:25:08 +02:00
parent 94ad3d6750
commit f62419a367
4 changed files with 17 additions and 2 deletions

View file

@ -202,6 +202,10 @@ static const fluid_cmd_t fluid_commands[] =
"setchanmapfx", "mixer", fluid_handle_setchanmapfx,
"setchanmapfx chan0 out0 [chan1 out1..] Set mapping MIDI channel to fx unit"
},
{
"setchanfxmapout", "mixer", fluid_handle_setchanfxmapout,
"setchanfxmapout chan0 out0 [chan1 out1..] Set mapping fx unit to dry output"
},
/* reverb commands */
{
"rev_preset", "reverb", fluid_handle_reverbpreset,
@ -3482,7 +3486,7 @@ static int fluid_setchanmap(void *data, int ac, char **av,
chan_val[MAP_CHAN_TO_FX].chan,
chan_val[MAP_CHAN_TO_FX].val,
chan_val[MAP_CHANFX_TO_OUT].chan,
chan_val[MAP_CHAN_TO_OUT].val);
chan_val[MAP_CHANFX_TO_OUT].val);
if(result == FLUID_FAILED)
{
fluid_ostream_printf(out, "%s: channel %3d, map to %3d, %s",
@ -3515,6 +3519,16 @@ int fluid_handle_setchanmapfx(void *data, int ac, char **av,
return fluid_setchanmap(data, ac, av, out, MAP_CHAN_TO_FX);
}
/*-----------------------------------------------------------------------------
setchanfxmapout chanfx0 out0 [chanfx1 out1 .. ..]
Set a mapping between fx unit (actually mapped to chanfx) and dry output index.
*/
int fluid_handle_setchanfxmapout(void *data, int ac, char **av,
fluid_ostream_t out)
{
return fluid_setchanmap(data, ac, av, out, MAP_CHANFX_TO_OUT);
}
#ifdef LADSPA

View file

@ -106,6 +106,7 @@ int fluid_handle_sleep(void *data, int ac, char **av, fluid_ostream_t out);
int fluid_handle_chanmap(void *data, int ac, char **av,fluid_ostream_t out);
int fluid_handle_setchanmapout(void *data, int ac, char **av, fluid_ostream_t out);
int fluid_handle_setchanmapfx(void *data, int ac, char **av, fluid_ostream_t out);
int fluid_handle_setchanfxmapout(void *data, int ac, char **av, fluid_ostream_t out);
#ifdef LADSPA
int fluid_handle_ladspa_effect(void *data, int ac, char **av, fluid_ostream_t out);

View file

@ -859,7 +859,6 @@ void fluid_rvoice_mixer_set_fx_out_mapping(fluid_rvoice_mixer_t *mixer,
- Then set the mapping value through the ring buffer.
*/
fx[fxunit_idx].to_out = out_from_fx; /* shadow value */
/* Set the mapping through the ring buffer. */
param[0].i = fxunit_idx; /* fx unit index */
param[1].i = out_from_fx; /* dry output index */

View file

@ -7576,6 +7576,7 @@ fluid_synth_mixer_set_mapping(fluid_synth_t *synth,
/* check chanfx_to_out and out_from_fx */
if((chanfx_to_out >= synth->midi_channels)
||(out_from_fx < 0)
||(out_from_fx >= synth->audio_groups))
{
FLUID_API_RETURN(FLUID_FAILED);