diff options
author | Chris Robinson <[email protected]> | 2013-10-08 08:29:14 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-10-08 12:39:22 -0700 |
commit | 11365b42c7fedaef61d7123c390c429260eae52f (patch) | |
tree | a4d2c61c8729c4b78b0de49fb12ce5018d7297ef /Alc/ALu.c | |
parent | b42fcce014da2c866a3d64f8f4831baed2f46e6f (diff) |
Use helper macros to convert between degrees and radians
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r-- | Alc/ALu.c | 60 |
1 files changed, 30 insertions, 30 deletions
@@ -194,49 +194,49 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext) { static const struct ChanMap MonoMap[1] = { { FrontCenter, 0.0f } }; static const struct ChanMap StereoMap[2] = { - { FrontLeft, -30.0f * F_PI/180.0f }, - { FrontRight, 30.0f * F_PI/180.0f } + { FrontLeft, DEG2RAD(-30.0f) }, + { FrontRight, DEG2RAD( 30.0f) } }; static const struct ChanMap StereoWideMap[2] = { - { FrontLeft, -90.0f * F_PI/180.0f }, - { FrontRight, 90.0f * F_PI/180.0f } + { FrontLeft, DEG2RAD(-90.0f) }, + { FrontRight, DEG2RAD( 90.0f) } }; static const struct ChanMap RearMap[2] = { - { BackLeft, -150.0f * F_PI/180.0f }, - { BackRight, 150.0f * F_PI/180.0f } + { BackLeft, DEG2RAD(-150.0f) }, + { BackRight, DEG2RAD( 150.0f) } }; static const struct ChanMap QuadMap[4] = { - { FrontLeft, -45.0f * F_PI/180.0f }, - { FrontRight, 45.0f * F_PI/180.0f }, - { BackLeft, -135.0f * F_PI/180.0f }, - { BackRight, 135.0f * F_PI/180.0f } + { FrontLeft, DEG2RAD( -45.0f) }, + { FrontRight, DEG2RAD( 45.0f) }, + { BackLeft, DEG2RAD(-135.0f) }, + { BackRight, DEG2RAD( 135.0f) } }; static const struct ChanMap X51Map[6] = { - { FrontLeft, -30.0f * F_PI/180.0f }, - { FrontRight, 30.0f * F_PI/180.0f }, - { FrontCenter, 0.0f * F_PI/180.0f }, + { FrontLeft, DEG2RAD( -30.0f) }, + { FrontRight, DEG2RAD( 30.0f) }, + { FrontCenter, DEG2RAD( 0.0f) }, { LFE, 0.0f }, - { BackLeft, -110.0f * F_PI/180.0f }, - { BackRight, 110.0f * F_PI/180.0f } + { BackLeft, DEG2RAD(-110.0f) }, + { BackRight, DEG2RAD( 110.0f) } }; static const struct ChanMap X61Map[7] = { - { FrontLeft, -30.0f * F_PI/180.0f }, - { FrontRight, 30.0f * F_PI/180.0f }, - { FrontCenter, 0.0f * F_PI/180.0f }, + { FrontLeft, DEG2RAD(-30.0f) }, + { FrontRight, DEG2RAD( 30.0f) }, + { FrontCenter, DEG2RAD( 0.0f) }, { LFE, 0.0f }, - { BackCenter, 180.0f * F_PI/180.0f }, - { SideLeft, -90.0f * F_PI/180.0f }, - { SideRight, 90.0f * F_PI/180.0f } + { BackCenter, DEG2RAD(180.0f) }, + { SideLeft, DEG2RAD(-90.0f) }, + { SideRight, DEG2RAD( 90.0f) } }; static const struct ChanMap X71Map[8] = { - { FrontLeft, -30.0f * F_PI/180.0f }, - { FrontRight, 30.0f * F_PI/180.0f }, - { FrontCenter, 0.0f * F_PI/180.0f }, + { FrontLeft, DEG2RAD( -30.0f) }, + { FrontRight, DEG2RAD( 30.0f) }, + { FrontCenter, DEG2RAD( 0.0f) }, { LFE, 0.0f }, - { BackLeft, -150.0f * F_PI/180.0f }, - { BackRight, 150.0f * F_PI/180.0f }, - { SideLeft, -90.0f * F_PI/180.0f }, - { SideRight, 90.0f * F_PI/180.0f } + { BackLeft, DEG2RAD(-150.0f) }, + { BackRight, DEG2RAD( 150.0f) }, + { SideLeft, DEG2RAD( -90.0f) }, + { SideRight, DEG2RAD( 90.0f) } }; ALCdevice *Device = ALContext->Device; @@ -339,7 +339,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext) else { chans = StereoWideMap; - hwidth = 60.0f * F_PI/180.0f; + hwidth = DEG2RAD(60.0f); } num_channels = 2; break; @@ -718,7 +718,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) } /* Calculate directional soundcones */ - Angle = acosf(aluDotproduct(Direction,SourceToListener)) * ConeScale * (360.0f/F_PI); + Angle = RAD2DEG(acosf(aluDotproduct(Direction,SourceToListener)) * ConeScale) * 2.0f; if(Angle > InnerAngle && Angle <= OuterAngle) { ALfloat scale = (Angle-InnerAngle) / (OuterAngle-InnerAngle); |