summaryrefslogtreecommitdiffstats
path: root/media/libeffects/lvm
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/lvm
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/lvm')
-rw-r--r--media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp67
-rwxr-xr-xmedia/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp75
2 files changed, 102 insertions, 40 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:{