Loading media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp +26 −17 Original line number Diff line number Diff line Loading @@ -2462,6 +2462,9 @@ int Effect_setEnabled(EffectContext *pContext, bool enabled) LOGV("\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) { Loading @@ -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) { Loading @@ -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) { Loading @@ -2511,7 +2516,9 @@ int Effect_setEnabled(EffectContext *pContext, bool enabled) LOGV("\tEffect_setEnabled() invalid effect type"); return -EINVAL; } if (!tempDisabled) { LvmEffect_enable(pContext); } } else { switch (pContext->EffectType) { case LVM_BASS_BOOST: Loading Loading @@ -3058,7 +3065,8 @@ int Effect_command(effect_handle_t self, 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)|| 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); Loading @@ -3072,8 +3080,8 @@ int Effect_command(effect_handle_t self, LOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_BASS_BOOST %d", *(int32_t *)pCmdData); android::LvmEffect_disable(pContext); pContext->pBundledContext->bBassTempDisabled = LVM_TRUE; } pContext->pBundledContext->bBassTempDisabled = LVM_TRUE; } else { LOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_BASS_BOOST %d", *(int32_t *)pCmdData); Loading @@ -3081,16 +3089,17 @@ int Effect_command(effect_handle_t self, // 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) { LOGV("\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)|| 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); Loading @@ -3104,8 +3113,8 @@ int Effect_command(effect_handle_t self, LOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_VIRTUALIZER %d", *(int32_t *)pCmdData); android::LvmEffect_disable(pContext); pContext->pBundledContext->bVirtualizerTempDisabled = LVM_TRUE; } pContext->pBundledContext->bVirtualizerTempDisabled = LVM_TRUE; } else { LOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_VIRTUALIZER %d", *(int32_t *)pCmdData); Loading @@ -3113,12 +3122,12 @@ int Effect_command(effect_handle_t self, // 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){ LOGV("\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; } } LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE end"); Loading Loading
media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp +26 −17 Original line number Diff line number Diff line Loading @@ -2462,6 +2462,9 @@ int Effect_setEnabled(EffectContext *pContext, bool enabled) LOGV("\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) { Loading @@ -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) { Loading @@ -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) { Loading @@ -2511,7 +2516,9 @@ int Effect_setEnabled(EffectContext *pContext, bool enabled) LOGV("\tEffect_setEnabled() invalid effect type"); return -EINVAL; } if (!tempDisabled) { LvmEffect_enable(pContext); } } else { switch (pContext->EffectType) { case LVM_BASS_BOOST: Loading Loading @@ -3058,7 +3065,8 @@ int Effect_command(effect_handle_t self, 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)|| 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); Loading @@ -3072,8 +3080,8 @@ int Effect_command(effect_handle_t self, LOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_BASS_BOOST %d", *(int32_t *)pCmdData); android::LvmEffect_disable(pContext); pContext->pBundledContext->bBassTempDisabled = LVM_TRUE; } pContext->pBundledContext->bBassTempDisabled = LVM_TRUE; } else { LOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_BASS_BOOST %d", *(int32_t *)pCmdData); Loading @@ -3081,16 +3089,17 @@ int Effect_command(effect_handle_t self, // 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) { LOGV("\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)|| 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); Loading @@ -3104,8 +3113,8 @@ int Effect_command(effect_handle_t self, LOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_VIRTUALIZER %d", *(int32_t *)pCmdData); android::LvmEffect_disable(pContext); pContext->pBundledContext->bVirtualizerTempDisabled = LVM_TRUE; } pContext->pBundledContext->bVirtualizerTempDisabled = LVM_TRUE; } else { LOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_VIRTUALIZER %d", *(int32_t *)pCmdData); Loading @@ -3113,12 +3122,12 @@ int Effect_command(effect_handle_t self, // 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){ LOGV("\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; } } LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE end"); Loading