Go to the documentation of this file.
38 namespace SpatialAudio {
41 namespace ReverbEstimation
54 const float meanX = 1.5f;
55 const float sdX = 1.11803399;
61 float meanDiffDotProd = 0.0f;
62 for (
int i = 0; i < N; ++i)
64 const float yMeanDiff = absorptions[i] - meanY;
65 const float xMeanDiff = (float)i - meanX;
66 meanDiffDotProd += yMeanDiff * xMeanDiff;
67 sdY += yMeanDiff * yMeanDiff;
71 sdY = sqrtf(sdY / (
float)N);
72 const float correlationCoeff = (1.0f / (N - 1.0f)) * (meanDiffDotProd / (sdY * sdX));
73 return correlationCoeff * (sdY / sdX);
79 float surfaceArea = 0.0f;
80 float totalSurfaceArea = 0.0f;
85 for (
int textureIndex = 0; textureIndex < in_numTextures; ++textureIndex)
88 surfaceArea = in_surfaceAreas[textureIndex];
93 totalSurfaceArea += surfaceArea;
106 AkReal32 in_surfaceAreaSquaredMeters,
107 AkReal32 in_environmentAverageAbsorption,
111 if (in_volumeCubicMeters <= 0.0f)
113 out_decayEstimate = 0.0f;
118 AKASSERT(
false &&
"AK::SpatialAudio::ReverbEstimation::EstimateT60Decay: Invalid surface area. in_SurfaceAreaSquaredMeters Must be >= AK_SA_MIN_ENVIRONMENT_SURFACE_AREA");
121 if (in_environmentAverageAbsorption < AK_SA_MIN_ENVIRONMENT_ABSORPTION || in_environmentAverageAbsorption > 1.0f)
123 AKASSERT(
false &&
"AK::SpatialAudio::ReverbEstimation::EstimateT60Decay: Invalid absorption value. in_EnvironmentAverageAbsorption Must be between AK_SA_MIN_ENVIRONMENT_ABSORPTION and 1");
127 out_decayEstimate = (0.161f * in_volumeCubicMeters) / (in_surfaceAreaSquaredMeters * in_environmentAverageAbsorption);
134 AkVector in_environmentExtentMeters,
135 AkReal32& out_timeToFirstReflectionMs,
139 if (in_speedOfSound <= 0.0f)
141 AKASSERT(
false &&
"AK::SpatialAudio::ReverbEstimation::EstimateTimeToFirstReflection: Invalid speed of sound. in_speedOfSound must be greater than 0.");
144 if (in_environmentExtentMeters.
X < 0.0f || in_environmentExtentMeters.
Y < 0.0f || in_environmentExtentMeters.
Z < 0.0f)
146 AKASSERT(
false &&
"AK::SpatialAudio::ReverbEstimation::EstimateTimeToFirstReflection: Invalid extent. All components must be positive numbers.");
149 const float minDimension =
AkMin(
AkMin(in_environmentExtentMeters.
X, in_environmentExtentMeters.
Y), in_environmentExtentMeters.
Z);
150 out_timeToFirstReflectionMs = minDimension / in_speedOfSound;
160 float* in_surfaceAreas,
165 if (in_textures ==
nullptr || in_surfaceAreas ==
nullptr || in_numTextures == 0)
167 out_hfDamping = 0.0f;
AKSOUNDENGINE_API AKRESULT EstimateHFDamping(AkAcousticTexture *in_textures, float *in_surfaceAreas, int in_numTextures, AkReal32 &out_hfDamping)
@ AK_Fail
The operation failed.
#define AK_EXTERNAPIFUNC(_type, _name)
AKRESULT
Standard function call result.
AkReal32 fAbsorptionMidHigh
AKSOUNDENGINE_API AKRESULT EstimateT60Decay(AkReal32 in_volumeCubicMeters, AkReal32 in_surfaceAreaSquaredMeters, AkReal32 in_environmentAverageAbsorption, AkReal32 &out_decayEstimate)
@ 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
Tell us about your project. We're here to help.
Register your project and we'll help you get started with no strings attached!
Get started with Wwise