diff options
author | Eric Laurent <elaurent@google.com> | 2011-11-05 09:32:35 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2011-11-05 09:32:35 -0700 |
commit | 3a8f6bedc33f607875298699df96dae295404582 (patch) | |
tree | ff0223bb9579981c5bb763af5e9ee10d62a27ca8 /media/libeffects | |
parent | 9162e6b2f9b9f6238090dba95b8c66c8397ff25b (diff) | |
parent | 914972be65bef1fd7e886825e7af27c29eff0a1e (diff) | |
download | frameworks_base-3a8f6bedc33f607875298699df96dae295404582.zip frameworks_base-3a8f6bedc33f607875298699df96dae295404582.tar.gz frameworks_base-3a8f6bedc33f607875298699df96dae295404582.tar.bz2 |
resolved conflicts for merge of 914972be to master
Change-Id: I15adb9040eaa206c31bb5a08ed5ee5b32967ba0a
Diffstat (limited to 'media/libeffects')
-rw-r--r-- | media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp index 66924da..b02ca38 100644 --- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp +++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp @@ -2462,6 +2462,9 @@ int Effect_setEnabled(EffectContext *pContext, bool enabled) ALOGV("\tEffect_setEnabled() type %d, enabled %d", pContext->EffectType, enabled); if (enabled) { + // Bass boost or Virtualizer can be temporarily disabled if playing over device speaker due + // to their nature. + bool tempDisabled = false; switch (pContext->EffectType) { case LVM_BASS_BOOST: if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) { @@ -2474,6 +2477,7 @@ int Effect_setEnabled(EffectContext *pContext, bool enabled) pContext->pBundledContext->SamplesToExitCountBb = (LVM_INT32)(pContext->pBundledContext->SamplesPerSecond*0.1); pContext->pBundledContext->bBassEnabled = LVM_TRUE; + tempDisabled = pContext->pBundledContext->bBassTempDisabled; break; case LVM_EQUALIZER: if (pContext->pBundledContext->bEqualizerEnabled == LVM_TRUE) { @@ -2498,6 +2502,7 @@ int Effect_setEnabled(EffectContext *pContext, bool enabled) pContext->pBundledContext->SamplesToExitCountVirt = (LVM_INT32)(pContext->pBundledContext->SamplesPerSecond*0.1); pContext->pBundledContext->bVirtualizerEnabled = LVM_TRUE; + tempDisabled = pContext->pBundledContext->bVirtualizerTempDisabled; break; case LVM_VOLUME: if (pContext->pBundledContext->bVolumeEnabled == LVM_TRUE) { @@ -2511,7 +2516,9 @@ int Effect_setEnabled(EffectContext *pContext, bool enabled) ALOGV("\tEffect_setEnabled() invalid effect type"); return -EINVAL; } - LvmEffect_enable(pContext); + if (!tempDisabled) { + LvmEffect_enable(pContext); + } } else { switch (pContext->EffectType) { case LVM_BASS_BOOST: @@ -3057,9 +3064,10 @@ int Effect_command(effect_handle_t self, ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE start"); uint32_t device = *(uint32_t *)pCmdData; - if(pContext->EffectType == LVM_BASS_BOOST){ - if((device == AUDIO_DEVICE_OUT_SPEAKER)||(device == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT)|| - (device == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER)){ + if (pContext->EffectType == LVM_BASS_BOOST) { + if((device == AUDIO_DEVICE_OUT_SPEAKER) || + (device == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT) || + (device == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER)){ ALOGV("\tEFFECT_CMD_SET_DEVICE device is invalid for LVM_BASS_BOOST %d", *(int32_t *)pCmdData); ALOGV("\tEFFECT_CMD_SET_DEVICE temporary disable LVM_BAS_BOOST"); @@ -3068,30 +3076,31 @@ int Effect_command(effect_handle_t self, // the effect must still report its original state as this can only be changed // by the ENABLE/DISABLE command - if(pContext->pBundledContext->bBassEnabled == LVM_TRUE){ + if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) { ALOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_BASS_BOOST %d", *(int32_t *)pCmdData); android::LvmEffect_disable(pContext); - pContext->pBundledContext->bBassTempDisabled = LVM_TRUE; } - }else{ + pContext->pBundledContext->bBassTempDisabled = LVM_TRUE; + } else { ALOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_BASS_BOOST %d", *(int32_t *)pCmdData); // If a device supports bassboost and the effect has been temporarily disabled // previously then re-enable it - if(pContext->pBundledContext->bBassTempDisabled == LVM_TRUE){ + if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) { ALOGV("\tEFFECT_CMD_SET_DEVICE re-enable LVM_BASS_BOOST %d", *(int32_t *)pCmdData); android::LvmEffect_enable(pContext); - pContext->pBundledContext->bBassTempDisabled = LVM_FALSE; } + pContext->pBundledContext->bBassTempDisabled = LVM_FALSE; } } - if(pContext->EffectType == LVM_VIRTUALIZER){ - if((device == AUDIO_DEVICE_OUT_SPEAKER)||(device == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT)|| - (device == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER)){ + if (pContext->EffectType == LVM_VIRTUALIZER) { + if((device == AUDIO_DEVICE_OUT_SPEAKER)|| + (device == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT)|| + (device == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER)){ ALOGV("\tEFFECT_CMD_SET_DEVICE device is invalid for LVM_VIRTUALIZER %d", *(int32_t *)pCmdData); ALOGV("\tEFFECT_CMD_SET_DEVICE temporary disable LVM_VIRTUALIZER"); @@ -3100,25 +3109,25 @@ int Effect_command(effect_handle_t self, // the effect must still report its original state as this can only be changed // by the ENABLE/DISABLE command - if(pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE){ + if (pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE) { ALOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_VIRTUALIZER %d", *(int32_t *)pCmdData); android::LvmEffect_disable(pContext); - pContext->pBundledContext->bVirtualizerTempDisabled = LVM_TRUE; } - }else{ + pContext->pBundledContext->bVirtualizerTempDisabled = LVM_TRUE; + } else { ALOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_VIRTUALIZER %d", *(int32_t *)pCmdData); // If a device supports virtualizer and the effect has been temporarily disabled // previously then re-enable it - if(pContext->pBundledContext->bVirtualizerTempDisabled == LVM_TRUE){ + if(pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE){ ALOGV("\tEFFECT_CMD_SET_DEVICE re-enable LVM_VIRTUALIZER %d", *(int32_t *)pCmdData); android::LvmEffect_enable(pContext); - pContext->pBundledContext->bVirtualizerTempDisabled = LVM_FALSE; } + pContext->pBundledContext->bVirtualizerTempDisabled = LVM_FALSE; } } ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE end"); |