コード例 #1
0
float FModulatorContinuousParams::GetValue(const FActiveSound& ActiveSound) const
{
	float ParamFloat = 0.f;

	if (!ActiveSound.GetFloatParameter(ParameterName, ParamFloat))
	{
		ParamFloat = Default;
	}

	if(ParamMode == MPM_Direct)
	{
		return ParamFloat;
	}
	else if(ParamMode == MPM_Abs)
	{
		ParamFloat = FMath::Abs(ParamFloat);
	}

	float Gradient;
	if(MaxInput <= MinInput)
	{
		Gradient = 0.f;
	}
	else
	{
		Gradient = (MaxOutput - MinOutput)/(MaxInput - MinInput);
	}

	const float ClampedParam = FMath::Clamp(ParamFloat, MinInput, MaxInput);

	return MinOutput + ((ClampedParam - MinInput) * Gradient);
}
コード例 #2
0
float USoundNodeParamCrossFade::GetCurrentDistance(FAudioDevice* AudioDevice, FActiveSound& ActiveSound, const FSoundParseParameters& ParseParams) const
{
	float ParamValue = 0.0f;
	
	ActiveSound.GetFloatParameter(ParamName, ParamValue);
	return ParamValue;
}