summaryrefslogtreecommitdiffstats
path: root/media/libeffects/lvm
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-05-17 19:16:02 -0700
committerEric Laurent <elaurent@google.com>2011-05-27 15:15:00 -0700
commite1315cf0b63b4c14a77046519e6b01f6f60d74b0 (patch)
treec10fd288fd0d0d85c619e7e635a249765202fabc /media/libeffects/lvm
parenta3e73df3b402f1ebdbef7c8a8e3111d852e7bd35 (diff)
downloadframeworks_av-e1315cf0b63b4c14a77046519e6b01f6f60d74b0.zip
frameworks_av-e1315cf0b63b4c14a77046519e6b01f6f60d74b0.tar.gz
frameworks_av-e1315cf0b63b4c14a77046519e6b01f6f60d74b0.tar.bz2
New effect library API
Moved and renamed media/EffectApi.h to hardware/audio_effect.h Modified the effect library API to expose a library info structure containing an interface functions table. Also removed enums for audio channels, audio format and devices from effect API and use values from system/audio.h instead. Modified effects factory to support new library interface format and load libraries and efffects listed in audio_effects.conf file. The file audio_effects.conf is first loaded from /vendor/etc and then from /system/etc/audio_effects.conf if not found. Modified existing effect libraries to implement the new library interface. Change-Id: Ie52351e071b6d352fa2fbc06c3846686f8c45df9
Diffstat (limited to 'media/libeffects/lvm')
-rw-r--r--media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp133
-rwxr-xr-xmedia/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp125
2 files changed, 202 insertions, 56 deletions
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index 0b061db..21c451f 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -27,7 +27,7 @@
#include <EffectBundle.h>
-// effect_interface_t interface implementation for bass boost
+// effect_handle_t interface implementation for bass boost
extern "C" const struct effect_interface_s gLvmEffectInterface;
#define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc){\
@@ -71,7 +71,7 @@ int SessionIndex[LVM_MAX_SESSIONS];
const effect_descriptor_t gBassBoostDescriptor = {
{0x0634f220, 0xddd4, 0x11db, 0xa0fc, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b }},
{0x8631f300, 0x72e2, 0x11df, 0xb57e, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // uuid
- EFFECT_API_VERSION,
+ EFFECT_CONTROL_API_VERSION,
(EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_LAST | EFFECT_FLAG_DEVICE_IND
| EFFECT_FLAG_VOLUME_CTRL),
BASS_BOOST_CUP_LOAD_ARM9E,
@@ -84,7 +84,7 @@ const effect_descriptor_t gBassBoostDescriptor = {
const effect_descriptor_t gVirtualizerDescriptor = {
{0x37cc2c00, 0xdddd, 0x11db, 0x8577, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
{0x1d4033c0, 0x8557, 0x11df, 0x9f2d, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
- EFFECT_API_VERSION,
+ EFFECT_CONTROL_API_VERSION,
(EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_LAST | EFFECT_FLAG_DEVICE_IND
| EFFECT_FLAG_VOLUME_CTRL),
VIRTUALIZER_CUP_LOAD_ARM9E,
@@ -97,7 +97,7 @@ const effect_descriptor_t gVirtualizerDescriptor = {
const effect_descriptor_t gEqualizerDescriptor = {
{0x0bed4300, 0xddd6, 0x11db, 0x8f34, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // type
{0xce772f20, 0x847d, 0x11df, 0xbb17, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // uuid Eq NXP
- EFFECT_API_VERSION,
+ EFFECT_CONTROL_API_VERSION,
(EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_LAST | EFFECT_FLAG_VOLUME_CTRL),
EQUALIZER_CUP_LOAD_ARM9E,
BUNDLE_MEM_USAGE,
@@ -109,7 +109,7 @@ const effect_descriptor_t gEqualizerDescriptor = {
const effect_descriptor_t gVolumeDescriptor = {
{0x09e8ede0, 0xddde, 0x11db, 0xb4f6, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b }},
{0x119341a0, 0x8469, 0x11df, 0x81f9, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b }}, //uuid VOL NXP
- EFFECT_API_VERSION,
+ EFFECT_CONTROL_API_VERSION,
(EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_LAST | EFFECT_FLAG_VOLUME_CTRL),
VOLUME_CUP_LOAD_ARM9E,
BUNDLE_MEM_USAGE,
@@ -187,7 +187,7 @@ extern "C" int EffectQueryEffect(uint32_t index, effect_descriptor_t *pDescripto
extern "C" int EffectCreate(effect_uuid_t *uuid,
int32_t sessionId,
int32_t ioId,
- effect_interface_t *pInterface){
+ effect_handle_t *pHandle){
int ret = 0;
int sessionNo;
int i;
@@ -197,7 +197,7 @@ extern "C" int EffectCreate(effect_uuid_t *uuid,
LOGV("\n\tEffectCreate start session %d", sessionId);
- if (pInterface == NULL || uuid == NULL){
+ if (pHandle == NULL || uuid == NULL){
LOGV("\tLVM_ERROR : EffectCreate() called with NULL pointer");
ret = -EINVAL;
goto exit;
@@ -355,19 +355,19 @@ exit:
}
delete pContext;
}
- *pInterface = (effect_interface_t)NULL;
+ *pHandle = (effect_handle_t)NULL;
} else {
- *pInterface = (effect_interface_t)pContext;
+ *pHandle = (effect_handle_t)pContext;
}
LOGV("\tEffectCreate end..\n\n");
return ret;
} /* end EffectCreate */
-extern "C" int EffectRelease(effect_interface_t interface){
- LOGV("\n\tEffectRelease start %p", interface);
- EffectContext * pContext = (EffectContext *)interface;
+extern "C" int EffectRelease(effect_handle_t handle){
+ LOGV("\n\tEffectRelease start %p", handle);
+ EffectContext * pContext = (EffectContext *)handle;
- LOGV("\tEffectRelease start interface: %p, context %p", interface, pContext->pBundledContext);
+ LOGV("\tEffectRelease start handle: %p, context %p", handle, pContext->pBundledContext);
if (pContext == NULL){
LOGV("\tLVM_ERROR : EffectRelease called with NULL pointer");
return -EINVAL;
@@ -460,6 +460,34 @@ extern "C" int EffectRelease(effect_interface_t interface){
} /* end EffectRelease */
+extern "C" int EffectGetDescriptor(effect_uuid_t *uuid,
+ effect_descriptor_t *pDescriptor) {
+ const effect_descriptor_t *desc = NULL;
+
+ if (pDescriptor == NULL || uuid == NULL){
+ LOGV("EffectGetDescriptor() called with NULL pointer");
+ return -EINVAL;
+ }
+
+ if (memcmp(uuid, &gBassBoostDescriptor.uuid, sizeof(effect_uuid_t)) == 0) {
+ desc = &gBassBoostDescriptor;
+ } else if (memcmp(uuid, &gVirtualizerDescriptor.uuid, sizeof(effect_uuid_t)) == 0) {
+ desc = &gVirtualizerDescriptor;
+ } else if (memcmp(uuid, &gEqualizerDescriptor.uuid, sizeof(effect_uuid_t)) == 0) {
+ desc = &gEqualizerDescriptor;
+ } else if (memcmp(uuid, &gVolumeDescriptor.uuid, sizeof(effect_uuid_t)) == 0) {
+ desc = &gVolumeDescriptor;
+ }
+
+ if (desc == NULL) {
+ return -EINVAL;
+ }
+
+ memcpy(pDescriptor, desc, sizeof(effect_descriptor_t));
+
+ return 0;
+} /* end EffectGetDescriptor */
+
void LvmGlobalBundle_init(){
LOGV("\tLvmGlobalBundle_init start");
for(int i=0; i<LVM_MAX_SESSIONS; i++){
@@ -493,16 +521,16 @@ int LvmBundle_init(EffectContext *pContext){
LOGV("\tLvmBundle_init start");
pContext->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
- pContext->config.inputCfg.channels = CHANNEL_STEREO;
- pContext->config.inputCfg.format = SAMPLE_FORMAT_PCM_S15;
+ pContext->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
+ pContext->config.inputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
pContext->config.inputCfg.samplingRate = 44100;
pContext->config.inputCfg.bufferProvider.getBuffer = NULL;
pContext->config.inputCfg.bufferProvider.releaseBuffer = NULL;
pContext->config.inputCfg.bufferProvider.cookie = NULL;
pContext->config.inputCfg.mask = EFFECT_CONFIG_ALL;
pContext->config.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE;
- pContext->config.outputCfg.channels = CHANNEL_STEREO;
- pContext->config.outputCfg.format = SAMPLE_FORMAT_PCM_S15;
+ pContext->config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
+ pContext->config.outputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
pContext->config.outputCfg.samplingRate = 44100;
pContext->config.outputCfg.bufferProvider.getBuffer = NULL;
pContext->config.outputCfg.bufferProvider.releaseBuffer = NULL;
@@ -928,10 +956,10 @@ int Effect_configure(EffectContext *pContext, effect_config_t *pConfig){
CHECK_ARG(pConfig->inputCfg.samplingRate == pConfig->outputCfg.samplingRate);
CHECK_ARG(pConfig->inputCfg.channels == pConfig->outputCfg.channels);
CHECK_ARG(pConfig->inputCfg.format == pConfig->outputCfg.format);
- CHECK_ARG(pConfig->inputCfg.channels == CHANNEL_STEREO);
+ CHECK_ARG(pConfig->inputCfg.channels == AUDIO_CHANNEL_OUT_STEREO);
CHECK_ARG(pConfig->outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE
|| pConfig->outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE);
- CHECK_ARG(pConfig->inputCfg.format == SAMPLE_FORMAT_PCM_S15);
+ CHECK_ARG(pConfig->inputCfg.format == AUDIO_FORMAT_PCM_16_BIT);
memcpy(&pContext->config, pConfig, sizeof(effect_config_t));
@@ -2545,8 +2573,9 @@ int16_t LVC_Convert_VolToDb(uint32_t vol){
} // namespace
} // namespace
+extern "C" {
/* Effect Control Interface Implementation: Process */
-extern "C" int Effect_process(effect_interface_t self,
+int Effect_process(effect_handle_t self,
audio_buffer_t *inBuffer,
audio_buffer_t *outBuffer){
EffectContext * pContext = (EffectContext *) self;
@@ -2666,7 +2695,7 @@ extern "C" int Effect_process(effect_interface_t self,
} /* end Effect_process */
/* Effect Control Interface Implementation: Command */
-extern "C" int Effect_command(effect_interface_t self,
+int Effect_command(effect_handle_t self,
uint32_t cmdCode,
uint32_t cmdSize,
void *pCmdData,
@@ -3016,11 +3045,11 @@ extern "C" int Effect_command(effect_interface_t self,
case EFFECT_CMD_SET_DEVICE:
{
LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE start");
- audio_device_e device = *(audio_device_e *)pCmdData;
+ uint32_t device = *(uint32_t *)pCmdData;
if(pContext->EffectType == LVM_BASS_BOOST){
- if((device == DEVICE_SPEAKER)||(device == DEVICE_BLUETOOTH_SCO_CARKIT)||
- (device == DEVICE_BLUETOOTH_A2DP_SPEAKER)){
+ if((device == AUDIO_DEVICE_OUT_SPEAKER)||(device == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT)||
+ (device == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER)){
LOGV("\tEFFECT_CMD_SET_DEVICE device is invalid for LVM_BASS_BOOST %d",
*(int32_t *)pCmdData);
LOGV("\tEFFECT_CMD_SET_DEVICE temporary disable LVM_BAS_BOOST");
@@ -3051,8 +3080,8 @@ extern "C" int Effect_command(effect_interface_t self,
}
}
if(pContext->EffectType == LVM_VIRTUALIZER){
- if((device == DEVICE_SPEAKER)||(device == DEVICE_BLUETOOTH_SCO_CARKIT)||
- (device == DEVICE_BLUETOOTH_A2DP_SPEAKER)){
+ if((device == AUDIO_DEVICE_OUT_SPEAKER)||(device == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT)||
+ (device == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER)){
LOGV("\tEFFECT_CMD_SET_DEVICE device is invalid for LVM_VIRTUALIZER %d",
*(int32_t *)pCmdData);
LOGV("\tEFFECT_CMD_SET_DEVICE temporary disable LVM_VIRTUALIZER");
@@ -3164,9 +3193,57 @@ extern "C" int Effect_command(effect_interface_t self,
return 0;
} /* end Effect_command */
-// effect_interface_t interface implementation for effect
+/* Effect Control Interface Implementation: get_descriptor */
+int Effect_getDescriptor(effect_handle_t self,
+ effect_descriptor_t *pDescriptor)
+{
+ EffectContext * pContext = (EffectContext *) self;
+ const effect_descriptor_t *desc;
+
+ if (pContext == NULL || pDescriptor == NULL) {
+ LOGV("Effect_getDescriptor() invalid param");
+ return -EINVAL;
+ }
+
+ switch(pContext->EffectType) {
+ case LVM_BASS_BOOST:
+ desc = &android::gBassBoostDescriptor;
+ break;
+ case LVM_VIRTUALIZER:
+ desc = &android::gVirtualizerDescriptor;
+ break;
+ case LVM_EQUALIZER:
+ desc = &android::gEqualizerDescriptor;
+ break;
+ case LVM_VOLUME:
+ desc = &android::gVolumeDescriptor;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ memcpy(pDescriptor, desc, sizeof(effect_descriptor_t));
+
+ return 0;
+} /* end Effect_getDescriptor */
+
+// effect_handle_t interface implementation for effect
const struct effect_interface_s gLvmEffectInterface = {
Effect_process,
- Effect_command
+ Effect_command,
+ Effect_getDescriptor
}; /* end gLvmEffectInterface */
+audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = {
+ tag : AUDIO_EFFECT_LIBRARY_TAG,
+ version : EFFECT_LIBRARY_API_VERSION,
+ name : "Effect Bundle Library",
+ implementor : "NXP Software Ltd.",
+ query_num_effects : android::EffectQueryNumberEffects,
+ query_effect : android::EffectQueryEffect,
+ create_effect : android::EffectCreate,
+ release_effect : android::EffectRelease,
+ get_descriptor : android::EffectGetDescriptor,
+};
+
+}
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 9097e20..2727375 100755
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -27,7 +27,7 @@
#include <EffectReverb.h>
#include <LVREV.h>
-// effect_interface_t interface implementation for reverb
+// effect_handle_t interface implementation for reverb
extern "C" const struct effect_interface_s gReverbInterface;
#define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc){\
@@ -77,7 +77,7 @@ const static t_reverb_settings sReverbPresets[] = {
const effect_descriptor_t gAuxEnvReverbDescriptor = {
{ 0xc2e5d5f0, 0x94bd, 0x4763, 0x9cac, { 0x4e, 0x23, 0x4d, 0x06, 0x83, 0x9e } },
{ 0x4a387fc0, 0x8ab3, 0x11df, 0x8bad, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } },
- EFFECT_API_VERSION,
+ EFFECT_CONTROL_API_VERSION,
EFFECT_FLAG_TYPE_AUXILIARY,
LVREV_CUP_LOAD_ARM9E,
LVREV_MEM_USAGE,
@@ -89,7 +89,7 @@ const effect_descriptor_t gAuxEnvReverbDescriptor = {
static const effect_descriptor_t gInsertEnvReverbDescriptor = {
{0xc2e5d5f0, 0x94bd, 0x4763, 0x9cac, {0x4e, 0x23, 0x4d, 0x06, 0x83, 0x9e}},
{0xc7a511a0, 0xa3bb, 0x11df, 0x860e, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
- EFFECT_API_VERSION,
+ EFFECT_CONTROL_API_VERSION,
EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_FIRST | EFFECT_FLAG_VOLUME_CTRL,
LVREV_CUP_LOAD_ARM9E,
LVREV_MEM_USAGE,
@@ -101,7 +101,7 @@ static const effect_descriptor_t gInsertEnvReverbDescriptor = {
static const effect_descriptor_t gAuxPresetReverbDescriptor = {
{0x47382d60, 0xddd8, 0x11db, 0xbf3a, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
{0xf29a1400, 0xa3bb, 0x11df, 0x8ddc, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
- EFFECT_API_VERSION,
+ EFFECT_CONTROL_API_VERSION,
EFFECT_FLAG_TYPE_AUXILIARY,
LVREV_CUP_LOAD_ARM9E,
LVREV_MEM_USAGE,
@@ -113,7 +113,7 @@ static const effect_descriptor_t gAuxPresetReverbDescriptor = {
static const effect_descriptor_t gInsertPresetReverbDescriptor = {
{0x47382d60, 0xddd8, 0x11db, 0xbf3a, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
{0x172cdf00, 0xa3bc, 0x11df, 0xa72f, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
- EFFECT_API_VERSION,
+ EFFECT_CONTROL_API_VERSION,
EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_FIRST | EFFECT_FLAG_VOLUME_CTRL,
LVREV_CUP_LOAD_ARM9E,
LVREV_MEM_USAGE,
@@ -192,7 +192,8 @@ extern "C" int EffectQueryNumberEffects(uint32_t *pNumEffects){
return 0;
} /* end EffectQueryNumberEffects */
-extern "C" int EffectQueryEffect(uint32_t index, effect_descriptor_t *pDescriptor){
+extern "C" int EffectQueryEffect(uint32_t index,
+ effect_descriptor_t *pDescriptor){
LOGV("\n\tEffectQueryEffect start");
LOGV("\tEffectQueryEffect processing index %d", index);
if (pDescriptor == NULL){
@@ -211,7 +212,7 @@ extern "C" int EffectQueryEffect(uint32_t index, effect_descriptor_t *pDescripto
extern "C" int EffectCreate(effect_uuid_t *uuid,
int32_t sessionId,
int32_t ioId,
- effect_interface_t *pInterface){
+ effect_handle_t *pHandle){
int ret;
int i;
int length = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
@@ -219,7 +220,7 @@ extern "C" int EffectCreate(effect_uuid_t *uuid,
LOGV("\t\nEffectCreate start");
- if (pInterface == NULL || uuid == NULL){
+ if (pHandle == NULL || uuid == NULL){
LOGV("\tLVM_ERROR : EffectCreate() called with NULL pointer");
return -EINVAL;
}
@@ -270,7 +271,7 @@ extern "C" int EffectCreate(effect_uuid_t *uuid,
return ret;
}
- *pInterface = (effect_interface_t)pContext;
+ *pHandle = (effect_handle_t)pContext;
#ifdef LVM_PCM
pContext->PcmInPtr = NULL;
@@ -295,10 +296,10 @@ extern "C" int EffectCreate(effect_uuid_t *uuid,
return 0;
} /* end EffectCreate */
-extern "C" int EffectRelease(effect_interface_t interface){
- ReverbContext * pContext = (ReverbContext *)interface;
+extern "C" int EffectRelease(effect_handle_t handle){
+ ReverbContext * pContext = (ReverbContext *)handle;
- LOGV("\tEffectRelease %p", interface);
+ LOGV("\tEffectRelease %p", handle);
if (pContext == NULL){
LOGV("\tLVM_ERROR : EffectRelease called with NULL pointer");
return -EINVAL;
@@ -315,6 +316,28 @@ extern "C" int EffectRelease(effect_interface_t interface){
return 0;
} /* end EffectRelease */
+extern "C" int EffectGetDescriptor(effect_uuid_t *uuid,
+ effect_descriptor_t *pDescriptor) {
+ int i;
+ int length = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
+
+ if (pDescriptor == NULL || uuid == NULL){
+ LOGV("EffectGetDescriptor() called with NULL pointer");
+ return -EINVAL;
+ }
+
+ for (i = 0; i < length; i++) {
+ if (memcmp(uuid, &gDescriptors[i]->uuid, sizeof(effect_uuid_t)) == 0) {
+ memcpy(pDescriptor, gDescriptors[i], sizeof(effect_descriptor_t));
+ LOGV("EffectGetDescriptor - UUID matched Reverb type %d, UUID = %x",
+ i, gDescriptors[i]->uuid.timeLow);
+ return 0;
+ }
+ }
+
+ return -EINVAL;
+} /* end EffectGetDescriptor */
+
/* local functions */
#define CHECK_ARG(cond) { \
if (!(cond)) { \
@@ -418,9 +441,9 @@ int process( LVM_INT16 *pIn,
// Check that the input is either mono or stereo
- if (pContext->config.inputCfg.channels == CHANNEL_STEREO) {
+ if (pContext->config.inputCfg.channels == AUDIO_CHANNEL_OUT_STEREO) {
samplesPerFrame = 2;
- } else if (pContext->config.inputCfg.channels != CHANNEL_MONO) {
+ } else if (pContext->config.inputCfg.channels != AUDIO_CHANNEL_OUT_MONO) {
LOGV("\tLVREV_ERROR : process invalid PCM format");
return -EINVAL;
}
@@ -608,12 +631,12 @@ int Reverb_configure(ReverbContext *pContext, effect_config_t *pConfig){
CHECK_ARG(pConfig->inputCfg.samplingRate == pConfig->outputCfg.samplingRate);
CHECK_ARG(pConfig->inputCfg.format == pConfig->outputCfg.format);
- CHECK_ARG((pContext->auxiliary && pConfig->inputCfg.channels == CHANNEL_MONO) ||
- ((!pContext->auxiliary) && pConfig->inputCfg.channels == CHANNEL_STEREO));
- CHECK_ARG(pConfig->outputCfg.channels == CHANNEL_STEREO);
+ CHECK_ARG((pContext->auxiliary && pConfig->inputCfg.channels == AUDIO_CHANNEL_OUT_MONO) ||
+ ((!pContext->auxiliary) && pConfig->inputCfg.channels == AUDIO_CHANNEL_OUT_STEREO));
+ CHECK_ARG(pConfig->outputCfg.channels == AUDIO_CHANNEL_OUT_STEREO);
CHECK_ARG(pConfig->outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE
|| pConfig->outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE);
- CHECK_ARG(pConfig->inputCfg.format == SAMPLE_FORMAT_PCM_S15);
+ CHECK_ARG(pConfig->inputCfg.format == AUDIO_FORMAT_PCM_16_BIT);
if(pConfig->inputCfg.samplingRate != 44100){
return -EINVAL;
@@ -700,20 +723,20 @@ int Reverb_init(ReverbContext *pContext){
pContext->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
if (pContext->auxiliary) {
- pContext->config.inputCfg.channels = CHANNEL_MONO;
+ pContext->config.inputCfg.channels = AUDIO_CHANNEL_OUT_MONO;
} else {
- pContext->config.inputCfg.channels = CHANNEL_STEREO;
+ pContext->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
}
- pContext->config.inputCfg.format = SAMPLE_FORMAT_PCM_S15;
+ pContext->config.inputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
pContext->config.inputCfg.samplingRate = 44100;
pContext->config.inputCfg.bufferProvider.getBuffer = NULL;
pContext->config.inputCfg.bufferProvider.releaseBuffer = NULL;
pContext->config.inputCfg.bufferProvider.cookie = NULL;
pContext->config.inputCfg.mask = EFFECT_CONFIG_ALL;
pContext->config.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE;
- pContext->config.outputCfg.channels = CHANNEL_STEREO;
- pContext->config.outputCfg.format = SAMPLE_FORMAT_PCM_S15;
+ pContext->config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
+ pContext->config.outputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
pContext->config.outputCfg.samplingRate = 44100;
pContext->config.outputCfg.bufferProvider.getBuffer = NULL;
pContext->config.outputCfg.bufferProvider.releaseBuffer = NULL;
@@ -800,7 +823,7 @@ int Reverb_init(ReverbContext *pContext){
params.OperatingMode = LVM_MODE_ON;
params.SampleRate = LVM_FS_44100;
- if(pContext->config.inputCfg.channels == CHANNEL_MONO){
+ if(pContext->config.inputCfg.channels == AUDIO_CHANNEL_OUT_MONO){
params.SourceFormat = LVM_MONO;
} else {
params.SourceFormat = LVM_STEREO;
@@ -1832,8 +1855,9 @@ int Reverb_setParameter (ReverbContext *pContext, void *pParam, void *pValue){
} // namespace
} // namespace
+extern "C" {
/* Effect Control Interface Implementation: Process */
-extern "C" int Reverb_process(effect_interface_t self,
+int Reverb_process(effect_handle_t self,
audio_buffer_t *inBuffer,
audio_buffer_t *outBuffer){
android::ReverbContext * pContext = (android::ReverbContext *) self;
@@ -1868,7 +1892,7 @@ extern "C" int Reverb_process(effect_interface_t self,
} /* end Reverb_process */
/* Effect Control Interface Implementation: Command */
-extern "C" int Reverb_command(effect_interface_t self,
+int Reverb_command(effect_handle_t self,
uint32_t cmdCode,
uint32_t cmdSize,
void *pCmdData,
@@ -2075,9 +2099,54 @@ extern "C" int Reverb_command(effect_interface_t self,
return 0;
} /* end Reverb_command */
-// effect_interface_t interface implementation for Reverb effect
+/* Effect Control Interface Implementation: get_descriptor */
+int Reverb_getDescriptor(effect_handle_t self,
+ effect_descriptor_t *pDescriptor)
+{
+ android::ReverbContext * pContext = (android::ReverbContext *)self;
+ const effect_descriptor_t *desc;
+
+ if (pContext == NULL || pDescriptor == NULL) {
+ LOGV("Reverb_getDescriptor() invalid param");
+ return -EINVAL;
+ }
+
+ if (pContext->auxiliary) {
+ if (pContext->preset) {
+ desc = &android::gAuxPresetReverbDescriptor;
+ } else {
+ desc = &android::gAuxEnvReverbDescriptor;
+ }
+ } else {
+ if (pContext->preset) {
+ desc = &android::gInsertPresetReverbDescriptor;
+ } else {
+ desc = &android::gInsertEnvReverbDescriptor;
+ }
+ }
+
+ memcpy(pDescriptor, desc, sizeof(effect_descriptor_t));
+
+ return 0;
+} /* end Reverb_getDescriptor */
+
+// effect_handle_t interface implementation for Reverb effect
const struct effect_interface_s gReverbInterface = {
Reverb_process,
- Reverb_command
+ Reverb_command,
+ Reverb_getDescriptor
}; /* end gReverbInterface */
+audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = {
+ tag : AUDIO_EFFECT_LIBRARY_TAG,
+ version : EFFECT_LIBRARY_API_VERSION,
+ name : "Reverb Library",
+ implementor : "NXP Software Ltd.",
+ query_num_effects : android::EffectQueryNumberEffects,
+ query_effect : android::EffectQueryEffect,
+ create_effect : android::EffectCreate,
+ release_effect : android::EffectRelease,
+ get_descriptor : android::EffectGetDescriptor,
+};
+
+}