mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-04-15 12:21:01 +00:00
Limiting audio-channels to audio-groups (#663)
This commit is contained in:
parent
0acfd81e28
commit
c76949e6d3
2 changed files with 21 additions and 9 deletions
|
@ -51,7 +51,7 @@ struct _fluid_mixer_buffers_t
|
|||
|
||||
/** buffer to store the left part of a stereo channel to.
|
||||
* Specifically a two dimensional array, containing \c buf_count sample buffers
|
||||
* (i.e. for each synth.audio-channels), of which each contains
|
||||
* (i.e. for each synth.audio-groups), of which each contains
|
||||
* FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT audio items (=samples)
|
||||
* @note Each sample buffer is aligned to the FLUID_DEFAULT_ALIGNMENT
|
||||
* boundary provided that this pointer points to an aligned buffer.
|
||||
|
|
|
@ -607,7 +607,7 @@ new_fluid_synth(fluid_settings_t *settings)
|
|||
fluid_synth_t *synth;
|
||||
fluid_sfloader_t *loader;
|
||||
char *important_channels;
|
||||
int i, nbuf, prio_level = 0;
|
||||
int i, prio_level = 0;
|
||||
int with_ladspa = 0;
|
||||
double sample_rate_min, sample_rate_max;
|
||||
|
||||
|
@ -749,14 +749,25 @@ new_fluid_synth(fluid_settings_t *settings)
|
|||
synth->effects_channels = 2;
|
||||
}
|
||||
|
||||
/* The number of buffers is determined by the higher number of nr
|
||||
* groups / nr audio channels. If LADSPA is unused, they should be
|
||||
* the same. */
|
||||
nbuf = synth->audio_channels;
|
||||
/*
|
||||
number of buffers rendered by the mixer is determined by synth->audio_groups.
|
||||
audio from MIDI channel is rendered, mapped and mixed in these buffers.
|
||||
|
||||
if(synth->audio_groups > nbuf)
|
||||
Typically synth->audio_channels is only used by audio driver and should be set
|
||||
to the same value that synth->audio_groups. In some situation using LADSPA,
|
||||
it is best to diminish audio-channels so that the driver will be able to pass
|
||||
the audio to audio devices in the case these devices have a limited number of
|
||||
audio channels.
|
||||
|
||||
audio-channels must not be greater then audio-groups, otherwise these
|
||||
audio output above audio-groups will not be rendered by the mixeur.
|
||||
*/
|
||||
if(synth->audio_channels > synth->audio_groups)
|
||||
{
|
||||
nbuf = synth->audio_groups;
|
||||
synth->audio_channels = synth->audio_groups;
|
||||
fluid_settings_setint(settings, "synth.audio-channels", synth->audio_channels);
|
||||
FLUID_LOG(FLUID_WARN, "Requested audio-channels to high. "
|
||||
"Limiting this setting to audio-groups.");
|
||||
}
|
||||
|
||||
if(fluid_settings_dupstr(settings, "synth.overflow.important-channels",
|
||||
|
@ -788,7 +799,8 @@ new_fluid_synth(fluid_settings_t *settings)
|
|||
/* Allocate event queue for rvoice mixer */
|
||||
/* In an overflow situation, a new voice takes about 50 spaces in the queue! */
|
||||
synth->eventhandler = new_fluid_rvoice_eventhandler(synth->polyphony * 64,
|
||||
synth->polyphony, nbuf, synth->effects_channels, synth->effects_groups,
|
||||
synth->polyphony, synth->audio_groups,
|
||||
synth->effects_channels, synth->effects_groups,
|
||||
(fluid_real_t)sample_rate_max, synth->sample_rate,
|
||||
synth->cores - 1, prio_level);
|
||||
|
||||
|
|
Loading…
Reference in a new issue