mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-28 08:57:11 -05:00
Add new option to disable remixing from/to LFE and set it to on by default
This commit is contained in:
parent
33d349dcbb
commit
f2164023fd
11 changed files with 49 additions and 23 deletions
|
|
@ -138,6 +138,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, int shared) {
|
|||
c->realtime_scheduling = FALSE;
|
||||
c->realtime_priority = 5;
|
||||
c->disable_remixing = FALSE;
|
||||
c->disable_lfe_remixing = FALSE;
|
||||
|
||||
for (j = 0; j < PA_CORE_HOOK_MAX; j++)
|
||||
pa_hook_init(&c->hooks[j], c);
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ struct pa_core {
|
|||
pa_bool_t running_as_daemon:1;
|
||||
pa_bool_t realtime_scheduling:1;
|
||||
pa_bool_t disable_remixing:1;
|
||||
pa_bool_t disable_lfe_remixing:1;
|
||||
|
||||
pa_resample_method_t resample_method;
|
||||
int realtime_priority;
|
||||
|
|
|
|||
|
|
@ -716,7 +716,11 @@ static void calc_map_table(pa_resampler *r) {
|
|||
* channels for LFE. */
|
||||
|
||||
for (ic = 0; ic < r->i_ss.channels; ic++) {
|
||||
r->map_table[oc][ic] = 1.0f / (float) r->i_ss.channels;
|
||||
|
||||
if (!(r->flags & PA_RESAMPLER_NO_LFE))
|
||||
r->map_table[oc][ic] = 1.0f / (float) r->i_ss.channels;
|
||||
else
|
||||
r->map_table[oc][ic] = 0;
|
||||
|
||||
/* Please note that a channel connected to LFE
|
||||
* doesn't really count as connected. */
|
||||
|
|
@ -851,7 +855,7 @@ static void calc_map_table(pa_resampler *r) {
|
|||
}
|
||||
}
|
||||
|
||||
if (ic_unconnected_lfe > 0) {
|
||||
if (ic_unconnected_lfe > 0 && !(r->flags & PA_RESAMPLER_NO_LFE)) {
|
||||
|
||||
/* OK, so there is an unconnected LFE channel. Let's mix
|
||||
* it into all channels, with factor 0.375 */
|
||||
|
|
|
|||
|
|
@ -49,9 +49,10 @@ typedef enum pa_resample_method {
|
|||
} pa_resample_method_t;
|
||||
|
||||
typedef enum pa_resample_flags {
|
||||
PA_RESAMPLER_VARIABLE_RATE = 1,
|
||||
PA_RESAMPLER_NO_REMAP = 2, /* implies NO_REMIX */
|
||||
PA_RESAMPLER_NO_REMIX = 4
|
||||
PA_RESAMPLER_VARIABLE_RATE = 0x0001U,
|
||||
PA_RESAMPLER_NO_REMAP = 0x0002U, /* implies NO_REMIX */
|
||||
PA_RESAMPLER_NO_REMIX = 0x0004U,
|
||||
PA_RESAMPLER_NO_LFE = 0x0008U
|
||||
} pa_resample_flags_t;
|
||||
|
||||
pa_resampler* pa_resampler_new(
|
||||
|
|
|
|||
|
|
@ -201,7 +201,8 @@ pa_sink_input* pa_sink_input_new(
|
|||
data->resample_method,
|
||||
((flags & PA_SINK_INPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
|
||||
((flags & PA_SINK_INPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
|
||||
(core->disable_remixing || (flags & PA_SINK_INPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0)))) {
|
||||
(core->disable_remixing || (flags & PA_SINK_INPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |
|
||||
(core->disable_lfe_remixing ? PA_RESAMPLER_NO_LFE : 0)))) {
|
||||
pa_log_warn("Unsupported resampling operation.");
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,7 +171,8 @@ pa_source_output* pa_source_output_new(
|
|||
data->resample_method,
|
||||
((flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
|
||||
((flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
|
||||
(core->disable_remixing || (flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0)))) {
|
||||
(core->disable_remixing || (flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |
|
||||
(core->disable_lfe_remixing ? PA_RESAMPLER_NO_LFE : 0)))) {
|
||||
pa_log_warn("Unsupported resampling operation.");
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue