diff options
author | Chris Robinson <[email protected]> | 2011-09-22 00:35:08 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-09-22 00:35:08 -0700 |
commit | 43350f9066f0c28ac8ff6269783db222508dec45 (patch) | |
tree | dc74c80fcbb2f7d39f3124e56605cac656e56e23 | |
parent | 0988023d30d16563461f92ffcad6a5fc1d5766f3 (diff) |
Silence some MSVC precision warnings
-rw-r--r-- | Alc/ALu.c | 4 | ||||
-rw-r--r-- | OpenAL32/alBuffer.c | 20 | ||||
-rw-r--r-- | OpenAL32/alEffect.c | 35 | ||||
-rw-r--r-- | OpenAL32/alListener.c | 2 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 6 |
5 files changed, 28 insertions, 39 deletions
@@ -161,7 +161,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext) ALSource->Params.Step = maxstep<<FRACTIONBITS; else { - ALSource->Params.Step = Pitch*FRACTIONONE; + ALSource->Params.Step = (ALint)(Pitch*FRACTIONONE); if(ALSource->Params.Step == 0) ALSource->Params.Step = 1; } @@ -676,7 +676,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) ALSource->Params.Step = maxstep<<FRACTIONBITS; else { - ALSource->Params.Step = Pitch*FRACTIONONE; + ALSource->Params.Step = (ALint)(Pitch*FRACTIONONE); if(ALSource->Params.Step == 0) ALSource->Params.Step = 1; } diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index dc7baecb..3740cb60 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -1368,19 +1368,19 @@ static __inline ALfloat Conv_ALfloat_ALshort(ALshort val) static __inline ALfloat Conv_ALfloat_ALushort(ALushort val) { return (val-32768) * (1.0f/32767.0f); } static __inline ALfloat Conv_ALfloat_ALint(ALint val) -{ return val * (1.0/2147483647.0); } +{ return (ALfloat)(val * (1.0/2147483647.0)); } static __inline ALfloat Conv_ALfloat_ALuint(ALuint val) -{ return (ALint)(val-2147483648u) * (1.0/2147483647.0); } +{ return (ALfloat)((ALint)(val-2147483648u) * (1.0/2147483647.0)); } static __inline ALfloat Conv_ALfloat_ALfloat(ALfloat val) { return (val==val) ? val : 0.0f; } static __inline ALfloat Conv_ALfloat_ALdouble(ALdouble val) -{ return (val==val) ? val : 0.0; } +{ return (val==val) ? (ALfloat)val : 0.0f; } static __inline ALfloat Conv_ALfloat_ALmulaw(ALmulaw val) { return Conv_ALfloat_ALshort(DecodeMuLaw(val)); } static __inline ALfloat Conv_ALfloat_ALbyte3(ALbyte3 val) -{ return DecodeByte3(val) * (1.0/8388607.0); } +{ return (ALfloat)(DecodeByte3(val) * (1.0/8388607.0)); } static __inline ALfloat Conv_ALfloat_ALubyte3(ALubyte3 val) -{ return (DecodeUByte3(val)-8388608) * (1.0/8388607.0); } +{ return (ALfloat)((DecodeUByte3(val)-8388608) * (1.0/8388607.0)); } static __inline ALdouble Conv_ALdouble_ALbyte(ALbyte val) { return val * (1.0/127.0); } @@ -1823,14 +1823,14 @@ static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei f return AL_OUT_OF_MEMORY; } - temp = realloc(ALBuf->data, newsize); + temp = realloc(ALBuf->data, (size_t)newsize); if(!temp && newsize) { WriteUnlock(&ALBuf->lock); return AL_OUT_OF_MEMORY; } ALBuf->data = temp; - ALBuf->size = newsize; + ALBuf->size = (ALsizei)newsize; if(data != NULL) ConvertData(ALBuf->data, DstType, data, SrcType, NewChannels, frames); @@ -1857,14 +1857,14 @@ static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei f return AL_OUT_OF_MEMORY; } - temp = realloc(ALBuf->data, newsize); + temp = realloc(ALBuf->data, (size_t)newsize); if(!temp && newsize) { WriteUnlock(&ALBuf->lock); return AL_OUT_OF_MEMORY; } ALBuf->data = temp; - ALBuf->size = newsize; + ALBuf->size = (ALsizei)newsize; if(data != NULL) ConvertData(ALBuf->data, DstType, data, SrcType, NewChannels, frames); @@ -1890,7 +1890,7 @@ static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei f ALBuf->FmtType = DstType; ALBuf->LoopStart = 0; - ALBuf->LoopEnd = newsize / NewChannels / NewBytes; + ALBuf->LoopEnd = (ALsizei)(newsize / NewChannels / NewBytes); WriteUnlock(&ALBuf->lock); return AL_NO_ERROR; diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index 178628cf..d9e38069 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -1003,7 +1003,7 @@ static void echo_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, } -static void mod_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +static void mod_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { switch(param) { @@ -1023,39 +1023,28 @@ static void mod_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, A alSetError(context, AL_INVALID_VALUE); break; - case AL_RING_MODULATOR_WAVEFORM: - if(val >= AL_RING_MODULATOR_MIN_WAVEFORM && - val <= AL_RING_MODULATOR_MAX_WAVEFORM) - effect->Modulator.Waveform = val; - else - alSetError(context, AL_INVALID_VALUE); - break; - default: alSetError(context, AL_INVALID_ENUM); break; } } -static void mod_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) +static void mod_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) { - mod_SetParami(effect, context, param, vals[0]); + mod_SetParamf(effect, context, param, vals[0]); } -static void mod_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +static void mod_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) { switch(param) { case AL_RING_MODULATOR_FREQUENCY: - if(val >= AL_RING_MODULATOR_MIN_FREQUENCY && - val <= AL_RING_MODULATOR_MAX_FREQUENCY) - effect->Modulator.Frequency = val; - else - alSetError(context, AL_INVALID_VALUE); + case AL_RING_MODULATOR_HIGHPASS_CUTOFF: + mod_SetParamf(effect, context, param, (ALfloat)val); break; - case AL_RING_MODULATOR_HIGHPASS_CUTOFF: - if(val >= AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF && - val <= AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF) - effect->Modulator.HighPassCutoff = val; + case AL_RING_MODULATOR_WAVEFORM: + if(val >= AL_RING_MODULATOR_MIN_WAVEFORM && + val <= AL_RING_MODULATOR_MAX_WAVEFORM) + effect->Modulator.Waveform = val; else alSetError(context, AL_INVALID_VALUE); break; @@ -1065,9 +1054,9 @@ static void mod_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, A break; } } -static void mod_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) +static void mod_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) { - mod_SetParamf(effect, context, param, vals[0]); + mod_SetParami(effect, context, param, vals[0]); } static void mod_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) diff --git a/OpenAL32/alListener.c b/OpenAL32/alListener.c index 346e250a..37982b5c 100644 --- a/OpenAL32/alListener.c +++ b/OpenAL32/alListener.c @@ -226,7 +226,7 @@ AL_API void AL_APIENTRY alListeneriv( ALenum eParam, const ALint* plValues ) { case AL_POSITION: case AL_VELOCITY: - alListener3f(eParam, plValues[0], plValues[1], plValues[2]); + alListener3f(eParam, (ALfloat)plValues[0], (ALfloat)plValues[1], (ALfloat)plValues[2]); return; case AL_ORIENTATION: diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index f98efc20..4941bc65 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -940,7 +940,7 @@ AL_API ALvoid AL_APIENTRY alGetSourcef(ALuint source, ALenum eParam, ALfloat *pf pContext->Device->Frequency; GetSourceOffset(Source, eParam, Offsets, updateLen); UnlockContext(pContext); - *pflValue = Offsets[0]; + *pflValue = (ALfloat)Offsets[0]; break; case AL_CONE_INNER_ANGLE: @@ -1087,8 +1087,8 @@ AL_API ALvoid AL_APIENTRY alGetSourcefv(ALuint source, ALenum eParam, ALfloat *p pContext->Device->Frequency; GetSourceOffset(Source, eParam, Offsets, updateLen); UnlockContext(pContext); - pflValues[0] = Offsets[0]; - pflValues[1] = Offsets[1]; + pflValues[0] = (ALfloat)Offsets[0]; + pflValues[1] = (ALfloat)Offsets[1]; break; default: |