From 23e1de74359f4bb1763aef0adfebe073122b032c Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Fri, 23 Jul 2010 00:19:11 -0700 Subject: Audio Effects: added methods to effects java classes to store and load current effect settings in a single call. Addional changes: - Fixed simulator build - Use effect interface UUIDs from OpenSL ES includes when available - Added cleanspec rules to remove now obsolete test effect libraries - Fixed bug in AudioEffect JNI setParameter function. Change-Id: Ic25ddb135e2cec5a68c181d727321f5ac7a1ab6b --- media/libeffects/lvm/wrapper/Android.mk | 66 ++++++++++++---------- .../libeffects/lvm/wrapper/Bundle/EffectBundle.cpp | 30 ++++++++-- media/libeffects/lvm/wrapper/Bundle/EffectBundle.h | 47 ++------------- media/libeffects/testlibs/EffectReverb.c | 12 ++-- media/libeffects/visualizer/Android.mk | 2 +- 5 files changed, 72 insertions(+), 85 deletions(-) (limited to 'media') diff --git a/media/libeffects/lvm/wrapper/Android.mk b/media/libeffects/lvm/wrapper/Android.mk index 4ebc443..7855dcd 100644 --- a/media/libeffects/lvm/wrapper/Android.mk +++ b/media/libeffects/lvm/wrapper/Android.mk @@ -1,30 +1,36 @@ -LOCAL_PATH:= $(call my-dir) - -# music bundle wrapper -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_ARM_MODE := arm - -LOCAL_SRC_FILES:= \ - Bundle/EffectBundle.cpp - -LOCAL_MODULE:= libbundlewrapper - -LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/soundfx - -LOCAL_PRELINK_MODULE := false - -LOCAL_STATIC_LIBRARIES += libmusicbundle - -LOCAL_SHARED_LIBRARIES := \ - libcutils \ - libdl - -LOCAL_C_INCLUDES += \ - $(LOCAL_PATH)/Bundle \ - $(LOCAL_PATH)/../lib/Common/lib/ \ - $(LOCAL_PATH)/../lib/Bundle/lib/ - - -include $(BUILD_SHARED_LIBRARY) +LOCAL_PATH:= $(call my-dir) + +# music bundle wrapper +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_ARM_MODE := arm + +LOCAL_SRC_FILES:= \ + Bundle/EffectBundle.cpp + +LOCAL_MODULE:= libbundlewrapper + +LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/soundfx + +LOCAL_PRELINK_MODULE := false + +LOCAL_STATIC_LIBRARIES += libmusicbundle + +LOCAL_SHARED_LIBRARIES := \ + libcutils \ + +ifeq ($(TARGET_SIMULATOR),true) +LOCAL_LDLIBS += -ldl +else +LOCAL_SHARED_LIBRARIES += libdl +endif + + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/Bundle \ + $(LOCAL_PATH)/../lib/Common/lib/ \ + $(LOCAL_PATH)/../lib/Bundle/lib/ + + +include $(BUILD_SHARED_LIBRARY) diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp index 5e91974..4440447 100644 --- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp +++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp @@ -1625,7 +1625,7 @@ int BassBoost_getParameter(EffectContext *pContext, //LOGV("\tBassBoost_getParameter start"); switch (param){ - case BASSBOOST_PARAM_STRENGTH_SUP: + case BASSBOOST_PARAM_STRENGTH_SUPPORTED: case BASSBOOST_PARAM_STRENGTH: if (*pValueSize != sizeof(int16_t)){ LOGV("\tLVM_ERROR : BassBoost_getParameter() invalid pValueSize2 %d", *pValueSize); @@ -1640,10 +1640,10 @@ int BassBoost_getParameter(EffectContext *pContext, } switch (param){ - case BASSBOOST_PARAM_STRENGTH_SUP: + case BASSBOOST_PARAM_STRENGTH_SUPPORTED: *(uint32_t *)pValue = 1; - //LOGV("\tBassBoost_getParameter() BASSBOOST_PARAM_STRENGTH_SUP Value is %d", + //LOGV("\tBassBoost_getParameter() BASSBOOST_PARAM_STRENGTH_SUPPORTED Value is %d", // *(uint32_t *)pValue); break; @@ -1735,7 +1735,7 @@ int Virtualizer_getParameter(EffectContext *pContext, //LOGV("\tVirtualizer_getParameter start"); switch (param){ - case VIRTUALIZER_PARAM_STRENGTH_SUP: + case VIRTUALIZER_PARAM_STRENGTH_SUPPORTED: case VIRTUALIZER_PARAM_STRENGTH: if (*pValueSize != sizeof(int16_t)){ LOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid pValueSize2 %d",*pValueSize); @@ -1750,10 +1750,10 @@ int Virtualizer_getParameter(EffectContext *pContext, } switch (param){ - case VIRTUALIZER_PARAM_STRENGTH_SUP: + case VIRTUALIZER_PARAM_STRENGTH_SUPPORTED: *(uint32_t *)pValue = 1; - //LOGV("\tVirtualizer_getParameter() VIRTUALIZER_PARAM_STRENGTH_SUP Value is %d", + //LOGV("\tVirtualizer_getParameter() VIRTUALIZER_PARAM_STRENGTH_SUPPORTED Value is %d", // *(uint32_t *)pValue); break; @@ -1876,6 +1876,14 @@ int Equalizer_getParameter(EffectContext *pContext, case EQ_PARAM_GET_PRESET_NAME: break; + case EQ_PARAM_PROPERTIES: + if (*pValueSize < (2 + FIVEBAND_NUMBANDS) * sizeof(uint16_t)) { + LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 1 %d", *pValueSize); + return -EINVAL; + } + *pValueSize = (2 + FIVEBAND_NUMBANDS) * sizeof(uint16_t); + break; + default: LOGV("\tLVM_ERROR : Equalizer_getParameter unknown param %d", param); return -EINVAL; @@ -1959,6 +1967,16 @@ int Equalizer_getParameter(EffectContext *pContext, // param2, gEqualizerPresets[param2].name, *pValueSize); break; + case EQ_PARAM_PROPERTIES: { + uint16_t *p = (uint16_t *)pValue; + LOGV("\tEqualizer_getParameter() EQ_PARAM_PROPERTIES"); + p[0] = EqualizerGetPreset(pContext); + p[1] = FIVEBAND_NUMBANDS; + for (int i = 0; i < FIVEBAND_NUMBANDS; i++) { + p[2 + i] = EqualizerGetBandLevel(pContext, i); + } + } break; + default: LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid param %d", param); status = -EINVAL; diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h index 029f843..d009bf9 100644 --- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h +++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h @@ -17,7 +17,9 @@ #ifndef ANDROID_EFFECTBUNDLE_H_ #define ANDROID_EFFECTBUNDLE_H_ -#include +#include +#include +#include #include #if __cplusplus @@ -29,22 +31,11 @@ extern "C" { #define MAX_CALL_SIZE 256 //#define LVM_PCM -//TODO: this should be included from each effect API include -static const effect_uuid_t SL_IID_BASSBOOST_ = { 0x0634f220, 0xddd4, 0x11db, 0xa0fc, - { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } }; -const effect_uuid_t * const SL_IID_BASSBOOST = &SL_IID_BASSBOOST_; - -static const effect_uuid_t SL_IID_EQUALIZER_ = { 0x0bed4300, 0xddd6, 0x11db, 0x8f34, - { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } }; -const effect_uuid_t * const SL_IID_EQUALIZER = &SL_IID_EQUALIZER_; - -static const effect_uuid_t SL_IID_VIRTUALIZER_ = { 0x37cc2c00, 0xdddd, 0x11db, 0x8577, - { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } }; -const effect_uuid_t * const SL_IID_VIRTUALIZER = &SL_IID_VIRTUALIZER_; - +#ifndef OPENSL_ES_H_ static const effect_uuid_t SL_IID_VOLUME_ = { 0x09e8ede0, 0xddde, 0x11db, 0xb4f6, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } }; const effect_uuid_t * const SL_IID_VOLUME = &SL_IID_VOLUME_; +#endif //OPENSL_ES_H_ typedef enum { @@ -112,34 +103,6 @@ struct EffectContext{ BundledEffectContext *pBundledContext; }; -//TODO: this should be included from each effect API include -/* enumerated parameter settings for BassBoost effect */ -typedef enum -{ - BASSBOOST_PARAM_STRENGTH_SUP, // type SLboolean = typedef SLuint32 - BASSBOOST_PARAM_STRENGTH // type SLpermille = typedef SLuint16 -} t_bassboost_params; - -/* enumerated parameter settings for Virtualizer effect */ -typedef enum -{ - VIRTUALIZER_PARAM_STRENGTH_SUP, // type SLboolean = typedef SLuint32 - VIRTUALIZER_PARAM_STRENGTH // type SLpermille = typedef SLuint16 -} t_virtualizer_params; - -/* enumerated parameter settings for Equalizer effect */ -typedef enum -{ - EQ_PARAM_NUM_BANDS, // Gets the number of frequency bands that the equalizer supports. - EQ_PARAM_LEVEL_RANGE, // Returns the minimum and maximum band levels supported. - EQ_PARAM_BAND_LEVEL, // Gets/Sets the gain set for the given equalizer band. - EQ_PARAM_CENTER_FREQ, // Gets the center frequency of the given band. - EQ_PARAM_BAND_FREQ_RANGE, // Gets the frequency range of the given frequency band. - EQ_PARAM_GET_BAND, // Gets the band that has the most effect on the given frequency. - EQ_PARAM_CUR_PRESET, // Gets/Sets the current preset. - EQ_PARAM_GET_NUM_OF_PRESETS, // Gets the total number of presets the equalizer supports. - EQ_PARAM_GET_PRESET_NAME // Gets the preset name based on the index. -} t_equalizer_params; /* enumerated parameter settings for Volume effect */ typedef enum diff --git a/media/libeffects/testlibs/EffectReverb.c b/media/libeffects/testlibs/EffectReverb.c index 2ce7558..3f9069f 100644 --- a/media/libeffects/testlibs/EffectReverb.c +++ b/media/libeffects/testlibs/EffectReverb.c @@ -688,7 +688,7 @@ int Reverb_getParameter(reverb_object_t *pReverb, int32_t param, size_t *pSize, void *pValue) { int32_t *pValue32; int16_t *pValue16; - t_reverb_properties *pProperties; + t_reverb_settings *pProperties; int32_t i; int32_t temp; int32_t temp2; @@ -727,7 +727,7 @@ int Reverb_getParameter(reverb_object_t *pReverb, int32_t param, size_t *pSize, break; case REVERB_PARAM_PROPERTIES: - size = sizeof(t_reverb_properties); + size = sizeof(t_reverb_settings); break; default: @@ -740,7 +740,7 @@ int Reverb_getParameter(reverb_object_t *pReverb, int32_t param, size_t *pSize, pValue32 = (int32_t *) pValue; pValue16 = (int16_t *) pValue; - pProperties = (t_reverb_properties *) pValue; + pProperties = (t_reverb_settings *) pValue; switch (param) { case REVERB_PARAM_BYPASS: @@ -971,7 +971,7 @@ int Reverb_setParameter(reverb_object_t *pReverb, int32_t param, size_t size, void *pValue) { int32_t value32; int16_t value16; - t_reverb_properties *pProperties; + t_reverb_settings *pProperties; int32_t i; int32_t temp; int32_t temp2; @@ -1019,7 +1019,7 @@ int Reverb_setParameter(reverb_object_t *pReverb, int32_t param, size_t size, break; case REVERB_PARAM_PROPERTIES: - paramSize = sizeof(t_reverb_properties); + paramSize = sizeof(t_reverb_settings); break; default: @@ -1035,7 +1035,7 @@ int Reverb_setParameter(reverb_object_t *pReverb, int32_t param, size_t size, } else if (paramSize == sizeof(int32_t)) { value32 = *(int32_t *) pValue; } else { - pProperties = (t_reverb_properties *) pValue; + pProperties = (t_reverb_settings *) pValue; } pPreset = &pReverb->m_sPreset.m_sPreset[pReverb->m_nNextRoom]; diff --git a/media/libeffects/visualizer/Android.mk b/media/libeffects/visualizer/Android.mk index 82cd925..48b45ff 100644 --- a/media/libeffects/visualizer/Android.mk +++ b/media/libeffects/visualizer/Android.mk @@ -15,7 +15,7 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/soundfx LOCAL_MODULE:= libvisualizer ifeq ($(TARGET_OS)-$(TARGET_SIMULATOR),linux-true) -LOCAL_LDLIBS += -ldlS +LOCAL_LDLIBS += -ldl endif ifneq ($(TARGET_SIMULATOR),true) -- cgit v1.1