post_proc: Offload effects combined patchset
* Support effects in DSP for tunnel mode playback
Add interface to support configuring equlaizer, bass boost,
virtualizer and reverb effects in DSP for tunnel mode of
playback.
(cherry-picked from CAF commit 3eedc004e9adf5967f393d65c22b7806d0c63e6c)
* post_proc: Enable effects param in DSP to start effect
-During switch to tunnel playback, offload effects-flags remain
disabled. This stops effects being applied on tunnel playback.
-Send effects enable params to DSP to start effects during switch.
(cherry-picked from CAF commit d02f2cd710334cc2be6a866da537a595256ae623)
* post_proc: disable adsp reverb when preset is 'None'
Audio HAL set corresponding preset id into adsp, but doesn't disabe
reverb explicitly when 'None' preset is chosen. However, preset=0
means custom preset in adsp, so adsp won't stop reverb processing.
(cherry-picked from CAF commit b27e25f062edfeebb6860078013c7b413b8c4301)
* post_proc: send ENABLE_FLAG directly to offload effect driver
Enable flag should be sent directly through offload effect driver to
adsp whenever bundle receives EFFECT_CMD_ENABLE. Otherwise enablement
will only take effect in adsp after subsequent parameters being set, and
that's not expected.
(cherry-picked from CAF commit d45948e2153c03b41f55577debd943408f9c8280)
* post_proc: reverb preset id is not mapped correctly
Array index is not correct and causes uninitialized value being used
when 'Plate' is chosen. Correct index to retrieve the right preset id.
(cherry-picked from CAF commit ca2685b2a0a695a7c4ac78883e750a92dcad0515)
* post_proc: disable Bassboost and Virtualizer for certain devices
WFD, Hdmi and usb audio are not intended to be applied with
SA+ bassboost and virtualizer, so add into invalid device list.
(cherry-picked from CAF ee2ff9621d25d83151ccb24a416f21533fdfbd31)
* post_proc: disable effect immediately when routed to invalid devices
Offload effect is still perceived when invalid output device is
connected. We should send disable command immediately once phone is
routed to unexpected device and forbid effect enablement during
temporary disabled state.
(cherry-picked from CAF commit 95d74c2232721631f3a04f6ccf35760b37b33fea)
* post_proc: Enable reverb in DSP to start effect
During switch to tunnel playback, reverb enable command is not sent to
DSP and causes reverb effect not applied continuously.
Send reverb enable params to DSP to start effects during switch.
(cherry-picked from CAF commit c37c260fa174453f4822261bcd531ddb2706ab2c)
* post_proc: include audio_effects.h from kernel exported headers
Currently, audio_effects.h header file is included with reference
to the absolute path. Instead, reference it from the kernel
exported headers.
(cherry-picked from CAF commit 090a2aa3f38298196ad9f47e3b6578535e1f7e10)
* hal: Add support for audio effects in DSP for tunnel mode playback
Add support to enable or disable audio post processing effects
in DSP for tunnel mode playback.
(cherry-picked from CAF commit 1d0891672175d431e8872dd7dff21e0ce507361a)
Change-Id: I7ead6da4c216fd87e8ca1884811c4e0155053f49
diff --git a/post_proc/reverb.h b/post_proc/reverb.h
new file mode 100644
index 0000000..aba2b27
--- /dev/null
+++ b/post_proc/reverb.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OFFLOAD_REVERB_H_
+#define OFFLOAD_REVERB_H_
+
+#include "bundle.h"
+
+#define REVERB_DEFAULT_PRESET REVERB_PRESET_NONE
+
+extern const effect_descriptor_t aux_env_reverb_descriptor;
+extern const effect_descriptor_t ins_env_reverb_descriptor;
+extern const effect_descriptor_t aux_preset_reverb_descriptor;
+extern const effect_descriptor_t ins_preset_reverb_descriptor;
+
+typedef struct reverb_settings_s {
+ int16_t roomLevel;
+ int16_t roomHFLevel;
+ uint32_t decayTime;
+ int16_t decayHFRatio;
+ int16_t reflectionsLevel;
+ uint32_t reflectionsDelay;
+ int16_t reverbLevel;
+ uint32_t reverbDelay;
+ int16_t diffusion;
+ int16_t density;
+} reverb_settings_t;
+
+typedef struct reverb_context_s {
+ effect_context_t common;
+
+ // Offload vars
+ struct mixer_ctl *ctl;
+ bool auxiliary;
+ bool preset;
+ uint16_t cur_preset;
+ uint16_t next_preset;
+ reverb_settings_t reverb_settings;
+ uint32_t device;
+ struct reverb_params offload_reverb;
+} reverb_context_t;
+
+
+void reverb_auxiliary_init(reverb_context_t *context);
+
+void reverb_preset_init(reverb_context_t *context);
+
+void reverb_insert_init(reverb_context_t *context);
+
+int reverb_get_parameter(effect_context_t *context, effect_param_t *p,
+ uint32_t *size);
+
+int reverb_set_parameter(effect_context_t *context, effect_param_t *p,
+ uint32_t size);
+
+int reverb_set_device(effect_context_t *context, uint32_t device);
+
+int reverb_reset(effect_context_t *context);
+
+int reverb_init(effect_context_t *context);
+
+int reverb_enable(effect_context_t *context);
+
+int reverb_disable(effect_context_t *context);
+
+int reverb_start(effect_context_t *context, output_context_t *output);
+
+int reverb_stop(effect_context_t *context, output_context_t *output);
+
+#endif /* OFFLOAD_REVERB_H_ */