mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-04-22 07:30:50 +00:00
Separate getter function. This leads to the API
- fluid_synth_mixer_get_channel_mapping(). - fluid_synth_mixer_get_fx_mapping().
This commit is contained in:
parent
4162bbe516
commit
efbddb8d3d
3 changed files with 43 additions and 27 deletions
|
@ -390,9 +390,9 @@ FLUIDSYNTH_API int fluid_synth_get_breath_mode(fluid_synth_t *synth,
|
|||
int chan, int *breathmode);
|
||||
|
||||
/* API: Mixer MIDI channels mapping */
|
||||
FLUIDSYNTH_API int fluid_synth_mixer_get_mapping(fluid_synth_t *synth,
|
||||
int chan, int *out_from_chan, int *fx_from_chan,
|
||||
int *out_from_fx);
|
||||
FLUIDSYNTH_API int fluid_synth_mixer_get_channel_mapping(fluid_synth_t *synth,
|
||||
int chan, int *out_from_chan, int *fx_from_chan);
|
||||
FLUIDSYNTH_API int fluid_synth_mixer_get_fx_mapping(fluid_synth_t *synth, int fxunit_idx, int *out_idx);
|
||||
FLUIDSYNTH_API int fluid_synth_mixer_set_mapping(fluid_synth_t *synth,
|
||||
int chan_to_out, int out_from_chan,
|
||||
int chan_to_fx, int fx_from_chan,
|
||||
|
|
|
@ -3400,13 +3400,18 @@ int fluid_handle_chanmap(void *data, int ac, char **av,
|
|||
|
||||
for(i = 0; i < n; i++)
|
||||
{
|
||||
int out_from_chan, fx_from_chan, out_from_fx;
|
||||
int result1, result2 = FLUID_OK;
|
||||
int out_from_chan, fx_from_chan, out_from_fx = -1;
|
||||
int chan = ac ? atoi(av[i]) : i;
|
||||
int result = fluid_synth_mixer_get_mapping(synth, chan, &out_from_chan,
|
||||
&fx_from_chan,
|
||||
&out_from_fx);
|
||||
result1 = fluid_synth_mixer_get_channel_mapping(synth, chan, &out_from_chan,
|
||||
&fx_from_chan);
|
||||
if(fx_from_chan >= 0)
|
||||
{
|
||||
result2 = fluid_synth_mixer_get_fx_mapping(synth, fx_from_chan,
|
||||
&out_from_fx);
|
||||
}
|
||||
|
||||
if(result == FLUID_OK)
|
||||
if((result1 == FLUID_OK) && (result2 == FLUID_OK))
|
||||
{
|
||||
fluid_ostream_printf(out,
|
||||
"channel:%3d,%7d,%6d,%7d\n",
|
||||
|
|
|
@ -7435,17 +7435,11 @@ int fluid_synth_get_basic_channel(fluid_synth_t *synth, int chan,
|
|||
* @param fx_from_chan, pointer on value to return fx unit index
|
||||
* which is mapped to chan.(NULL to ignore the value).
|
||||
*
|
||||
* @param out_from_fx, pointer on value to return dry output index mapped
|
||||
* to the output of the fx unit which is mapped to chan.
|
||||
* If there is no fx unit mapped to chan, -1 is returned.
|
||||
* (NULL to ignore the value).
|
||||
*
|
||||
* @return #FLUID_OK on success, #FLUID_FAILED otherwise
|
||||
*/
|
||||
int
|
||||
fluid_synth_mixer_get_mapping(fluid_synth_t *synth,
|
||||
int chan, int *out_from_chan, int *fx_from_chan,
|
||||
int *out_from_fx)
|
||||
fluid_synth_mixer_get_channel_mapping(fluid_synth_t *synth, int chan,
|
||||
int *out_from_chan, int *fx_from_chan)
|
||||
{
|
||||
FLUID_API_ENTRY_CHAN(FLUID_FAILED);
|
||||
|
||||
|
@ -7461,20 +7455,37 @@ fluid_synth_mixer_get_mapping(fluid_synth_t *synth,
|
|||
*fx_from_chan = synth->channel[chan]->mapping_to_fx;
|
||||
}
|
||||
|
||||
/* return output index mapped to fx unit (which is mapped to chan)
|
||||
if queried.
|
||||
*/
|
||||
if(out_from_fx)
|
||||
{
|
||||
/*fx unit mapped to chan */
|
||||
int fxunit_idx = synth->channel[chan]->mapping_to_fx;
|
||||
fluid_rvoice_mixer_t *mixer = synth->eventhandler->mixer;
|
||||
*out_from_fx = fluid_rvoice_mixer_get_fx_out_mapping(mixer, fxunit_idx);
|
||||
}
|
||||
|
||||
FLUID_API_RETURN(FLUID_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mixer fx unit mapping to audio buffers.
|
||||
*
|
||||
* @param synth FluidSynth instance.
|
||||
* @param fxunit_idx, fx unit index to get mapping from.
|
||||
* Must be in the range (0 to synth->effects_groups-1).
|
||||
* @param out_idx, pointer on value to return dry output index mapped
|
||||
* to fx unit output.
|
||||
*
|
||||
* @return #FLUID_OK on success, #FLUID_FAILED otherwise
|
||||
*/
|
||||
int
|
||||
fluid_synth_mixer_get_fx_mapping(fluid_synth_t *synth, int fxunit_idx, int *out_idx)
|
||||
{
|
||||
fluid_return_val_if_fail(synth != NULL, FLUID_FAILED);
|
||||
fluid_return_val_if_fail(out_idx != NULL, FLUID_FAILED);
|
||||
|
||||
fluid_synth_api_enter(synth);
|
||||
if((fxunit_idx < 0) || (fxunit_idx >= synth->effects_groups))
|
||||
{
|
||||
FLUID_API_RETURN(FLUID_FAILED);
|
||||
}
|
||||
|
||||
*out_idx = fluid_rvoice_mixer_get_fx_out_mapping(synth->eventhandler->mixer,
|
||||
fxunit_idx);
|
||||
|
||||
FLUID_API_RETURN(FLUID_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set mixer MIDI channel mapping to audio buffers.
|
||||
|
|
Loading…
Reference in a new issue