diff options
author | Chris Robinson <[email protected]> | 2012-06-29 02:12:36 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-06-29 02:12:36 -0700 |
commit | 6bd535bed0101bbe91c4a1a7dc4f93167e40810c (patch) | |
tree | 6ff7dd6ab5a18cb05d8b1ebc1a92c4b430d2b838 | |
parent | 524c88c4025391aa17752d329cc2d548c9a6d261 (diff) |
Use wrappers for float-typed math functions
-rw-r--r-- | Alc/ALc.c | 2 | ||||
-rw-r--r-- | Alc/ALu.c | 28 | ||||
-rw-r--r-- | Alc/alcDedicated.c | 2 | ||||
-rw-r--r-- | Alc/alcEcho.c | 8 | ||||
-rw-r--r-- | Alc/alcModulator.c | 10 | ||||
-rw-r--r-- | Alc/alcReverb.c | 44 | ||||
-rw-r--r-- | Alc/hrtf.c | 12 | ||||
-rw-r--r-- | Alc/panning.c | 12 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 79 | ||||
-rw-r--r-- | OpenAL32/alFilter.c | 2 |
10 files changed, 94 insertions, 105 deletions
@@ -839,7 +839,7 @@ static void alc_initconfig(void) } if(ConfigValueFloat("reverb", "boost", &valf)) - ReverbBoost *= aluPow(10.0f, valf / 20.0f); + ReverbBoost *= powf(10.0f, valf / 20.0f); EmulateEAXReverb = GetConfigValueBool("reverb", "emulate-eax", AL_FALSE); @@ -300,7 +300,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext) /* Update filter coefficients. Calculations based on the I3DL2 * spec. */ - cw = aluCos(F_PI*2.0f * LOWPASSFREQREF / Frequency); + cw = cosf(F_PI*2.0f * LOWPASSFREQREF / Frequency); /* We use two chained one-pole filters, so we need to take the * square root of the squared gain, which is the same as the base @@ -466,7 +466,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) aluNormalize(Direction); /* Calculate distance attenuation */ - Distance = aluSqrt(aluDotproduct(Position, Position)); + Distance = sqrtf(aluDotproduct(Position, Position)); ClampedDist = Distance; Attenuation = 1.0f; @@ -519,9 +519,9 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) case ExponentDistance: if(ClampedDist > 0.0f && MinDist > 0.0f) { - Attenuation = aluPow(ClampedDist/MinDist, -Rolloff); + Attenuation = powf(ClampedDist/MinDist, -Rolloff); for(i = 0;i < NumSends;i++) - RoomAttenuation[i] = aluPow(ClampedDist/MinDist, -RoomRolloff[i]); + RoomAttenuation[i] = powf(ClampedDist/MinDist, -RoomRolloff[i]); } break; @@ -539,9 +539,9 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) if(AirAbsorptionFactor > 0.0f && ClampedDist > MinDist) { ALfloat meters = maxf(ClampedDist-MinDist, 0.0f) * MetersPerUnit; - DryGainHF *= aluPow(AIRABSORBGAINHF, AirAbsorptionFactor*meters); + DryGainHF *= powf(AIRABSORBGAINHF, AirAbsorptionFactor*meters); for(i = 0;i < NumSends;i++) - WetGainHF[i] *= aluPow(RoomAirAbsorption[i], AirAbsorptionFactor*meters); + WetGainHF[i] *= powf(RoomAirAbsorption[i], AirAbsorptionFactor*meters); } if(WetGainAuto) @@ -558,12 +558,12 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) for(i = 0;i < NumSends;i++) { if(DecayDistance[i] > 0.0f) - WetGain[i] *= aluPow(0.001f/*-60dB*/, ApparentDist/DecayDistance[i]); + WetGain[i] *= powf(0.001f/*-60dB*/, ApparentDist/DecayDistance[i]); } } /* Calculate directional soundcones */ - Angle = aluAcos(aluDotproduct(Direction,SourceToListener)) * (180.0f/F_PI); + Angle = acosf(aluDotproduct(Direction,SourceToListener)) * (180.0f/F_PI); if(Angle > InnerAngle && Angle <= OuterAngle) { ALfloat scale = (Angle-InnerAngle) / (OuterAngle-InnerAngle); @@ -679,8 +679,8 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) * the listener. This prevents +0 and -0 Z from producing * inconsistent panning. Also, clamp Y in case FP precision errors * cause it to land outside of -1..+1. */ - ev = aluAsin(clampf(Position[1], -1.0f, 1.0f)); - az = aluAtan2(Position[0], -Position[2]*ZScale); + ev = asinf(clampf(Position[1], -1.0f, 1.0f)); + az = atan2f(Position[0], -Position[2]*ZScale); } /* Check to see if the HRIR is already moving. */ @@ -739,14 +739,14 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) Position[1] *= invlen; Position[2] *= invlen; - DirGain = aluSqrt(Position[0]*Position[0] + Position[2]*Position[2]); - ComputeAngleGains(Device, aluAtan2(Position[0], -Position[2]*ZScale), 0.0f, + DirGain = sqrtf(Position[0]*Position[0] + Position[2]*Position[2]); + ComputeAngleGains(Device, atan2f(Position[0], -Position[2]*ZScale), 0.0f, DryGain*DirGain, Matrix[0]); } /* Adjustment for vertical offsets. Not the greatest, but simple * enough. */ - AmbientGain = DryGain * aluSqrt(1.0f/Device->NumChan) * (1.0f-DirGain); + AmbientGain = DryGain * sqrtf(1.0f/Device->NumChan) * (1.0f-DirGain); for(i = 0;i < (ALint)Device->NumChan;i++) { enum Channel chan = Device->Speaker2Chan[i]; @@ -757,7 +757,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) ALSource->Params.Send[i].Gain = WetGain[i]; /* Update filter coefficients. */ - cw = aluCos(F_PI*2.0f * LOWPASSFREQREF / Frequency); + cw = cosf(F_PI*2.0f * LOWPASSFREQREF / Frequency); ALSource->Params.Direct.iirFilter.coeff = lpCoeffCalc(DryGainHF, cw); for(i = 0;i < NumSends;i++) diff --git a/Alc/alcDedicated.c b/Alc/alcDedicated.c index 60460962..64c2910b 100644 --- a/Alc/alcDedicated.c +++ b/Alc/alcDedicated.c @@ -61,7 +61,7 @@ static ALvoid DedicatedUpdate(ALeffectState *effect, ALCdevice *device, const AL state->gains[s] = 0.0f; if(Slot->effect.type == AL_EFFECT_DEDICATED_DIALOGUE) - ComputeAngleGains(device, aluAtan2(0.0f, 1.0f), 0.0f, Gain, state->gains); + ComputeAngleGains(device, atan2f(0.0f, 1.0f), 0.0f, Gain, state->gains); else if(Slot->effect.type == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT) state->gains[LFE] = Gain; } diff --git a/Alc/alcEcho.c b/Alc/alcEcho.c index 7d050716..e3c3df96 100644 --- a/Alc/alcEcho.c +++ b/Alc/alcEcho.c @@ -106,7 +106,7 @@ static ALvoid EchoUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffec state->FeedGain = Slot->effect.Echo.Feedback; - cw = aluCos(F_PI*2.0f * LOWPASSFREQREF / frequency); + cw = cosf(F_PI*2.0f * LOWPASSFREQREF / frequency); g = 1.0f - Slot->effect.Echo.Damping; state->iirFilter.coeff = lpCoeffCalc(g, cw); @@ -117,13 +117,13 @@ static ALvoid EchoUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffec state->Gain[1][i] = 0.0f; } - dirGain = aluFabs(lrpan); + dirGain = fabsf(lrpan); /* First tap panning */ - ComputeAngleGains(Device, aluAtan2(-lrpan, 0.0f), (1.0f-dirGain)*F_PI, gain, state->Gain[0]); + ComputeAngleGains(Device, atan2f(-lrpan, 0.0f), (1.0f-dirGain)*F_PI, gain, state->Gain[0]); /* Second tap panning */ - ComputeAngleGains(Device, aluAtan2(+lrpan, 0.0f), (1.0f-dirGain)*F_PI, gain, state->Gain[1]); + ComputeAngleGains(Device, atan2f(+lrpan, 0.0f), (1.0f-dirGain)*F_PI, gain, state->Gain[1]); } static ALvoid EchoProcess(ALeffectState *effect, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[MaxChannels]) diff --git a/Alc/alcModulator.c b/Alc/alcModulator.c index 5bfcdb22..ce91e95a 100644 --- a/Alc/alcModulator.c +++ b/Alc/alcModulator.c @@ -55,7 +55,7 @@ typedef struct ALmodulatorState { static __inline ALfloat Sin(ALuint index) { - return aluSin(index * (F_PI*2.0f / WAVEFORM_FRACONE)); + return sinf(index * (F_PI*2.0f / WAVEFORM_FRACONE)); } static __inline ALfloat Saw(ALuint index) @@ -144,12 +144,12 @@ static ALvoid ModulatorUpdate(ALeffectState *effect, ALCdevice *Device, const AL Device->Frequency); if(state->step == 0) state->step = 1; - cw = aluCos(F_PI*2.0f * Slot->effect.Modulator.HighPassCutoff / - Device->Frequency); - a = (2.0f-cw) - aluSqrt(aluPow(2.0f-cw, 2.0f) - 1.0f); + cw = cosf(F_PI*2.0f * Slot->effect.Modulator.HighPassCutoff / + Device->Frequency); + a = (2.0f-cw) - sqrtf(powf(2.0f-cw, 2.0f) - 1.0f); state->iirFilter.coeff = a; - gain = aluSqrt(1.0f/Device->NumChan); + gain = sqrtf(1.0f/Device->NumChan); gain *= Slot->Gain; for(index = 0;index < MaxChannels;index++) state->Gain[index] = 0.0f; diff --git a/Alc/alcReverb.c b/Alc/alcReverb.c index 8f0b65ad..13f90511 100644 --- a/Alc/alcReverb.c +++ b/Alc/alcReverb.c @@ -261,7 +261,7 @@ static __inline ALfloat EAXModulation(ALverbState *State, ALfloat in) // Calculate the sinus rythm (dependent on modulation time and the // sampling rate). The center of the sinus is moved to reduce the delay // of the effect when the time or depth are low. - sinus = 1.0f - aluCos(F_PI*2.0f * State->Mod.Index / State->Mod.Range); + sinus = 1.0f - cosf(F_PI*2.0f * State->Mod.Index / State->Mod.Range); // The depth determines the range over which to read the input samples // from, so it must be filtered to reduce the distortion caused by even @@ -720,8 +720,8 @@ static ALboolean ReverbDeviceUpdate(ALeffectState *effect, ALCdevice *Device) // is calculated given the current sample rate. This ensures that the // resulting filter response over time is consistent across all sample // rates. - State->Mod.Coeff = aluPow(MODULATION_FILTER_COEFF, - MODULATION_FILTER_CONST / frequency); + State->Mod.Coeff = powf(MODULATION_FILTER_COEFF, + MODULATION_FILTER_CONST / frequency); // The early reflection and late all-pass filter line lengths are static, // so their offsets only need to be calculated once. @@ -744,21 +744,21 @@ static ALboolean ReverbDeviceUpdate(ALeffectState *effect, ALCdevice *Device) // until the decay reaches -60 dB. static __inline ALfloat CalcDecayCoeff(ALfloat length, ALfloat decayTime) { - return aluPow(0.001f/*-60 dB*/, length/decayTime); + return powf(0.001f/*-60 dB*/, length/decayTime); } // Calculate a decay length from a coefficient and the time until the decay // reaches -60 dB. static __inline ALfloat CalcDecayLength(ALfloat coeff, ALfloat decayTime) { - return aluLog10(coeff) * decayTime / aluLog10(0.001f)/*-60 dB*/; + return log10f(coeff) * decayTime / log10f(0.001f)/*-60 dB*/; } // Calculate the high frequency parameter for the I3DL2 coefficient // calculation. static __inline ALfloat CalcI3DL2HFreq(ALfloat hfRef, ALuint frequency) { - return aluCos(F_PI*2.0f * hfRef / frequency); + return cosf(F_PI*2.0f * hfRef / frequency); } // Calculate an attenuation to be applied to the input of any echo models to @@ -778,7 +778,7 @@ static __inline ALfloat CalcDensityGain(ALfloat a) * calculated by inverting the square root of this approximation, * yielding: 1 / sqrt(1 / (1 - a^2)), simplified to: sqrt(1 - a^2). */ - return aluSqrt(1.0f - (a * a)); + return sqrtf(1.0f - (a * a)); } // Calculate the mixing matrix coefficients given a diffusion factor. @@ -787,13 +787,13 @@ static __inline ALvoid CalcMatrixCoeffs(ALfloat diffusion, ALfloat *x, ALfloat * ALfloat n, t; // The matrix is of order 4, so n is sqrt (4 - 1). - n = aluSqrt(3.0f); - t = diffusion * aluAtan(n); + n = sqrtf(3.0f); + t = diffusion * atanf(n); // Calculate the first mixing matrix coefficient. - *x = aluCos(t); + *x = cosf(t); // Calculate the second mixing matrix coefficient. - *y = aluSin(t) / n; + *y = sinf(t) / n; } // Calculate the limited HF ratio for use with the late reverb low-pass @@ -913,7 +913,7 @@ static ALvoid UpdateDecorrelator(ALfloat density, ALuint frequency, ALverbState */ for(index = 0;index < 3;index++) { - length = (DECO_FRACTION * aluPow(DECO_MULTIPLIER, (ALfloat)index)) * + length = (DECO_FRACTION * powf(DECO_MULTIPLIER, (ALfloat)index)) * LATE_LINE_LENGTH[0] * (1.0f + (density * LATE_LINE_MULTIPLIER)); State->DecoTap[index] = fastf2u(length * frequency); } @@ -947,7 +947,7 @@ static ALvoid UpdateLateLines(ALfloat reverbGain, ALfloat lateGain, ALfloat xMix decayTime)); // Calculate the all-pass feed-back and feed-forward coefficient. - State->Late.ApFeedCoeff = 0.5f * aluPow(diffusion, 2.0f); + State->Late.ApFeedCoeff = 0.5f * powf(diffusion, 2.0f); for(index = 0;index < 4;index++) { @@ -991,7 +991,7 @@ static ALvoid UpdateEchoLine(ALfloat reverbGain, ALfloat lateGain, ALfloat echoT State->Echo.DensityGain = CalcDensityGain(State->Echo.Coeff); // Calculate the echo all-pass feed coefficient. - State->Echo.ApFeedCoeff = 0.5f * aluPow(diffusion, 2.0f); + State->Echo.ApFeedCoeff = 0.5f * powf(diffusion, 2.0f); // Calculate the echo all-pass attenuation coefficient. State->Echo.ApCoeff = CalcDecayCoeff(ECHO_ALLPASS_LENGTH, decayTime); @@ -1025,12 +1025,12 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection /* Attenuate reverb according to its coverage (dirGain=0 will give * Gain*ambientGain, and dirGain=1 will give Gain). */ - ambientGain = minf(aluSqrt(2.0f/Device->NumChan), 1.0f); + ambientGain = minf(sqrtf(2.0f/Device->NumChan), 1.0f); length = earlyPan[0]*earlyPan[0] + earlyPan[1]*earlyPan[1] + earlyPan[2]*earlyPan[2]; if(length > 1.0f) { - length = 1.0f / aluSqrt(length); + length = 1.0f / sqrtf(length); earlyPan[0] *= length; earlyPan[1] *= length; earlyPan[2] *= length; @@ -1038,22 +1038,22 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection length = latePan[0]*latePan[0] + latePan[1]*latePan[1] + latePan[2]*latePan[2]; if(length > 1.0f) { - length = 1.0f / aluSqrt(length); + length = 1.0f / sqrtf(length); latePan[0] *= length; latePan[1] *= length; latePan[2] *= length; } - dirGain = aluSqrt(earlyPan[0]*earlyPan[0] + earlyPan[2]*earlyPan[2]); + dirGain = sqrtf(earlyPan[0]*earlyPan[0] + earlyPan[2]*earlyPan[2]); for(index = 0;index < MaxChannels;index++) State->Early.PanGain[index] = 0.0f; - ComputeAngleGains(Device, aluAtan2(earlyPan[0], earlyPan[2]), (1.0f-dirGain)*F_PI, + ComputeAngleGains(Device, atan2f(earlyPan[0], earlyPan[2]), (1.0f-dirGain)*F_PI, lerp(ambientGain, 1.0f, dirGain) * Gain, State->Early.PanGain); - dirGain = aluSqrt(latePan[0]*latePan[0] + latePan[2]*latePan[2]); + dirGain = sqrtf(latePan[0]*latePan[0] + latePan[2]*latePan[2]); for(index = 0;index < MaxChannels;index++) State->Late.PanGain[index] = 0.0f; - ComputeAngleGains(Device, aluAtan2(latePan[0], latePan[2]), (1.0f-dirGain)*F_PI, + ComputeAngleGains(Device, atan2f(latePan[0], latePan[2]), (1.0f-dirGain)*F_PI, lerp(ambientGain, 1.0f, dirGain) * Gain, State->Late.PanGain); } @@ -1141,7 +1141,7 @@ static ALvoid ReverbUpdate(ALeffectState *effect, ALCdevice *Device, const ALeff ALuint index; /* Update channel gains */ - gain *= aluSqrt(2.0f/Device->NumChan) * ReverbBoost; + gain *= sqrtf(2.0f/Device->NumChan) * ReverbBoost; for(index = 0;index < MaxChannels;index++) State->Gain[index] = 0.0f; for(index = 0;index < Device->NumChan;index++) @@ -70,7 +70,7 @@ static void CalcAzIndices(ALuint evidx, ALfloat az, ALuint *azidx, ALfloat *azmu az = (F_PI*2.0f + az) * azCount[evidx] / (F_PI*2.0f); azidx[0] = fastf2u(az) % azCount[evidx]; azidx[1] = (azidx[0] + 1) % azCount[evidx]; - *azmu = az - aluFloor(az); + *azmu = az - floorf(az); } // Calculates the normalized HRTF transition factor (delta) from the changes @@ -84,7 +84,7 @@ ALfloat CalcHrtfDelta(ALfloat oldGain, ALfloat newGain, const ALfloat olddir[3], // Calculate the normalized dB gain change. newGain = maxf(newGain, 0.0001f); oldGain = maxf(oldGain, 0.0001f); - gainChange = aluFabs(aluLog10(newGain / oldGain) / aluLog10(0.0001f)); + gainChange = fabsf(log10f(newGain / oldGain) / log10f(0.0001f)); // Calculate the normalized listener to source angle change when there is // enough gain to notice it. @@ -94,9 +94,9 @@ ALfloat CalcHrtfDelta(ALfloat oldGain, ALfloat newGain, const ALfloat olddir[3], // No angle change when the directions are equal or degenerate (when // both have zero length). if(newdir[0]-olddir[0] || newdir[1]-olddir[1] || newdir[2]-olddir[2]) - angleChange = aluAcos(olddir[0]*newdir[0] + - olddir[1]*newdir[1] + - olddir[2]*newdir[2]) / F_PI; + angleChange = acosf(olddir[0]*newdir[0] + + olddir[1]*newdir[1] + + olddir[2]*newdir[2]) / F_PI; } @@ -217,7 +217,7 @@ ALuint GetMovingHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat a ridx[3] = evOffset[evidx[1]] + ((azCount[evidx[1]]-azidx[1]) % azCount[evidx[1]]); // Calculate the stepping parameters. - delta = maxf(aluFloor(delta*(Hrtf->sampleRate*0.015f) + 0.5f), 1.0f); + delta = maxf(floorf(delta*(Hrtf->sampleRate*0.015f) + 0.5f), 1.0f); step = 1.0f / delta; // Calculate the normalized and attenuated target HRIR coefficients using diff --git a/Alc/panning.c b/Alc/panning.c index 4bdaf6b0..6b412f89 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -181,8 +181,8 @@ ALvoid ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, /* Sound is between speakers i and i+1 */ a = (angle-SpeakerAngle[i]) / (SpeakerAngle[i+1]-SpeakerAngle[i]); - gains[Speaker2Chan[i]] = aluSqrt(1.0f-a) * ingain; - gains[Speaker2Chan[i+1]] = aluSqrt( a) * ingain; + gains[Speaker2Chan[i]] = sqrtf(1.0f-a) * ingain; + gains[Speaker2Chan[i+1]] = sqrtf( a) * ingain; return; } } @@ -191,12 +191,12 @@ ALvoid ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, angle += F_PI*2.0f; a = (angle-SpeakerAngle[i]) / (F_PI*2.0f + SpeakerAngle[0]-SpeakerAngle[i]); - gains[Speaker2Chan[i]] = aluSqrt(1.0f-a) * ingain; - gains[Speaker2Chan[0]] = aluSqrt( a) * ingain; + gains[Speaker2Chan[i]] = sqrtf(1.0f-a) * ingain; + gains[Speaker2Chan[0]] = sqrtf( a) * ingain; return; } - if(aluFabs(angle)+hwidth > F_PI) + if(fabsf(angle)+hwidth > F_PI) { /* The coverage area would go outside of -pi...+pi. Instead, rotate the * speaker angles so it would be as if angle=0, and keep them wrapped @@ -329,7 +329,7 @@ ALvoid ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat hwidth, for(i = 0;i < device->NumChan;i++) { enum Channel chan = device->Speaker2Chan[i]; - gains[chan] = aluSqrt(tmpgains[chan]) * ingain; + gains[chan] = sqrtf(tmpgains[chan]) * ingain; } } diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 0540c699..cd8f1554 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -44,70 +44,59 @@ _CRTIMP unsigned int __cdecl __MINGW_NOTHROW _controlfp (unsigned int unNew, uns #define F_PI (3.14159265358979323846f) /* pi */ #define F_PI_2 (1.57079632679489661923f) /* pi/2 */ -#ifdef HAVE_POWF -#define aluPow(x,y) (powf((x),(y))) -#else -#define aluPow(x,y) ((ALfloat)pow((double)(x),(double)(y))) +#ifndef HAVE_POWF +static __inline float powf(float x, float y) +{ return (float)pow(x, y); } #endif -#ifdef HAVE_SQRTF -#define aluSqrt(x) (sqrtf((x))) -#else -#define aluSqrt(x) ((ALfloat)sqrt((double)(x))) +#ifndef HAVE_SQRTF +static __inline float sqrtf(float x) +{ (float)sqrt(x); } #endif -#ifdef HAVE_COSF -#define aluCos(x) (cosf((x))) -#else -#define aluCos(x) ((ALfloat)cos((double)(x))) +#ifndef HAVE_COSF +static __inline float cosf(float x) +{ (float)cos(x); } #endif -#ifdef HAVE_SINF -#define aluSin(x) (sinf((x))) -#else -#define aluSin(x) ((ALfloat)sin((double)(x))) +#ifndef HAVE_SINF +static __inline float sinf(float x) +{ (float)sin(x); } #endif -#ifdef HAVE_ACOSF -#define aluAcos(x) (acosf((x))) -#else -#define aluAcos(x) ((ALfloat)acos((double)(x))) +#ifndef HAVE_ACOSF +static __inline float acosf(float x) +{ (float)acos(x); } #endif -#ifdef HAVE_ASINF -#define aluAsin(x) (asinf((x))) -#else -#define aluAsin(x) ((ALfloat)asin((double)(x))) +#ifndef HAVE_ASINF +static __inline float asinf(float x) +{ (float)asin(x); } #endif -#ifdef HAVE_ATANF -#define aluAtan(x) (atanf((x))) -#else -#define aluAtan(x) ((ALfloat)atan((double)(x))) +#ifndef HAVE_ATANF +static __inline float atanf(float x) +{ (float)atan(x); } #endif -#ifdef HAVE_ATAN2F -#define aluAtan2(x,y) (atan2f((x),(y))) -#else -#define aluAtan2(x,y) ((ALfloat)atan2((double)(x),(double)(y))) +#ifndef HAVE_ATAN2F +static __inline float atan2f(float x, float y) +{ (float)atan2(x, y); } #endif -#ifdef HAVE_FABSF -#define aluFabs(x) (fabsf((x))) -#else -#define aluFabs(x) ((ALfloat)fabs((double)(x))) +#ifndef HAVE_FABSF +static __inline float fabsf(float x) +{ (float)fabs(x); } #endif -#ifdef HAVE_LOG10F -#define aluLog10(x) (log10f((x))) -#else -#define aluLog10(x) ((ALfloat)log10((double)(x))) +#ifndef HAVE_LOG10F +static __inline float log10f(float x) +{ (float)log10(x); } #endif -#ifdef HAVE_FLOORF -#define aluFloor(x) (floorf((x))) -#else -#define aluFloor(x) ((ALfloat)floor((double)(x))) +#ifndef HAVE_FLOORF +static __inline float floorf(float x) +{ (float)floor(x); } #endif #ifdef __cplusplus @@ -284,7 +273,7 @@ static __inline void aluNormalize(ALfloat *inVector) ALfloat lengthsqr = aluDotproduct(inVector, inVector); if(lengthsqr > 0.0f) { - ALfloat inv_length = 1.0f/aluSqrt(lengthsqr); + ALfloat inv_length = 1.0f/sqrtf(lengthsqr); inVector[0] *= inv_length; inVector[1] *= inv_length; inVector[2] *= inv_length; diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c index d943d9f1..1250693e 100644 --- a/OpenAL32/alFilter.c +++ b/OpenAL32/alFilter.c @@ -336,7 +336,7 @@ ALfloat lpCoeffCalc(ALfloat g, ALfloat cw) /* 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 - aluSqrt(2*g*(1-cw) - g*g*(1 - cw*cw))) / + a = (1 - g*cw - sqrtf(2*g*(1-cw) - g*g*(1 - cw*cw))) / (1 - g); } |