Fix DynamicSystem parameter types

This commit is contained in:
Iscle 2024-04-10 00:34:22 +02:00
parent ba6033cd3b
commit 11133beedd

View File

@ -559,22 +559,22 @@ int32_t ViperContext::handleSetParam(effect_param_t *pCmdParam, void *pReplyData
return 0; return 0;
} }
case PARAM_SET_DYNAMIC_SYSTEM_X_COEFFICIENTS: { case PARAM_SET_DYNAMIC_SYSTEM_X_COEFFICIENTS: {
if (pCmdParam->vsize != sizeof(uint32_t) * 2) { if (pCmdParam->vsize != sizeof(uint16_t) * 2) {
VIPER_LOGE("handleSetParam: PARAM_SET_DYNAMIC_SYSTEM_X_COEFFICIENTS called with invalid vsize = %d, expected vsize = %zu", pCmdParam->vsize, sizeof(uint32_t) * 2); VIPER_LOGE("handleSetParam: PARAM_SET_DYNAMIC_SYSTEM_X_COEFFICIENTS called with invalid vsize = %d, expected vsize = %zu", pCmdParam->vsize, sizeof(uint16_t) * 2);
return -EINVAL; return -EINVAL;
} }
uint32_t low = *(uint32_t *) (pCmdParam->data + vOffset); uint16_t low = *(uint16_t *) (pCmdParam->data + vOffset);
uint32_t high = *(uint32_t *) (pCmdParam->data + vOffset + sizeof(uint32_t)); uint16_t high = *(uint16_t *) (pCmdParam->data + vOffset + sizeof(uint16_t));
VIPER_LOGD("handleSetParam: PARAM_SET_DYNAMIC_SYSTEM_X_COEFFICIENTS called with low = %d, high = %d", low, high); VIPER_LOGD("handleSetParam: PARAM_SET_DYNAMIC_SYSTEM_X_COEFFICIENTS called with low = %d, high = %d", low, high);
viper.dynamicSystem.SetXCoeffs(low, high); viper.dynamicSystem.SetXCoeffs(low, high);
} }
case PARAM_SET_DYNAMIC_SYSTEM_Y_COEFFICIENTS: { case PARAM_SET_DYNAMIC_SYSTEM_Y_COEFFICIENTS: {
if (pCmdParam->vsize != sizeof(uint32_t) * 2) { if (pCmdParam->vsize != sizeof(uint16_t) * 2) {
VIPER_LOGE("handleSetParam: PARAM_SET_DYNAMIC_SYSTEM_Y_COEFFICIENTS called with invalid vsize = %d, expected vsize = %zu", pCmdParam->vsize, sizeof(uint32_t) * 2); VIPER_LOGE("handleSetParam: PARAM_SET_DYNAMIC_SYSTEM_Y_COEFFICIENTS called with invalid vsize = %d, expected vsize = %zu", pCmdParam->vsize, sizeof(uint16_t) * 2);
return -EINVAL; return -EINVAL;
} }
uint32_t low = *(uint32_t *) (pCmdParam->data + vOffset); uint16_t low = *(uint16_t *) (pCmdParam->data + vOffset);
uint32_t high = *(uint32_t *) (pCmdParam->data + vOffset + sizeof(uint32_t)); uint16_t high = *(uint16_t *) (pCmdParam->data + vOffset + sizeof(uint16_t));
VIPER_LOGD("handleSetParam: PARAM_SET_DYNAMIC_SYSTEM_Y_COEFFICIENTS called with low = %d, high = %d", low, high); VIPER_LOGD("handleSetParam: PARAM_SET_DYNAMIC_SYSTEM_Y_COEFFICIENTS called with low = %d, high = %d", low, high);
viper.dynamicSystem.SetYCoeffs(low, high); viper.dynamicSystem.SetYCoeffs(low, high);
} }
@ -589,11 +589,11 @@ int32_t ViperContext::handleSetParam(effect_param_t *pCmdParam, void *pReplyData
viper.dynamicSystem.SetSideGain(static_cast<float>(gainX) / 100.0f, static_cast<float>(gainY) / 100.0f); viper.dynamicSystem.SetSideGain(static_cast<float>(gainX) / 100.0f, static_cast<float>(gainY) / 100.0f);
} }
case PARAM_SET_DYNAMIC_SYSTEM_STRENGTH: { case PARAM_SET_DYNAMIC_SYSTEM_STRENGTH: {
if (pCmdParam->vsize != sizeof(uint8_t)) { if (pCmdParam->vsize != sizeof(uint16_t)) {
VIPER_LOGE("handleSetParam: PARAM_SET_DYNAMIC_SYSTEM_STRENGTH called with invalid vsize = %d, expected vsize = %zu", pCmdParam->vsize, sizeof(uint8_t)); VIPER_LOGE("handleSetParam: PARAM_SET_DYNAMIC_SYSTEM_STRENGTH called with invalid vsize = %d, expected vsize = %zu", pCmdParam->vsize, sizeof(uint16_t));
return -EINVAL; return -EINVAL;
} }
uint8_t strength = *(uint8_t *) (pCmdParam->data + vOffset); uint16_t strength = *(uint16_t *) (pCmdParam->data + vOffset);
VIPER_LOGD("handleSetParam: PARAM_SET_DYNAMIC_SYSTEM_STRENGTH called with strength = %d", strength); VIPER_LOGD("handleSetParam: PARAM_SET_DYNAMIC_SYSTEM_STRENGTH called with strength = %d", strength);
viper.dynamicSystem.SetBassGain(static_cast<float>(strength) / 100.0f); viper.dynamicSystem.SetBassGain(static_cast<float>(strength) / 100.0f);
} }