summaryrefslogtreecommitdiffstats
path: root/media/libeffects/preprocessing/PreProcessing.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/libeffects/preprocessing/PreProcessing.cpp')
-rwxr-xr-xmedia/libeffects/preprocessing/PreProcessing.cpp69
1 files changed, 57 insertions, 12 deletions
diff --git a/media/libeffects/preprocessing/PreProcessing.cpp b/media/libeffects/preprocessing/PreProcessing.cpp
index 6267d1d..9fd6764 100755
--- a/media/libeffects/preprocessing/PreProcessing.cpp
+++ b/media/libeffects/preprocessing/PreProcessing.cpp
@@ -24,8 +24,8 @@
#include <audio_effects/effect_aec.h>
#include <audio_effects/effect_agc.h>
#include <audio_effects/effect_ns.h>
-#include "modules/interface/module_common_types.h"
-#include "modules/audio_processing/main/interface/audio_processing.h"
+#include <module_common_types.h>
+#include <audio_processing.h>
#include "speex/speex_resampler.h"
@@ -220,8 +220,8 @@ bool HasReverseStream(uint32_t procId)
// Automatic Gain Control (AGC)
//------------------------------------------------------------------------------
-static const int kAgcDefaultTargetLevel = 0;
-static const int kAgcDefaultCompGain = 90;
+static const int kAgcDefaultTargetLevel = 3;
+static const int kAgcDefaultCompGain = 9;
static const bool kAgcDefaultLimiter = true;
int AgcInit (preproc_effect_t *effect)
@@ -940,6 +940,19 @@ int Session_SetConfig(preproc_session_t *session, effect_config_t *config)
return 0;
}
+void Session_GetConfig(preproc_session_t *session, effect_config_t *config)
+{
+ memset(config, 0, sizeof(effect_config_t));
+ config->inputCfg.samplingRate = config->outputCfg.samplingRate = session->samplingRate;
+ config->inputCfg.format = config->outputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
+ config->inputCfg.channels = session->inChannelCount == 1 ?
+ AUDIO_CHANNEL_IN_MONO : AUDIO_CHANNEL_IN_STEREO;
+ config->outputCfg.channels = session->outChannelCount == 1 ?
+ AUDIO_CHANNEL_IN_MONO : AUDIO_CHANNEL_IN_STEREO;
+ config->inputCfg.mask = config->outputCfg.mask =
+ (EFFECT_CONFIG_SMP_RATE | EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT);
+}
+
int Session_SetReverseConfig(preproc_session_t *session, effect_config_t *config)
{
if (config->inputCfg.samplingRate != config->outputCfg.samplingRate ||
@@ -969,6 +982,17 @@ int Session_SetReverseConfig(preproc_session_t *session, effect_config_t *config
return 0;
}
+void Session_GetReverseConfig(preproc_session_t *session, effect_config_t *config)
+{
+ memset(config, 0, sizeof(effect_config_t));
+ config->inputCfg.samplingRate = config->outputCfg.samplingRate = session->samplingRate;
+ config->inputCfg.format = config->outputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
+ config->inputCfg.channels = config->outputCfg.channels =
+ session->revChannelCount == 1 ? AUDIO_CHANNEL_IN_MONO : AUDIO_CHANNEL_IN_STEREO;
+ config->inputCfg.mask = config->outputCfg.mask =
+ (EFFECT_CONFIG_SMP_RATE | EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT);
+}
+
void Session_SetProcEnabled(preproc_session_t *session, uint32_t procId, bool enabled)
{
if (enabled) {
@@ -1250,13 +1274,13 @@ int PreProcessingFx_Command(effect_handle_t self,
*(int *)pReplyData = 0;
break;
- case EFFECT_CMD_CONFIGURE:
+ case EFFECT_CMD_SET_CONFIG:
if (pCmdData == NULL||
cmdSize != sizeof(effect_config_t)||
pReplyData == NULL||
*replySize != sizeof(int)){
ALOGV("PreProcessingFx_Command cmdCode Case: "
- "EFFECT_CMD_CONFIGURE: ERROR");
+ "EFFECT_CMD_SET_CONFIG: ERROR");
return -EINVAL;
}
*(int *)pReplyData = Session_SetConfig(effect->session, (effect_config_t *)pCmdData);
@@ -1266,13 +1290,24 @@ int PreProcessingFx_Command(effect_handle_t self,
*(int *)pReplyData = Effect_SetState(effect, PREPROC_EFFECT_STATE_CONFIG);
break;
- case EFFECT_CMD_CONFIGURE_REVERSE:
- if (pCmdData == NULL||
- cmdSize != sizeof(effect_config_t)||
- pReplyData == NULL||
- *replySize != sizeof(int)){
+ case EFFECT_CMD_GET_CONFIG:
+ if (pReplyData == NULL ||
+ *replySize != sizeof(effect_config_t)) {
+ ALOGV("\tLVM_ERROR : PreProcessingFx_Command cmdCode Case: "
+ "EFFECT_CMD_GET_CONFIG: ERROR");
+ return -EINVAL;
+ }
+
+ Session_GetConfig(effect->session, (effect_config_t *)pCmdData);
+ break;
+
+ case EFFECT_CMD_SET_CONFIG_REVERSE:
+ if (pCmdData == NULL ||
+ cmdSize != sizeof(effect_config_t) ||
+ pReplyData == NULL ||
+ *replySize != sizeof(int)) {
ALOGV("PreProcessingFx_Command cmdCode Case: "
- "EFFECT_CMD_CONFIGURE_REVERSE: ERROR");
+ "EFFECT_CMD_SET_CONFIG_REVERSE: ERROR");
return -EINVAL;
}
*(int *)pReplyData = Session_SetReverseConfig(effect->session,
@@ -1282,6 +1317,16 @@ int PreProcessingFx_Command(effect_handle_t self,
}
break;
+ case EFFECT_CMD_GET_CONFIG_REVERSE:
+ if (pReplyData == NULL ||
+ *replySize != sizeof(effect_config_t)){
+ ALOGV("PreProcessingFx_Command cmdCode Case: "
+ "EFFECT_CMD_GET_CONFIG_REVERSE: ERROR");
+ return -EINVAL;
+ }
+ Session_GetReverseConfig(effect->session, (effect_config_t *)pCmdData);
+ break;
+
case EFFECT_CMD_RESET:
if (effect->ops->reset) {
effect->ops->reset(effect);