diff options
author | Chris Robinson <[email protected]> | 2013-06-05 01:52:49 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-06-05 01:52:49 -0700 |
commit | a371de080b01d9ea9dc38dd386b5903f7e4d8282 (patch) | |
tree | 2d6ad48f76bf1580430d0d6aa3dbd2bf7ab2d047 /Alc | |
parent | 0e0f70b2888c23debeefd80603f8c6f0c1ad4880 (diff) |
Silence some clang warnings
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALc.c | 1 | ||||
-rw-r--r-- | Alc/backends/wave.c | 4 | ||||
-rw-r--r-- | Alc/effects/reverb.c | 9 | ||||
-rw-r--r-- | Alc/panning.c | 6 |
4 files changed, 13 insertions, 7 deletions
@@ -859,7 +859,6 @@ static void alc_initconfig(void) size_t len; const char *next = str; - i = 0; do { str = next; next = strchr(str, ','); diff --git a/Alc/backends/wave.c b/Alc/backends/wave.c index be528c9a..416876be 100644 --- a/Alc/backends/wave.c +++ b/Alc/backends/wave.c @@ -146,7 +146,7 @@ static ALuint WaveProc(ALvoid *ptr) { fs = fwrite(data->buffer, frameSize, Device->UpdateSize, data->f); - fs = fs; + (void)fs; } if(ferror(data->f)) { @@ -257,7 +257,7 @@ static ALCboolean wave_reset_playback(ALCdevice *device) fwrite32le(channel_masks[channels], data->f); // 16 byte GUID, sub-type format val = fwrite(((bits==32) ? SUBTYPE_FLOAT : SUBTYPE_PCM), 1, 16, data->f); - val = val; + (void)val; fprintf(data->f, "data"); fwrite32le(0xFFFFFFFF, data->f); // 'data' header len; filled in at close diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 1fb30610..1db987c6 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -855,7 +855,14 @@ static inline ALfloat CalcDampingCoeff(ALfloat hfRatio, ALfloat length, ALfloat // Damping is done with a 1-pole filter, so g needs to be squared. g *= g; - coeff = lpCoeffCalc(g, cw); + if(g < 0.9999f) /* 1-epsilon */ + { + /* Be careful with gains < 0.001, as that causes the coefficient + * head towards 1, which will flatten the signal. */ + g = maxf(g, 0.001f); + coeff = (1 - g*cw - sqrtf(2*g*(1-cw) - g*g*(1 - cw*cw))) / + (1 - g); + } // Very low decay times will produce minimal output, so apply an // upper bound to the coefficient. diff --git a/Alc/panning.c b/Alc/panning.c index d8191d8d..02387336 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -161,7 +161,7 @@ ALvoid ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, SpeakerAngle[i] = device->SpeakerAngle[i]; /* Some easy special-cases first... */ - if(device->NumChan == 1 || hwidth >= F_PI) + if(device->NumChan <= 1 || hwidth >= F_PI) { /* Full coverage for all speakers. */ for(i = 0;i < device->NumChan;i++) @@ -203,7 +203,7 @@ ALvoid ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, * within -pi...+pi. */ if(angle > 0.0f) { - ALuint done = 0; + ALuint done; ALuint i = 0; while(i < device->NumChan && device->SpeakerAngle[i]-angle < -F_PI) i++; @@ -226,7 +226,7 @@ ALvoid ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, * we need to handle index 0. Because the iterators are unsigned, * they'll underflow and wrap to become 0xFFFFFFFF, which will * break as expected. */ - ALuint done = device->NumChan-1; + ALuint done; ALuint i = device->NumChan-1; while(i < device->NumChan && device->SpeakerAngle[i]-angle > F_PI) i--; |