| 862 | } |
| 863 | |
| 864 | IPLDirectEffectParams getDirectParams(FMOD_DSP_STATE* state, |
| 865 | IPLCoordinateSpace3 source, |
| 866 | IPLCoordinateSpace3 listener, |
| 867 | bool updatingOverallGain) |
| 868 | { |
| 869 | auto effect = reinterpret_cast<State*>(state->plugindata); |
| 870 | |
| 871 | auto hasSource = false; |
| 872 | IPLSimulationOutputs simulationOutputs{}; |
| 873 | if (effect->simulationSource[0]) |
| 874 | { |
| 875 | iplSourceGetOutputs(effect->simulationSource[0], IPL_SIMULATIONFLAGS_DIRECT, &simulationOutputs); |
| 876 | hasSource = true; |
| 877 | } |
| 878 | |
| 879 | auto params = simulationOutputs.direct; |
| 880 | params.transmissionType = effect->transmissionType; |
| 881 | |
| 882 | params.flags = static_cast<IPLDirectEffectFlags>(0); |
| 883 | if (effect->applyDistanceAttenuation == PARAMETER_DISABLE) |
| 884 | { |
| 885 | params.distanceAttenuation = 1.0f; |
| 886 | } |
| 887 | else |
| 888 | { |
| 889 | params.flags = static_cast<IPLDirectEffectFlags>(params.flags | IPL_DIRECTEFFECTFLAGS_APPLYDISTANCEATTENUATION); |
| 890 | if (effect->applyDistanceAttenuation == PARAMETER_USERDEFINED) |
| 891 | { |
| 892 | auto minDistance = effect->attenuationRangeSet ? effect->attenuationRange.min : effect->distanceAttenuationMinDistance; |
| 893 | auto maxDistance = effect->attenuationRangeSet ? effect->attenuationRange.max : effect->distanceAttenuationMaxDistance; |
| 894 | |
| 895 | state->functions->pan->getrolloffgain(state, effect->distanceAttenuationRolloffType, |
| 896 | distance(source.origin, listener.origin), |
| 897 | minDistance, maxDistance, ¶ms.distanceAttenuation); |
| 898 | } |
| 899 | else |
| 900 | { |
| 901 | IPLDistanceAttenuationModel distanceAttenuationModel{}; |
| 902 | distanceAttenuationModel.type = IPL_DISTANCEATTENUATIONTYPE_DEFAULT; |
| 903 | |
| 904 | params.distanceAttenuation = iplDistanceAttenuationCalculate(gContext, source.origin, listener.origin, &distanceAttenuationModel); |
| 905 | } |
| 906 | } |
| 907 | |
| 908 | if (effect->applyAirAbsorption == PARAMETER_DISABLE) |
| 909 | { |
| 910 | params.airAbsorption[0] = 1.0f; |
| 911 | params.airAbsorption[1] = 1.0f; |
| 912 | params.airAbsorption[2] = 1.0f; |
| 913 | } |
| 914 | else |
| 915 | { |
| 916 | params.flags = static_cast<IPLDirectEffectFlags>(params.flags | IPL_DIRECTEFFECTFLAGS_APPLYAIRABSORPTION); |
| 917 | if (effect->applyAirAbsorption == PARAMETER_USERDEFINED) |
| 918 | { |
| 919 | memcpy(params.airAbsorption, effect->airAbsorption, 3 * sizeof(float)); |
| 920 | } |
| 921 | else |
no test coverage detected