From 764ea95781486f86c7be956e84cf97ab893ac07b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 3 Oct 2013 05:02:16 -0700 Subject: Use helpers to set channel gain arrays Also avoid unnecessary clearing. --- OpenAL32/Include/alu.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'OpenAL32/Include') diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index b389ec1e..076abea6 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -105,7 +105,24 @@ static inline ALfloat cubic(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat va ALvoid aluInitPanning(ALCdevice *Device); -ALvoid ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, ALfloat ingain, ALfloat *gains); +/** + * ComputeAngleGains + * + * Sets channel gains based on a given source's angle and its half-width. The + * angle and hwidth parameters are in radians. + */ +void ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, ALfloat ingain, ALfloat gains[MaxChannels]); + +/** + * SetGains + * + * Helper to set the appropriate channels to the specified gain. + */ +static inline void SetGains(const ALCdevice *device, ALfloat ingain, ALfloat gains[MaxChannels]) +{ + ComputeAngleGains(device, 0.0f, F_PI, ingain, gains); +} + ALvoid CalcSourceParams(struct ALsource *ALSource, const ALCcontext *ALContext); ALvoid CalcNonAttnSourceParams(struct ALsource *ALSource, const ALCcontext *ALContext); -- cgit v1.2.3