浏览该文件的文档.
37 namespace SpatialAudio {
40 namespace ReverbEstimation
53 const float meanX = 1.5f;
54 const float sdX = 1.11803399f;
60 float meanDiffDotProd = 0.0f;
61 for (
int i = 0; i < N; ++i)
63 const float yMeanDiff = absorptions[i] - meanY;
64 const float xMeanDiff = (float)i - meanX;
65 meanDiffDotProd += yMeanDiff * xMeanDiff;
66 sdY += yMeanDiff * yMeanDiff;
70 sdY = sqrtf(sdY / (
float)N);
71 const float correlationCoeff = (1.0f / (N - 1.0f)) * (meanDiffDotProd / (sdY * sdX));
72 return correlationCoeff * (sdY / sdX);
78 float surfaceArea = 0.0f;
79 float totalSurfaceArea = 0.0f;
84 for (
int textureIndex = 0; textureIndex < in_numTextures; ++textureIndex)
87 surfaceArea = in_surfaceAreas[textureIndex];
92 totalSurfaceArea += surfaceArea;
94 if (totalSurfaceArea > 0.0f)
107 AkReal32 in_surfaceAreaSquaredMeters,
108 AkReal32 in_environmentAverageAbsorption,
112 if (in_volumeCubicMeters <= 0.0f)
114 out_decayEstimate = 0.0f;
119 AKASSERT(
false &&
"AK::SpatialAudio::ReverbEstimation::EstimateT60Decay: Invalid surface area. in_SurfaceAreaSquaredMeters Must be >= AK_SA_MIN_ENVIRONMENT_SURFACE_AREA");
122 if (in_environmentAverageAbsorption < AK_SA_MIN_ENVIRONMENT_ABSORPTION || in_environmentAverageAbsorption > 1.0f)
124 AKASSERT(
false &&
"AK::SpatialAudio::ReverbEstimation::EstimateT60Decay: Invalid absorption value. in_EnvironmentAverageAbsorption Must be between AK_SA_MIN_ENVIRONMENT_ABSORPTION and 1");
128 out_decayEstimate = (0.161f * in_volumeCubicMeters) / (in_surfaceAreaSquaredMeters * in_environmentAverageAbsorption);
135 AkVector in_environmentExtentMeters,
136 AkReal32& out_timeToFirstReflectionMs,
140 if (in_speedOfSound <= 0.0f)
142 AKASSERT(
false &&
"AK::SpatialAudio::ReverbEstimation::EstimateTimeToFirstReflection: Invalid speed of sound. in_speedOfSound must be greater than 0.");
145 if (in_environmentExtentMeters.
X < 0.0f || in_environmentExtentMeters.
Y < 0.0f || in_environmentExtentMeters.
Z < 0.0f)
147 AKASSERT(
false &&
"AK::SpatialAudio::ReverbEstimation::EstimateTimeToFirstReflection: Invalid extent. All components must be positive numbers.");
150 const float minDimension =
AkMin(
AkMin(in_environmentExtentMeters.
X, in_environmentExtentMeters.
Y), in_environmentExtentMeters.
Z);
151 out_timeToFirstReflectionMs = (minDimension / in_speedOfSound) * 1000.0f;
162 float* in_surfaceAreas,
166 if (in_textures ==
nullptr || in_surfaceAreas ==
nullptr || in_numTextures == 0)
Definition of data structures for AkAudioObject
@ AK_Fail
The operation failed.
#define AK_EXTERNAPIFUNC(_type, _name)
AKRESULT
Standard function call result.
AKSOUNDENGINE_API AkReal32 EstimateHFDamping(AkAcousticTexture *in_textures, float *in_surfaceAreas, int in_numTextures)
AkReal32 fAbsorptionMidHigh
AKSOUNDENGINE_API AKRESULT EstimateT60Decay(AkReal32 in_volumeCubicMeters, AkReal32 in_surfaceAreaSquaredMeters, AkReal32 in_environmentAverageAbsorption, AkReal32 &out_decayEstimate)
float AkReal32
32-bit floating point
@ AK_Success
The operation was successful.
AKSOUNDENGINE_API AKRESULT EstimateTimeToFirstReflection(AkVector in_environmentExtentMeters, AkReal32 &out_timeToFirstReflectionMs, AkReal32 in_speedOfSound=343.0f)
#define AK_SA_MIN_ENVIRONMENT_SURFACE_AREA
float CalculateSlope(const AkAcousticTexture &texture)
#define AKASSERT(Condition)
void GetAverageAbsorptionValues(AkAcousticTexture *in_textures, float *in_surfaceAreas, int in_numTextures, AkAcousticTexture &out_average)
Calculate average absorption values using each of the textures in in_textures, weighted by their corr...
AkReal32 fAbsorptionMidLow
3D vector for some operations in 3D space. Typically intended only for localized calculations due to ...
介绍一下自己的项目。我们会竭力为您提供帮助。
来注册自己的项目,我们帮您快速入门,不带任何附加条件!
开始 Wwise 之旅