本文整理汇总了C++中fmod::DSP::getParameterInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ DSP::getParameterInfo方法的具体用法?C++ DSP::getParameterInfo怎么用?C++ DSP::getParameterInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fmod::DSP
的用法示例。
在下文中一共展示了DSP::getParameterInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FMODGMS_Effect_Get_Parameter
GMexport double FMODGMS_Effect_Get_Parameter(double e, double p)
{
int effectIndex = (int)round(e);
if ((effectIndex < 0) || (effectIndex >= (int)effectList.size()))
{
errorMessage = "Invalid effect index";
return GMS_error;
}
FMOD::DSP* effect = effectList[effectIndex];
int param = (int)round(p);
FMOD_DSP_PARAMETER_DESC* desc = NULL;
if (effect->getParameterInfo(param, &desc) != FMOD_OK)
{
errorMessage = "Could not get effect parameter info, probably invalid param index";
return GMS_error;
}
if (desc->type == FMOD_DSP_PARAMETER_TYPE_FLOAT)
{
float value;
if (effect->getParameterFloat(param, &value, NULL, 0) == FMOD_OK)
return (double)value;
}
else if (desc->type == FMOD_DSP_PARAMETER_TYPE_INT)
{
int value;
if (effect->getParameterInt(param, &value, NULL, 0) == FMOD_OK)
return (double)value;
}
else if (desc->type == FMOD_DSP_PARAMETER_TYPE_BOOL)
{
bool value;
if (effect->getParameterBool(param, &value, NULL, 0) == FMOD_OK)
return (double)value;
}
else
{
errorMessage = "Unsupported effect parameter type";
return GMS_error;
}
errorMessage = "Could not get effect parameter";
return GMS_error;
}
示例2: FMODGMS_Effect_Set_Parameter
//Sets a parameter a of effect e to value v. For parameters of different effects, see fmod_dsp_effects.h
GMexport double FMODGMS_Effect_Set_Parameter(double e, double p, double v)
{
int effectIndex = (int)round(e);
if ((effectIndex < 0) || (effectIndex >= (int)effectList.size()))
{
errorMessage = "Invalid effect index";
return GMS_error;
}
FMOD::DSP* effect = effectList[effectIndex];
int param = (int)round(p);
int value = (int)round(v);
FMOD_DSP_PARAMETER_DESC* desc = NULL;
if (effect->getParameterInfo(param, &desc) != FMOD_OK)
{
errorMessage = "Could not get effect parameter info, probably invalid param index";
return GMS_error;
}
if (desc->type == FMOD_DSP_PARAMETER_TYPE_FLOAT)
{
if (effect->setParameterFloat(param, (float)value) == FMOD_OK)
return FMODGMS_Util_ErrorChecker();
}
else if (desc->type == FMOD_DSP_PARAMETER_TYPE_INT)
{
if (effect->setParameterInt(param, (int)round(value)) == FMOD_OK)
return FMODGMS_Util_ErrorChecker();
}
else if (desc->type == FMOD_DSP_PARAMETER_TYPE_BOOL)
{
if (effect->setParameterBool(param, (bool)(value > 0.5)) == FMOD_OK)
return FMODGMS_Util_ErrorChecker();
}
else
{
errorMessage = "Unsupported effect parameter type";
return GMS_error;
}
errorMessage = "Could not set effect parameter";
return GMS_error;
}