Silence some clang warnings

This commit is contained in:
Chris Robinson
2013-06-05 01:52:49 -07:00
parent 0e0f70b288
commit a371de080b
8 changed files with 22 additions and 38 deletions
-1
View File
@@ -859,7 +859,6 @@ static void alc_initconfig(void)
size_t len;
const char *next = str;
i = 0;
do {
str = next;
next = strchr(str, ',');
+2 -2
View File
@@ -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
+8 -1
View File
@@ -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.
+3 -3
View File
@@ -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--;
-6
View File
@@ -9,12 +9,6 @@ extern "C" {
#define LOWPASSFREQREF (5000)
/* Calculates the low-pass filter coefficient given the pre-scaled gain and
* cos(w) value. Note that g should be pre-scaled (sqr(gain) for one-pole,
* sqrt(gain) for four-pole, etc) */
ALfloat lpCoeffCalc(ALfloat g, ALfloat cw);
typedef enum ALfilterType {
ALfilterType_HighShelf,
ALfilterType_LowShelf,
+7 -6
View File
@@ -455,7 +455,7 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer, ALenum format, cons
offset = offset/OldBytes * Bytes;
length = length/OldBytes/Channels;
}
ConvertData(&((ALubyte*)ALBuf->data)[offset], ALBuf->FmtType,
ConvertData((char*)ALBuf->data+offset, (enum UserFmtType)ALBuf->FmtType,
data, SrcType, Channels, length);
WriteUnlock(&ALBuf->lock);
}
@@ -531,7 +531,7 @@ AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer,
/* offset -> byte offset */
offset *= FrameSize;
ConvertData(&((ALubyte*)ALBuf->data)[offset], ALBuf->FmtType,
ConvertData((char*)ALBuf->data+offset, (enum UserFmtType)ALBuf->FmtType,
data, type, ChannelsFromFmt(ALBuf->FmtChannels), samples);
WriteUnlock(&ALBuf->lock);
}
@@ -581,7 +581,8 @@ AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer,
/* offset -> byte offset */
offset *= FrameSize;
ConvertData(data, type, &((ALubyte*)ALBuf->data)[offset], ALBuf->FmtType,
ConvertData(data, type,
(char*)ALBuf->data+offset, (enum UserFmtType)ALBuf->FmtType,
ChannelsFromFmt(ALBuf->FmtChannels), samples);
ReadUnlock(&ALBuf->lock);
}
@@ -1972,7 +1973,7 @@ static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei f
ALBuf->data = temp;
if(data != NULL)
ConvertData(ALBuf->data, DstType, data, SrcType, NewChannels, frames);
ConvertData(ALBuf->data, (enum UserFmtType)DstType, data, SrcType, NewChannels, frames);
if(storesrc)
{
@@ -1985,8 +1986,8 @@ static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei f
}
else
{
ALBuf->OriginalChannels = DstChannels;
ALBuf->OriginalType = DstType;
ALBuf->OriginalChannels = (enum UserFmtChannels)DstChannels;
ALBuf->OriginalType = (enum UserFmtType)DstType;
ALBuf->OriginalSize = frames * NewBytes * NewChannels;
}
-17
View File
@@ -403,23 +403,6 @@ void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat g
}
ALfloat lpCoeffCalc(ALfloat g, ALfloat cw)
{
ALfloat a = 0.0f;
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);
a = (1 - g*cw - sqrtf(2*g*(1-cw) - g*g*(1 - cw*cw))) /
(1 - g);
}
return a;
}
static void lp_SetParami(ALfilter *filter, ALCcontext *context, ALenum param, ALint val)
{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); (void)filter;(void)param;(void)val; }
static void lp_SetParamiv(ALfilter *filter, ALCcontext *context, ALenum param, const ALint *vals)
+2 -2
View File
@@ -534,13 +534,13 @@ static ALenum SetSourcefv(ALsource *Source, ALCcontext *Context, SrcFloatProp pr
case sfAuxSendFilterGainHFAuto:
case sfDirectChannelsSOFT:
ival = (ALint)values[0];
return SetSourceiv(Source, Context, prop, &ival);
return SetSourceiv(Source, Context, (SrcIntProp)prop, &ival);
case sfBuffer:
case sfBuffersQueued:
case sfBuffersProcessed:
ival = (ALint)((ALuint)values[0]);
return SetSourceiv(Source, Context, prop, &ival);
return SetSourceiv(Source, Context, (SrcIntProp)prop, &ival);
}
ERR("Unexpected property: 0x%04x\n", prop);