summaryrefslogtreecommitdiffstats
path: root/media/libeffects
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-12-16 15:30:36 -0800
committerEric Laurent <elaurent@google.com>2011-12-19 17:08:31 -0800
commit3d5188bd6abe55898f10a0edf3c05aff8aa2ef67 (patch)
tree7dd2eba6d9a65d42628ffe55d12e640776285035 /media/libeffects
parent42968939dfce0954d6540011199045ec4ed7de80 (diff)
downloadframeworks_av-3d5188bd6abe55898f10a0edf3c05aff8aa2ef67.zip
frameworks_av-3d5188bd6abe55898f10a0edf3c05aff8aa2ef67.tar.gz
frameworks_av-3d5188bd6abe55898f10a0edf3c05aff8aa2ef67.tar.bz2
audio effects: rename configure command
Renamed audio effect library interface command for audio format configuration from EFFECT_CMD_CONFIGURE to EFFECT_CMD_SET_CONFIG. This makes the naming more consistent with other exixsting commands and allow adding a new command to get the configuration (EFFECT_CMD_GET_CONFIG). Same change for reverse channel configuration renamed from EFFECT_CMD_CONFIGURE_REVERSE to EFFECT_CMD_SET_CONFIG_REVERSE. Implemented EFFECT_CMD_GET_CONFIG in exisitng effect libraries. Change-Id: Ia7b1c620f13797fe5aceb3b0b4acbacce09fb067
Diffstat (limited to 'media/libeffects')
-rw-r--r--media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp67
-rwxr-xr-xmedia/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp75
-rwxr-xr-xmedia/libeffects/preprocessing/PreProcessing.cpp61
-rw-r--r--media/libeffects/testlibs/EffectEqualizer.cpp43
-rw-r--r--media/libeffects/testlibs/EffectReverb.c50
-rw-r--r--media/libeffects/testlibs/EffectReverb.h3
-rw-r--r--media/libeffects/visualizer/EffectVisualizer.cpp39
7 files changed, 263 insertions, 75 deletions
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index b02ca38..108d36a 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -133,7 +133,8 @@ int LvmBundle_init (EffectContext *pContext);
int LvmEffect_enable (EffectContext *pContext);
int LvmEffect_disable (EffectContext *pContext);
void LvmEffect_free (EffectContext *pContext);
-int Effect_configure (EffectContext *pContext, effect_config_t *pConfig);
+int Effect_setConfig (EffectContext *pContext, effect_config_t *pConfig);
+void Effect_getConfig (EffectContext *pContext, effect_config_t *pConfig);
int BassBoost_setParameter (EffectContext *pContext, void *pParam, void *pValue);
int BassBoost_getParameter (EffectContext *pContext,
void *pParam,
@@ -936,7 +937,7 @@ void LvmEffect_free(EffectContext *pContext){
} /* end LvmEffect_free */
//----------------------------------------------------------------------------
-// Effect_configure()
+// Effect_setConfig()
//----------------------------------------------------------------------------
// Purpose: Set input and output audio configuration.
//
@@ -949,9 +950,9 @@ void LvmEffect_free(EffectContext *pContext){
//
//----------------------------------------------------------------------------
-int Effect_configure(EffectContext *pContext, effect_config_t *pConfig){
+int Effect_setConfig(EffectContext *pContext, effect_config_t *pConfig){
LVM_Fs_en SampleRate;
- //ALOGV("\tEffect_configure start");
+ //ALOGV("\tEffect_setConfig start");
CHECK_ARG(pContext != NULL);
CHECK_ARG(pConfig != NULL);
@@ -992,7 +993,7 @@ int Effect_configure(EffectContext *pContext, effect_config_t *pConfig){
pContext->pBundledContext->SamplesPerSecond = 48000*2; // 2 secs Stereo
break;
default:
- ALOGV("\tEffect_Configure invalid sampling rate %d", pConfig->inputCfg.samplingRate);
+ ALOGV("\tEffect_setConfig invalid sampling rate %d", pConfig->inputCfg.samplingRate);
return -EINVAL;
}
@@ -1001,28 +1002,47 @@ int Effect_configure(EffectContext *pContext, effect_config_t *pConfig){
LVM_ControlParams_t ActiveParams;
LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS;
- ALOGV("\tEffect_configure change sampling rate to %d", SampleRate);
+ ALOGV("\tEffect_setConfig change sampling rate to %d", SampleRate);
/* Get the current settings */
LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
&ActiveParams);
- LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "Effect_configure")
+ LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "Effect_setConfig")
if(LvmStatus != LVM_SUCCESS) return -EINVAL;
LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
- LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "Effect_configure")
- ALOGV("\tEffect_configure Succesfully called LVM_SetControlParameters\n");
+ LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "Effect_setConfig")
+ ALOGV("\tEffect_setConfig Succesfully called LVM_SetControlParameters\n");
pContext->pBundledContext->SampleRate = SampleRate;
}else{
- //ALOGV("\tEffect_configure keep sampling rate at %d", SampleRate);
+ //ALOGV("\tEffect_setConfig keep sampling rate at %d", SampleRate);
}
- //ALOGV("\tEffect_configure End....");
+ //ALOGV("\tEffect_setConfig End....");
return 0;
-} /* end Effect_configure */
+} /* end Effect_setConfig */
+
+//----------------------------------------------------------------------------
+// Effect_getConfig()
+//----------------------------------------------------------------------------
+// Purpose: Get input and output audio configuration.
+//
+// Inputs:
+// pContext: effect engine context
+// pConfig: pointer to effect_config_t structure holding input and output
+// configuration parameters
+//
+// Outputs:
+//
+//----------------------------------------------------------------------------
+
+void Effect_getConfig(EffectContext *pContext, effect_config_t *pConfig)
+{
+ memcpy(pConfig, &pContext->config, sizeof(effect_config_t));
+} /* end Effect_getConfig */
//----------------------------------------------------------------------------
// BassGetStrength()
@@ -2778,23 +2798,34 @@ int Effect_command(effect_handle_t self,
}
break;
- case EFFECT_CMD_CONFIGURE:
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_CONFIGURE start");
+ case EFFECT_CMD_SET_CONFIG:
+ //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_CONFIG start");
if (pCmdData == NULL||
cmdSize != sizeof(effect_config_t)||
pReplyData == NULL||
*replySize != sizeof(int)){
ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
- "EFFECT_CMD_CONFIGURE: ERROR");
+ "EFFECT_CMD_SET_CONFIG: ERROR");
+ return -EINVAL;
+ }
+ *(int *) pReplyData = android::Effect_setConfig(pContext, (effect_config_t *) pCmdData);
+ //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_CONFIG end");
+ break;
+
+ case EFFECT_CMD_GET_CONFIG:
+ if (pReplyData == NULL ||
+ *replySize != sizeof(effect_config_t)) {
+ ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
+ "EFFECT_CMD_GET_CONFIG: ERROR");
return -EINVAL;
}
- *(int *) pReplyData = android::Effect_configure(pContext, (effect_config_t *) pCmdData);
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_CONFIGURE end");
+
+ android::Effect_getConfig(pContext, (effect_config_t *)pReplyData);
break;
case EFFECT_CMD_RESET:
//ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_RESET start");
- android::Effect_configure(pContext, &pContext->config);
+ android::Effect_setConfig(pContext, &pContext->config);
//ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_RESET end");
break;
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 1825aab..09cd5cc 100755
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -175,7 +175,8 @@ enum {
//--- local function prototypes
int Reverb_init (ReverbContext *pContext);
void Reverb_free (ReverbContext *pContext);
-int Reverb_configure (ReverbContext *pContext, effect_config_t *pConfig);
+int Reverb_setConfig (ReverbContext *pContext, effect_config_t *pConfig);
+void Reverb_getConfig (ReverbContext *pContext, effect_config_t *pConfig);
int Reverb_setParameter (ReverbContext *pContext, void *pParam, void *pValue);
int Reverb_getParameter (ReverbContext *pContext,
void *pParam,
@@ -609,7 +610,7 @@ void Reverb_free(ReverbContext *pContext){
} /* end Reverb_free */
//----------------------------------------------------------------------------
-// Reverb_configure()
+// Reverb_setConfig()
//----------------------------------------------------------------------------
// Purpose: Set input and output audio configuration.
//
@@ -622,9 +623,9 @@ void Reverb_free(ReverbContext *pContext){
//
//----------------------------------------------------------------------------
-int Reverb_configure(ReverbContext *pContext, effect_config_t *pConfig){
+int Reverb_setConfig(ReverbContext *pContext, effect_config_t *pConfig){
LVM_Fs_en SampleRate;
- //ALOGV("\tReverb_configure start");
+ //ALOGV("\tReverb_setConfig start");
CHECK_ARG(pContext != NULL);
CHECK_ARG(pConfig != NULL);
@@ -642,7 +643,7 @@ int Reverb_configure(ReverbContext *pContext, effect_config_t *pConfig){
return -EINVAL;
}
- //ALOGV("\tReverb_configure calling memcpy");
+ //ALOGV("\tReverb_setConfig calling memcpy");
memcpy(&pContext->config, pConfig, sizeof(effect_config_t));
@@ -666,7 +667,7 @@ int Reverb_configure(ReverbContext *pContext, effect_config_t *pConfig){
SampleRate = LVM_FS_48000;
break;
default:
- ALOGV("\rReverb_Configure invalid sampling rate %d", pConfig->inputCfg.samplingRate);
+ ALOGV("\rReverb_setConfig invalid sampling rate %d", pConfig->inputCfg.samplingRate);
return -EINVAL;
}
@@ -675,28 +676,46 @@ int Reverb_configure(ReverbContext *pContext, effect_config_t *pConfig){
LVREV_ControlParams_st ActiveParams;
LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS;
- //ALOGV("\tReverb_configure change sampling rate to %d", SampleRate);
+ //ALOGV("\tReverb_setConfig change sampling rate to %d", SampleRate);
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance,
&ActiveParams);
- LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "Reverb_configure")
+ LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "Reverb_setConfig")
if(LvmStatus != LVREV_SUCCESS) return -EINVAL;
LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
- LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "Reverb_configure")
- //ALOGV("\tReverb_configure Succesfully called LVREV_SetControlParameters\n");
+ LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "Reverb_setConfig")
+ //ALOGV("\tReverb_setConfig Succesfully called LVREV_SetControlParameters\n");
}else{
- //ALOGV("\tReverb_configure keep sampling rate at %d", SampleRate);
+ //ALOGV("\tReverb_setConfig keep sampling rate at %d", SampleRate);
}
- //ALOGV("\tReverb_configure End");
+ //ALOGV("\tReverb_setConfig End");
return 0;
-} /* end Reverb_configure */
+} /* end Reverb_setConfig */
+//----------------------------------------------------------------------------
+// Reverb_getConfig()
+//----------------------------------------------------------------------------
+// Purpose: Get input and output audio configuration.
+//
+// Inputs:
+// pContext: effect engine context
+// pConfig: pointer to effect_config_t structure holding input and output
+// configuration parameters
+//
+// Outputs:
+//
+//----------------------------------------------------------------------------
+
+void Reverb_getConfig(ReverbContext *pContext, effect_config_t *pConfig)
+{
+ memcpy(pConfig, &pContext->config, sizeof(effect_config_t));
+} /* end Reverb_getConfig */
//----------------------------------------------------------------------------
// Reverb_init()
@@ -1924,24 +1943,36 @@ int Reverb_command(effect_handle_t self,
*(int *) pReplyData = 0;
break;
- case EFFECT_CMD_CONFIGURE:
+ case EFFECT_CMD_SET_CONFIG:
//ALOGV("\tReverb_command cmdCode Case: "
- // "EFFECT_CMD_CONFIGURE start");
- if (pCmdData == NULL||
- cmdSize != sizeof(effect_config_t)||
- pReplyData == NULL||
- *replySize != sizeof(int)){
+ // "EFFECT_CMD_SET_CONFIG start");
+ if (pCmdData == NULL ||
+ cmdSize != sizeof(effect_config_t) ||
+ pReplyData == NULL ||
+ *replySize != sizeof(int)) {
+ ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+ "EFFECT_CMD_SET_CONFIG: ERROR");
+ return -EINVAL;
+ }
+ *(int *) pReplyData = android::Reverb_setConfig(pContext,
+ (effect_config_t *) pCmdData);
+ break;
+
+ case EFFECT_CMD_GET_CONFIG:
+ if (pReplyData == NULL ||
+ *replySize != sizeof(effect_config_t)) {
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
- "EFFECT_CMD_CONFIGURE: ERROR");
+ "EFFECT_CMD_GET_CONFIG: ERROR");
return -EINVAL;
}
- *(int *) pReplyData = Reverb_configure(pContext, (effect_config_t *) pCmdData);
+
+ android::Reverb_getConfig(pContext, (effect_config_t *)pReplyData);
break;
case EFFECT_CMD_RESET:
//ALOGV("\tReverb_command cmdCode Case: "
// "EFFECT_CMD_RESET start");
- Reverb_configure(pContext, &pContext->config);
+ Reverb_setConfig(pContext, &pContext->config);
break;
case EFFECT_CMD_GET_PARAM:{
diff --git a/media/libeffects/preprocessing/PreProcessing.cpp b/media/libeffects/preprocessing/PreProcessing.cpp
index b15614a..c99552b 100755
--- a/media/libeffects/preprocessing/PreProcessing.cpp
+++ b/media/libeffects/preprocessing/PreProcessing.cpp
@@ -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);
diff --git a/media/libeffects/testlibs/EffectEqualizer.cpp b/media/libeffects/testlibs/EffectEqualizer.cpp
index 79a296c..52fbf79 100644
--- a/media/libeffects/testlibs/EffectEqualizer.cpp
+++ b/media/libeffects/testlibs/EffectEqualizer.cpp
@@ -114,7 +114,7 @@ struct EqualizerContext {
//--- local function prototypes
int Equalizer_init(EqualizerContext *pContext);
-int Equalizer_configure(EqualizerContext *pContext, effect_config_t *pConfig);
+int Equalizer_setConfig(EqualizerContext *pContext, effect_config_t *pConfig);
int Equalizer_getParameter(AudioEqualizer * pEqualizer, int32_t *pParam, size_t *pValueSize, void *pValue);
int Equalizer_setParameter(AudioEqualizer * pEqualizer, int32_t *pParam, void *pValue);
@@ -224,7 +224,7 @@ extern "C" int EffectGetDescriptor(effect_uuid_t *uuid,
}
//----------------------------------------------------------------------------
-// Equalizer_configure()
+// Equalizer_setConfig()
//----------------------------------------------------------------------------
// Purpose: Set input and output audio configuration.
//
@@ -237,9 +237,9 @@ extern "C" int EffectGetDescriptor(effect_uuid_t *uuid,
//
//----------------------------------------------------------------------------
-int Equalizer_configure(EqualizerContext *pContext, effect_config_t *pConfig)
+int Equalizer_setConfig(EqualizerContext *pContext, effect_config_t *pConfig)
{
- ALOGV("Equalizer_configure start");
+ ALOGV("Equalizer_setConfig start");
CHECK_ARG(pContext != NULL);
CHECK_ARG(pConfig != NULL);
@@ -272,7 +272,26 @@ int Equalizer_configure(EqualizerContext *pContext, effect_config_t *pConfig)
pConfig->outputCfg.accessMode);
return 0;
-} // end Equalizer_configure
+} // end Equalizer_setConfig
+
+//----------------------------------------------------------------------------
+// Equalizer_getConfig()
+//----------------------------------------------------------------------------
+// Purpose: Get input and output audio configuration.
+//
+// Inputs:
+// pContext: effect engine context
+// pConfig: pointer to effect_config_t structure holding input and output
+// configuration parameters
+//
+// Outputs:
+//
+//----------------------------------------------------------------------------
+
+void Equalizer_getConfig(EqualizerContext *pContext, effect_config_t *pConfig)
+{
+ memcpy(pConfig, &pContext->config, sizeof(effect_config_t));
+} // end Equalizer_getConfig
//----------------------------------------------------------------------------
@@ -332,7 +351,7 @@ int Equalizer_init(EqualizerContext *pContext)
pContext->pEqualizer->enable(true);
- Equalizer_configure(pContext, &pContext->config);
+ Equalizer_setConfig(pContext, &pContext->config);
return 0;
} // end Equalizer_init
@@ -643,16 +662,22 @@ extern "C" int Equalizer_command(effect_handle_t self, uint32_t cmdCode, uint32_
}
*(int *) pReplyData = Equalizer_init(pContext);
break;
- case EFFECT_CMD_CONFIGURE:
+ case EFFECT_CMD_SET_CONFIG:
if (pCmdData == NULL || cmdSize != sizeof(effect_config_t)
|| pReplyData == NULL || *replySize != sizeof(int)) {
return -EINVAL;
}
- *(int *) pReplyData = Equalizer_configure(pContext,
+ *(int *) pReplyData = Equalizer_setConfig(pContext,
(effect_config_t *) pCmdData);
break;
+ case EFFECT_CMD_GET_CONFIG:
+ if (pReplyData == NULL || *replySize != sizeof(effect_config_t)) {
+ return -EINVAL;
+ }
+ Equalizer_getConfig(pContext, (effect_config_t *) pCmdData);
+ break;
case EFFECT_CMD_RESET:
- Equalizer_configure(pContext, &pContext->config);
+ Equalizer_setConfig(pContext, &pContext->config);
break;
case EFFECT_CMD_GET_PARAM: {
if (pCmdData == NULL || cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
diff --git a/media/libeffects/testlibs/EffectReverb.c b/media/libeffects/testlibs/EffectReverb.c
index 1da8d32..419a41c 100644
--- a/media/libeffects/testlibs/EffectReverb.c
+++ b/media/libeffects/testlibs/EffectReverb.c
@@ -318,14 +318,20 @@ static int Reverb_Command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSi
pRvbModule->context.mState = REVERB_STATE_INITIALIZED;
}
break;
- case EFFECT_CMD_CONFIGURE:
+ case EFFECT_CMD_SET_CONFIG:
if (pCmdData == NULL || cmdSize != sizeof(effect_config_t)
|| pReplyData == NULL || *replySize != sizeof(int)) {
return -EINVAL;
}
- *(int *) pReplyData = Reverb_Configure(pRvbModule,
+ *(int *) pReplyData = Reverb_setConfig(pRvbModule,
(effect_config_t *)pCmdData, false);
break;
+ case EFFECT_CMD_GET_CONFIG:
+ if (pReplyData == NULL || *replySize != sizeof(effect_config_t)) {
+ return -EINVAL;
+ }
+ Reverb_getConfig(pRvbModule, (effect_config_t *) pCmdData);
+ break;
case EFFECT_CMD_RESET:
Reverb_Reset(pReverb, false);
break;
@@ -492,7 +498,7 @@ int Reverb_Init(reverb_module_t *pRvbModule, int aux, int preset) {
pRvbModule->config.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE;
pRvbModule->config.outputCfg.mask = EFFECT_CONFIG_ALL;
- ret = Reverb_Configure(pRvbModule, &pRvbModule->config, true);
+ ret = Reverb_setConfig(pRvbModule, &pRvbModule->config, true);
if (ret < 0) {
ALOGV("Reverb_Init error %d on module %p", ret, pRvbModule);
}
@@ -501,7 +507,7 @@ int Reverb_Init(reverb_module_t *pRvbModule, int aux, int preset) {
}
/*----------------------------------------------------------------------------
- * Reverb_Init()
+ * Reverb_setConfig()
*----------------------------------------------------------------------------
* Purpose:
* Set input and output audio configuration.
@@ -518,7 +524,7 @@ int Reverb_Init(reverb_module_t *pRvbModule, int aux, int preset) {
*----------------------------------------------------------------------------
*/
-int Reverb_Configure(reverb_module_t *pRvbModule, effect_config_t *pConfig,
+int Reverb_setConfig(reverb_module_t *pRvbModule, effect_config_t *pConfig,
bool init) {
reverb_object_t *pReverb = &pRvbModule->context;
int bufferSizeInSamples;
@@ -531,12 +537,12 @@ int Reverb_Configure(reverb_module_t *pRvbModule, effect_config_t *pConfig,
|| pConfig->outputCfg.channels != OUTPUT_CHANNELS
|| pConfig->inputCfg.format != AUDIO_FORMAT_PCM_16_BIT
|| pConfig->outputCfg.format != AUDIO_FORMAT_PCM_16_BIT) {
- ALOGV("Reverb_Configure invalid config");
+ ALOGV("Reverb_setConfig invalid config");
return -EINVAL;
}
if ((pReverb->m_Aux && (pConfig->inputCfg.channels != AUDIO_CHANNEL_OUT_MONO)) ||
(!pReverb->m_Aux && (pConfig->inputCfg.channels != AUDIO_CHANNEL_OUT_STEREO))) {
- ALOGV("Reverb_Configure invalid config");
+ ALOGV("Reverb_setConfig invalid config");
return -EINVAL;
}
@@ -576,7 +582,7 @@ int Reverb_Configure(reverb_module_t *pRvbModule, effect_config_t *pConfig,
pReverb->m_nCosWT_5KHz = 25997;
break;
default:
- ALOGV("Reverb_Configure invalid sampling rate %d", pReverb->m_nSamplingRate);
+ ALOGV("Reverb_setConfig invalid sampling rate %d", pReverb->m_nSamplingRate);
return -EINVAL;
}
@@ -620,6 +626,28 @@ int Reverb_Configure(reverb_module_t *pRvbModule, effect_config_t *pConfig,
}
/*----------------------------------------------------------------------------
+ * Reverb_getConfig()
+ *----------------------------------------------------------------------------
+ * Purpose:
+ * Get input and output audio configuration.
+ *
+ * Inputs:
+ * pRvbModule - pointer to reverb effect module
+ * pConfig - pointer to effect_config_t structure containing input
+ * and output audio parameters configuration
+ * Outputs:
+ *
+ * Side Effects:
+ *
+ *----------------------------------------------------------------------------
+ */
+
+void Reverb_getConfig(reverb_module_t *pRvbModule, effect_config_t *pConfig)
+{
+ memcpy(pConfig, &pRvbModule->config, sizeof(effect_config_t));
+}
+
+/*----------------------------------------------------------------------------
* Reverb_Reset()
*----------------------------------------------------------------------------
* Purpose:
@@ -844,7 +872,7 @@ int Reverb_getParameter(reverb_object_t *pReverb, int32_t param, size_t *pSize,
if (param == REVERB_PARAM_ROOM_HF_LEVEL) {
break;
}
- pValue32 = &pProperties->decayTime;
+ pValue32 = (int32_t *)&pProperties->decayTime;
/* FALL THROUGH */
case REVERB_PARAM_DECAY_TIME:
@@ -916,7 +944,7 @@ int Reverb_getParameter(reverb_object_t *pReverb, int32_t param, size_t *pSize,
if (param == REVERB_PARAM_REFLECTIONS_LEVEL) {
break;
}
- pValue32 = &pProperties->reflectionsDelay;
+ pValue32 = (int32_t *)&pProperties->reflectionsDelay;
/* FALL THROUGH */
case REVERB_PARAM_REFLECTIONS_DELAY:
@@ -940,7 +968,7 @@ int Reverb_getParameter(reverb_object_t *pReverb, int32_t param, size_t *pSize,
if (param == REVERB_PARAM_REVERB_LEVEL) {
break;
}
- pValue32 = &pProperties->reverbDelay;
+ pValue32 = (int32_t *)&pProperties->reverbDelay;
/* FALL THROUGH */
case REVERB_PARAM_REVERB_DELAY:
diff --git a/media/libeffects/testlibs/EffectReverb.h b/media/libeffects/testlibs/EffectReverb.h
index 8e2cc31..5137074 100644
--- a/media/libeffects/testlibs/EffectReverb.h
+++ b/media/libeffects/testlibs/EffectReverb.h
@@ -329,7 +329,8 @@ static int Reverb_GetDescriptor(effect_handle_t self,
*/
int Reverb_Init(reverb_module_t *pRvbModule, int aux, int preset);
-int Reverb_Configure(reverb_module_t *pRvbModule, effect_config_t *pConfig, bool init);
+int Reverb_setConfig(reverb_module_t *pRvbModule, effect_config_t *pConfig, bool init);
+void Reverb_getConfig(reverb_module_t *pRvbModule, effect_config_t *pConfig);
void Reverb_Reset(reverb_object_t *pReverb, bool init);
int Reverb_setParameter (reverb_object_t *pReverb, int32_t param, size_t size, void *pValue);
diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp
index e9b8042..b2a7a35 100644
--- a/media/libeffects/visualizer/EffectVisualizer.cpp
+++ b/media/libeffects/visualizer/EffectVisualizer.cpp
@@ -78,7 +78,7 @@ void Visualizer_reset(VisualizerContext *pContext)
}
//----------------------------------------------------------------------------
-// Visualizer_configure()
+// Visualizer_setConfig()
//----------------------------------------------------------------------------
// Purpose: Set input and output audio configuration.
//
@@ -91,9 +91,9 @@ void Visualizer_reset(VisualizerContext *pContext)
//
//----------------------------------------------------------------------------
-int Visualizer_configure(VisualizerContext *pContext, effect_config_t *pConfig)
+int Visualizer_setConfig(VisualizerContext *pContext, effect_config_t *pConfig)
{
- ALOGV("Visualizer_configure start");
+ ALOGV("Visualizer_setConfig start");
if (pConfig->inputCfg.samplingRate != pConfig->outputCfg.samplingRate) return -EINVAL;
if (pConfig->inputCfg.channels != pConfig->outputCfg.channels) return -EINVAL;
@@ -112,6 +112,26 @@ int Visualizer_configure(VisualizerContext *pContext, effect_config_t *pConfig)
//----------------------------------------------------------------------------
+// Visualizer_getConfig()
+//----------------------------------------------------------------------------
+// Purpose: Get input and output audio configuration.
+//
+// Inputs:
+// pContext: effect engine context
+// pConfig: pointer to effect_config_t structure holding input and output
+// configuration parameters
+//
+// Outputs:
+//
+//----------------------------------------------------------------------------
+
+void Visualizer_getConfig(VisualizerContext *pContext, effect_config_t *pConfig)
+{
+ memcpy(pConfig, &pContext->mConfig, sizeof(effect_config_t));
+}
+
+
+//----------------------------------------------------------------------------
// Visualizer_init()
//----------------------------------------------------------------------------
// Purpose: Initialize engine with default configuration.
@@ -144,7 +164,7 @@ int Visualizer_init(VisualizerContext *pContext)
pContext->mCaptureSize = VISUALIZER_CAPTURE_SIZE_MAX;
- Visualizer_configure(pContext, &pContext->mConfig);
+ Visualizer_setConfig(pContext, &pContext->mConfig);
return 0;
}
@@ -337,14 +357,21 @@ int Visualizer_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
}
*(int *) pReplyData = Visualizer_init(pContext);
break;
- case EFFECT_CMD_CONFIGURE:
+ case EFFECT_CMD_SET_CONFIG:
if (pCmdData == NULL || cmdSize != sizeof(effect_config_t)
|| pReplyData == NULL || *replySize != sizeof(int)) {
return -EINVAL;
}
- *(int *) pReplyData = Visualizer_configure(pContext,
+ *(int *) pReplyData = Visualizer_setConfig(pContext,
(effect_config_t *) pCmdData);
break;
+ case EFFECT_CMD_GET_CONFIG:
+ if (pReplyData == NULL ||
+ *replySize != sizeof(effect_config_t)) {
+ return -EINVAL;
+ }
+ Visualizer_getConfig(pContext, (effect_config_t *)pReplyData);
+ break;
case EFFECT_CMD_RESET:
Visualizer_reset(pContext);
break;