diff options
author | Chris Robinson <[email protected]> | 2015-11-06 10:27:28 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2015-11-06 10:27:28 -0800 |
commit | de74498cd97c18d0c6c4001079b95da0f404ce8f (patch) | |
tree | ffc04152b0b8bfe8161928c7fb8d921321f9f063 /Alc | |
parent | 858230f4528ad2f418f97414e3a8be46865c367c (diff) |
Use more accurate floating point literals
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALu.c | 12 | ||||
-rw-r--r-- | Alc/hrtf.c | 2 | ||||
-rw-r--r-- | Alc/panning.c | 68 |
3 files changed, 41 insertions, 41 deletions
@@ -589,12 +589,12 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A /* Build a rotate + conversion matrix (B-Format -> N3D), and include * scaling for first-order content. */ - scale = Device->AmbiScale * 1.7321f; + scale = Device->AmbiScale * 1.732050808f; aluMatrixSet(&matrix, - 1.4142f, 0.0f, 0.0f, 0.0f, - 0.0f, -N[0]*scale, N[1]*scale, -N[2]*scale, - 0.0f, U[0]*scale, -U[1]*scale, U[2]*scale, - 0.0f, -V[0]*scale, V[1]*scale, -V[2]*scale + 1.414213562f, 0.0f, 0.0f, 0.0f, + 0.0f, -N[0]*scale, N[1]*scale, -N[2]*scale, + 0.0f, U[0]*scale, -U[1]*scale, U[2]*scale, + 0.0f, -V[0]*scale, V[1]*scale, -V[2]*scale ); for(c = 0;c < num_channels;c++) @@ -617,7 +617,7 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A * sends. It also needs to be scaled by sqrt(2) to account for the * signal being scaled by sqrt(1/2). */ - voice->Send[i].Gains[0].Target = WetGain[i] * 1.4142f; + voice->Send[i].Gains[0].Target = WetGain[i] * 1.414213562f; for(c = 1;c < num_channels;c++) voice->Send[i].Gains[c].Target = 0.0f; UpdateWetStepping(&voice->Send[i], num_channels, (voice->Send[i].Moving ? 64 : 0)); @@ -372,7 +372,7 @@ void GetBFormatHrtfCoeffs(const struct Hrtf *Hrtf, const ALuint num_chans, ALflo y = sinf(-az) * cosf(elev); z = sinf(elev); - ambi_coeffs[0] = 1.4142f; + ambi_coeffs[0] = 1.414213562f; ambi_coeffs[1] = x; ambi_coeffs[2] = y; ambi_coeffs[3] = z; diff --git a/Alc/panning.c b/Alc/panning.c index c1e42dce..6305bff7 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -63,22 +63,22 @@ static const ALuint FuMa2ACN[MAX_AMBI_COEFFS] = { * coefficients. */ static const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS] = { - 1.4142f, /* ACN 0 (W), sqrt(2) */ - 1.7321f, /* ACN 1 (Y), sqrt(3) */ - 1.7321f, /* ACN 2 (Z), sqrt(3) */ - 1.7321f, /* ACN 3 (X), sqrt(3) */ - 1.9365f, /* ACN 4 (V), sqrt(15)/2 */ - 1.9365f, /* ACN 5 (T), sqrt(15)/2 */ - 2.2361f, /* ACN 6 (R), sqrt(5) */ - 1.9365f, /* ACN 7 (S), sqrt(15)/2 */ - 1.9365f, /* ACN 8 (U), sqrt(15)/2 */ - 2.0917f, /* ACN 9 (Q), sqrt(35/8) */ - 1.9720f, /* ACN 10 (O), sqrt(35)/3 */ - 2.2311f, /* ACN 11 (M), sqrt(224/45) */ - 2.6458f, /* ACN 12 (K), sqrt(7) */ - 2.2311f, /* ACN 13 (L), sqrt(224/45) */ - 1.9720f, /* ACN 14 (N), sqrt(35)/3 */ - 2.0917f, /* ACN 15 (P), sqrt(35/8) */ + 1.414213562f, /* ACN 0 (W), sqrt(2) */ + 1.732050808f, /* ACN 1 (Y), sqrt(3) */ + 1.732050808f, /* ACN 2 (Z), sqrt(3) */ + 1.732050808f, /* ACN 3 (X), sqrt(3) */ + 1.936491673f, /* ACN 4 (V), sqrt(15)/2 */ + 1.936491673f, /* ACN 5 (T), sqrt(15)/2 */ + 2.236067978f, /* ACN 6 (R), sqrt(5) */ + 1.936491673f, /* ACN 7 (S), sqrt(15)/2 */ + 1.936491673f, /* ACN 8 (U), sqrt(15)/2 */ + 2.091650066f, /* ACN 9 (Q), sqrt(35/8) */ + 1.972026594f, /* ACN 10 (O), sqrt(35)/3 */ + 2.231093404f, /* ACN 11 (M), sqrt(224/45) */ + 2.645751311f, /* ACN 12 (K), sqrt(7) */ + 2.231093404f, /* ACN 13 (L), sqrt(224/45) */ + 1.972026594f, /* ACN 14 (N), sqrt(35)/3 */ + 2.091650066f, /* ACN 15 (P), sqrt(35/8) */ }; @@ -119,23 +119,23 @@ void ComputeDirectionalGains(const ALCdevice *device, const ALfloat dir[3], ALfl /* Zeroth-order */ coeffs[0] = 1.0f; /* ACN 0 = 1 */ /* First-order */ - coeffs[1] = 1.7321f * y; /* ACN 1 = sqrt(3) * Y */ - coeffs[2] = 1.7321f * z; /* ACN 2 = sqrt(3) * Z */ - coeffs[3] = 1.7321f * x; /* ACN 3 = sqrt(3) * X */ + coeffs[1] = 1.732050808f * y; /* ACN 1 = sqrt(3) * Y */ + coeffs[2] = 1.732050808f * z; /* ACN 2 = sqrt(3) * Z */ + coeffs[3] = 1.732050808f * x; /* ACN 3 = sqrt(3) * X */ /* Second-order */ - coeffs[4] = 3.8730f * x * y; /* ACN 4 = sqrt(15) * X * Y */ - coeffs[5] = 3.8730f * y * z; /* ACN 5 = sqrt(15) * Y * Z */ - coeffs[6] = 1.1180f * (3.0f*z*z - 1.0f); /* ACN 6 = sqrt(5)/2 * (3*Z*Z - 1) */ - coeffs[7] = 3.8730f * x * z; /* ACN 7 = sqrt(15) * X * Z */ - coeffs[8] = 1.9365f * (x*x - y*y); /* ACN 8 = sqrt(15)/2 * (X*X - Y*Y) */ + coeffs[4] = 3.872983346f * x * y; /* ACN 4 = sqrt(15) * X * Y */ + coeffs[5] = 3.872983346f * y * z; /* ACN 5 = sqrt(15) * Y * Z */ + coeffs[6] = 1.118033989f * (3.0f*z*z - 1.0f); /* ACN 6 = sqrt(5)/2 * (3*Z*Z - 1) */ + coeffs[7] = 3.872983346f * x * z; /* ACN 7 = sqrt(15) * X * Z */ + coeffs[8] = 1.936491673f * (x*x - y*y); /* ACN 8 = sqrt(15)/2 * (X*X - Y*Y) */ /* Third-order */ - coeffs[9] = 2.0917f * y * (3.0f*x*x - y*y); /* ACN 9 = sqrt(35/8) * Y * (3*X*X - Y*Y) */ - coeffs[10] = 10.2470f * z * x * y; /* ACN 10 = sqrt(105) * Z * X * Y */ - coeffs[11] = 1.6292f * y * (5.0f*z*z - 1.0f); /* ACN 11 = sqrt(21/8) * Y * (5*Z*Z - 1) */ - coeffs[12] = 1.3229f * z * (5.0f*z*z - 3.0f); /* ACN 12 = sqrt(7)/2 * Z * (5*Z*Z - 3) */ - coeffs[13] = 1.6292f * x * (5.0f*z*z - 1.0f); /* ACN 13 = sqrt(21/8) * X * (5*Z*Z - 1) */ - coeffs[14] = 5.1235f * z * (x*x - y*y); /* ACN 14 = sqrt(105)/2 * Z * (X*X - Y*Y) */ - coeffs[15] = 2.0917f * x * (x*x - 3.0f*y*y); /* ACN 15 = sqrt(35/8) * X * (X*X - 3*Y*Y) */ + coeffs[9] = 2.091650066f * y * (3.0f*x*x - y*y); /* ACN 9 = sqrt(35/8) * Y * (3*X*X - Y*Y) */ + coeffs[10] = 10.246950766f * z * x * y; /* ACN 10 = sqrt(105) * Z * X * Y */ + coeffs[11] = 1.620185175f * y * (5.0f*z*z - 1.0f); /* ACN 11 = sqrt(21/8) * Y * (5*Z*Z - 1) */ + coeffs[12] = 1.322875656f * z * (5.0f*z*z - 3.0f); /* ACN 12 = sqrt(7)/2 * Z * (5*Z*Z - 3) */ + coeffs[13] = 1.620185175f * x * (5.0f*z*z - 1.0f); /* ACN 13 = sqrt(21/8) * X * (5*Z*Z - 1) */ + coeffs[14] = 5.123475383f * z * (x*x - y*y); /* ACN 14 = sqrt(105)/2 * Z * (X*X - Y*Y) */ + coeffs[15] = 2.091650066f * x * (x*x - 3.0f*y*y); /* ACN 15 = sqrt(35/8) * X * (X*X - 3*Y*Y) */ for(i = 0;i < device->NumChannels;i++) { @@ -421,10 +421,10 @@ ALvoid aluInitPanning(ALCdevice *device) * Toolbox. SetChannelMap will convert them to N3D. */ static const ChannelMap MonoCfg[1] = { - { FrontCenter, { 1.4142f } }, + { FrontCenter, { 1.414213562f } }, }, StereoCfg[2] = { - { FrontLeft, { 0.7071f, 0.0f, 0.5f, 0.0f } }, - { FrontRight, { 0.7071f, 0.0f, -0.5f, 0.0f } }, + { FrontLeft, { 0.707106781f, 0.0f, 0.5f, 0.0f } }, + { FrontRight, { 0.707106781f, 0.0f, -0.5f, 0.0f } }, }, QuadCfg[4] = { { FrontLeft, { 0.353553f, 0.306184f, 0.306184f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.117186f } }, { FrontRight, { 0.353553f, 0.306184f, -0.306184f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.117186f } }, |