mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-10 13:29:58 -05:00
lfe-filter: change the crossover frequency as a parameter
Add a user defined parameter lfe-crossover-freq for the lfe-filter, to pass this parameter to the lfe-filter, we need to change the pa_resampler_new() API as well. Signed-off-by: Hui Wang <hui.wang@canonical.com>
This commit is contained in:
parent
3538e6636e
commit
c36e191ce5
14 changed files with 28 additions and 8 deletions
|
|
@ -144,6 +144,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, bool shared, size_t shm_size) {
|
|||
c->realtime_priority = 5;
|
||||
c->disable_remixing = false;
|
||||
c->disable_lfe_remixing = false;
|
||||
c->lfe_crossover_freq = 120;
|
||||
c->deferred_volume = true;
|
||||
c->resample_method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ struct pa_core {
|
|||
unsigned default_n_fragments, default_fragment_size_msec;
|
||||
unsigned deferred_volume_safety_margin_usec;
|
||||
int deferred_volume_extra_delay_usec;
|
||||
unsigned lfe_crossover_freq;
|
||||
|
||||
pa_defer_event *module_defer_unload_event;
|
||||
pa_hashmap *modules_pending_unload; /* pa_module -> pa_module (hashmap-as-a-set) */
|
||||
|
|
|
|||
|
|
@ -320,6 +320,7 @@ pa_resampler* pa_resampler_new(
|
|||
const pa_channel_map *am,
|
||||
const pa_sample_spec *b,
|
||||
const pa_channel_map *bm,
|
||||
unsigned crossover_freq,
|
||||
pa_resample_method_t method,
|
||||
pa_resample_flags_t flags) {
|
||||
|
||||
|
|
@ -418,9 +419,8 @@ pa_resampler* pa_resampler_new(
|
|||
if (lfe_filter_required) {
|
||||
pa_sample_spec wss = r->o_ss;
|
||||
wss.format = r->work_format;
|
||||
/* TODO: Temporary code that sets crossover freq to 120 Hz. This should be a parameter */
|
||||
r->lfe_filter = pa_lfe_filter_new(&wss, &r->o_cm, 120.0f);
|
||||
pa_log_debug(" lfe filter activated (LR4 type)");
|
||||
r->lfe_filter = pa_lfe_filter_new(&wss, &r->o_cm, (float)crossover_freq);
|
||||
pa_log_debug(" lfe filter activated (LR4 type), the crossover_freq = %uHz", crossover_freq);
|
||||
}
|
||||
|
||||
/* initialize implementation */
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ pa_resampler* pa_resampler_new(
|
|||
const pa_channel_map *am,
|
||||
const pa_sample_spec *b,
|
||||
const pa_channel_map *bm,
|
||||
unsigned crossover_freq,
|
||||
pa_resample_method_t resample_method,
|
||||
pa_resample_flags_t flags);
|
||||
|
||||
|
|
|
|||
|
|
@ -451,6 +451,7 @@ int pa_sink_input_new(
|
|||
core->mempool,
|
||||
&data->sample_spec, &data->channel_map,
|
||||
&data->sink->sample_spec, &data->sink->channel_map,
|
||||
core->lfe_crossover_freq,
|
||||
data->resample_method,
|
||||
((data->flags & PA_SINK_INPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
|
||||
((data->flags & PA_SINK_INPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
|
||||
|
|
@ -2168,6 +2169,7 @@ int pa_sink_input_update_rate(pa_sink_input *i) {
|
|||
new_resampler = pa_resampler_new(i->core->mempool,
|
||||
&i->sample_spec, &i->channel_map,
|
||||
&i->sink->sample_spec, &i->sink->channel_map,
|
||||
i->core->lfe_crossover_freq,
|
||||
i->requested_resample_method,
|
||||
((i->flags & PA_SINK_INPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
|
||||
((i->flags & PA_SINK_INPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
|
||||
|
|
|
|||
|
|
@ -396,6 +396,7 @@ int pa_source_output_new(
|
|||
core->mempool,
|
||||
&data->source->sample_spec, &data->source->channel_map,
|
||||
&data->sample_spec, &data->channel_map,
|
||||
core->lfe_crossover_freq,
|
||||
data->resample_method,
|
||||
((data->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
|
||||
((data->flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
|
||||
|
|
@ -1625,6 +1626,7 @@ int pa_source_output_update_rate(pa_source_output *o) {
|
|||
new_resampler = pa_resampler_new(o->core->mempool,
|
||||
&o->source->sample_spec, &o->source->channel_map,
|
||||
&o->sample_spec, &o->channel_map,
|
||||
o->core->lfe_crossover_freq,
|
||||
o->requested_resample_method,
|
||||
((o->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
|
||||
((o->flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue