diff options
author | Chris Robinson <[email protected]> | 2013-10-03 05:02:16 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-10-03 05:02:16 -0700 |
commit | 764ea95781486f86c7be956e84cf97ab893ac07b (patch) | |
tree | a6fc6b17121a2f4cab499b97a59378470fb3cb75 /Alc/panning.c | |
parent | 99fa5911bc9f427c96fe800f94d31e4942805fd2 (diff) |
Use helpers to set channel gain arrays
Also avoid unnecessary clearing.
Diffstat (limited to 'Alc/panning.c')
-rw-r--r-- | Alc/panning.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Alc/panning.c b/Alc/panning.c index 02387336..188844e6 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -140,13 +140,7 @@ static void SetSpeakerArrangement(const char *name, ALfloat SpeakerAngle[MaxChan } -/** - * ComputeAngleGains - * - * Sets channel gains based on a given source's angle and its half-width. The - * angle and hwidth parameters are in radians. - */ -ALvoid ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, ALfloat ingain, ALfloat *gains) +void ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, ALfloat ingain, ALfloat gains[MaxChannels]) { ALfloat tmpgains[MaxChannels] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; enum Channel Speaker2Chan[MaxChannels]; @@ -164,6 +158,8 @@ ALvoid ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, if(device->NumChan <= 1 || hwidth >= F_PI) { /* Full coverage for all speakers. */ + for(i = 0;i < MaxChannels;i++) + gains[i] = 0.0f; for(i = 0;i < device->NumChan;i++) { enum Channel chan = Speaker2Chan[i]; @@ -174,6 +170,8 @@ ALvoid ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, if(hwidth <= 0.0f) { /* Infinitely small sound point. */ + for(i = 0;i < MaxChannels;i++) + gains[i] = 0.0f; for(i = 0;i < device->NumChan-1;i++) { if(angle >= SpeakerAngle[i] && angle < SpeakerAngle[i+1]) |