aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c60
-rw-r--r--Alc/panning.c62
2 files changed, 61 insertions, 61 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 34fd9d22..992d3e58 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -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);
diff --git a/Alc/panning.c b/Alc/panning.c
index 188844e6..10615570 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -102,7 +102,7 @@ static void SetSpeakerArrangement(const char *name, ALfloat SpeakerAngle[MaxChan
{
long angle = strtol(sep, NULL, 10);
if(angle >= -180 && angle <= 180)
- SpeakerAngle[i] = angle * F_PI/180.0f;
+ SpeakerAngle[i] = DEG2RAD(angle);
else
ERR("Invalid angle for speaker \"%s\": %ld\n", confkey, angle);
break;
@@ -351,7 +351,7 @@ ALvoid aluInitPanning(ALCdevice *Device)
case DevFmtMono:
Device->NumChan = 1;
Speaker2Chan[0] = FrontCenter;
- SpeakerAngle[0] = F_PI/180.0f * 0.0f;
+ SpeakerAngle[0] = DEG2RAD(0.0f);
layoutname = NULL;
break;
@@ -359,8 +359,8 @@ ALvoid aluInitPanning(ALCdevice *Device)
Device->NumChan = 2;
Speaker2Chan[0] = FrontLeft;
Speaker2Chan[1] = FrontRight;
- SpeakerAngle[0] = F_PI/180.0f * -90.0f;
- SpeakerAngle[1] = F_PI/180.0f * 90.0f;
+ SpeakerAngle[0] = DEG2RAD(-90.0f);
+ SpeakerAngle[1] = DEG2RAD( 90.0f);
layoutname = "layout_stereo";
break;
@@ -370,10 +370,10 @@ ALvoid aluInitPanning(ALCdevice *Device)
Speaker2Chan[1] = FrontLeft;
Speaker2Chan[2] = FrontRight;
Speaker2Chan[3] = BackRight;
- SpeakerAngle[0] = F_PI/180.0f * -135.0f;
- SpeakerAngle[1] = F_PI/180.0f * -45.0f;
- SpeakerAngle[2] = F_PI/180.0f * 45.0f;
- SpeakerAngle[3] = F_PI/180.0f * 135.0f;
+ SpeakerAngle[0] = DEG2RAD(-135.0f);
+ SpeakerAngle[1] = DEG2RAD( -45.0f);
+ SpeakerAngle[2] = DEG2RAD( 45.0f);
+ SpeakerAngle[3] = DEG2RAD( 135.0f);
layoutname = "layout_quad";
break;
@@ -384,11 +384,11 @@ ALvoid aluInitPanning(ALCdevice *Device)
Speaker2Chan[2] = FrontCenter;
Speaker2Chan[3] = FrontRight;
Speaker2Chan[4] = BackRight;
- SpeakerAngle[0] = F_PI/180.0f * -110.0f;
- SpeakerAngle[1] = F_PI/180.0f * -30.0f;
- SpeakerAngle[2] = F_PI/180.0f * 0.0f;
- SpeakerAngle[3] = F_PI/180.0f * 30.0f;
- SpeakerAngle[4] = F_PI/180.0f * 110.0f;
+ SpeakerAngle[0] = DEG2RAD(-110.0f);
+ SpeakerAngle[1] = DEG2RAD( -30.0f);
+ SpeakerAngle[2] = DEG2RAD( 0.0f);
+ SpeakerAngle[3] = DEG2RAD( 30.0f);
+ SpeakerAngle[4] = DEG2RAD( 110.0f);
layoutname = "layout_surround51";
break;
@@ -399,11 +399,11 @@ ALvoid aluInitPanning(ALCdevice *Device)
Speaker2Chan[2] = FrontCenter;
Speaker2Chan[3] = FrontRight;
Speaker2Chan[4] = SideRight;
- SpeakerAngle[0] = F_PI/180.0f * -90.0f;
- SpeakerAngle[1] = F_PI/180.0f * -30.0f;
- SpeakerAngle[2] = F_PI/180.0f * 0.0f;
- SpeakerAngle[3] = F_PI/180.0f * 30.0f;
- SpeakerAngle[4] = F_PI/180.0f * 90.0f;
+ SpeakerAngle[0] = DEG2RAD(-90.0f);
+ SpeakerAngle[1] = DEG2RAD(-30.0f);
+ SpeakerAngle[2] = DEG2RAD( 0.0f);
+ SpeakerAngle[3] = DEG2RAD( 30.0f);
+ SpeakerAngle[4] = DEG2RAD( 90.0f);
layoutname = "layout_side51";
break;
@@ -415,12 +415,12 @@ ALvoid aluInitPanning(ALCdevice *Device)
Speaker2Chan[3] = FrontRight;
Speaker2Chan[4] = SideRight;
Speaker2Chan[5] = BackCenter;
- SpeakerAngle[0] = F_PI/180.0f * -90.0f;
- SpeakerAngle[1] = F_PI/180.0f * -30.0f;
- SpeakerAngle[2] = F_PI/180.0f * 0.0f;
- SpeakerAngle[3] = F_PI/180.0f * 30.0f;
- SpeakerAngle[4] = F_PI/180.0f * 90.0f;
- SpeakerAngle[5] = F_PI/180.0f * 180.0f;
+ SpeakerAngle[0] = DEG2RAD(-90.0f);
+ SpeakerAngle[1] = DEG2RAD(-30.0f);
+ SpeakerAngle[2] = DEG2RAD( 0.0f);
+ SpeakerAngle[3] = DEG2RAD( 30.0f);
+ SpeakerAngle[4] = DEG2RAD( 90.0f);
+ SpeakerAngle[5] = DEG2RAD(180.0f);
layoutname = "layout_surround61";
break;
@@ -433,13 +433,13 @@ ALvoid aluInitPanning(ALCdevice *Device)
Speaker2Chan[4] = FrontRight;
Speaker2Chan[5] = SideRight;
Speaker2Chan[6] = BackRight;
- SpeakerAngle[0] = F_PI/180.0f * -150.0f;
- SpeakerAngle[1] = F_PI/180.0f * -90.0f;
- SpeakerAngle[2] = F_PI/180.0f * -30.0f;
- SpeakerAngle[3] = F_PI/180.0f * 0.0f;
- SpeakerAngle[4] = F_PI/180.0f * 30.0f;
- SpeakerAngle[5] = F_PI/180.0f * 90.0f;
- SpeakerAngle[6] = F_PI/180.0f * 150.0f;
+ SpeakerAngle[0] = DEG2RAD(-150.0f);
+ SpeakerAngle[1] = DEG2RAD( -90.0f);
+ SpeakerAngle[2] = DEG2RAD( -30.0f);
+ SpeakerAngle[3] = DEG2RAD( 0.0f);
+ SpeakerAngle[4] = DEG2RAD( 30.0f);
+ SpeakerAngle[5] = DEG2RAD( 90.0f);
+ SpeakerAngle[6] = DEG2RAD( 150.0f);
layoutname = "layout_surround71";
break;
}