diff options
author | Chris Robinson <[email protected]> | 2020-04-03 08:49:15 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-04-03 08:49:15 -0700 |
commit | 8f47013e43a1585bfe7ba1fea244bda9e4e73670 (patch) | |
tree | 39355c4bd4e7161e4534e892e2d696da0bb943de /alc | |
parent | 11305975629176e032548bba53207a36f55d9dc7 (diff) |
Some more ALfloat->float cleanup
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alu.cpp | 16 | ||||
-rw-r--r-- | alc/alu.h | 34 |
2 files changed, 25 insertions, 25 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp index b8befd03..9df3a605 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -111,9 +111,9 @@ namespace { using namespace std::placeholders; -ALfloat InitConeScale() +float InitConeScale() { - ALfloat ret{1.0f}; + float ret{1.0f}; if(auto optval = al::getenv("__ALSOFT_HALF_ANGLE_CONES")) { if(al::strcasecmp(optval->c_str(), "true") == 0 @@ -123,9 +123,9 @@ ALfloat InitConeScale() return ret; } -ALfloat InitZScale() +float InitZScale() { - ALfloat ret{1.0f}; + float ret{1.0f}; if(auto optval = al::getenv("__ALSOFT_REVERSE_Z")) { if(al::strcasecmp(optval->c_str(), "true") == 0 @@ -138,17 +138,17 @@ ALfloat InitZScale() } // namespace /* Cone scalar */ -const ALfloat ConeScale{InitConeScale()}; +const float ConeScale{InitConeScale()}; /* Localized Z scalar for mono sources */ -const ALfloat ZScale{InitZScale()}; +const float ZScale{InitZScale()}; namespace { struct ChanMap { Channel channel; - ALfloat angle; - ALfloat elevation; + float angle; + float elevation; }; HrtfDirectMixerFunc MixDirectHrtf{MixDirectHrtf_<CTag>}; @@ -32,30 +32,30 @@ extern MixerFunc MixSamples; extern RowMixerFunc MixRowSamples; -#define GAIN_MIX_MAX (1000.0f) /* +60dB */ +#define GAIN_MIX_MAX 1000.0f /* +60dB */ -#define GAIN_SILENCE_THRESHOLD (0.00001f) /* -100dB */ +#define GAIN_SILENCE_THRESHOLD 0.00001f /* -100dB */ -#define SPEEDOFSOUNDMETRESPERSEC (343.3f) -#define AIRABSORBGAINHF (0.99426f) /* -0.05dB */ +#define SPEEDOFSOUNDMETRESPERSEC 343.3f +#define AIRABSORBGAINHF 0.99426f /* -0.05dB */ /* Target gain for the reverb decay feedback reaching the decay time. */ -#define REVERB_DECAY_GAIN (0.001f) /* -60 dB */ +#define REVERB_DECAY_GAIN 0.001f /* -60 dB */ -#define FRACTIONBITS (12) +#define FRACTIONBITS 12 #define FRACTIONONE (1<<FRACTIONBITS) #define FRACTIONMASK (FRACTIONONE-1) -inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu) noexcept +inline float lerp(float val1, float val2, float mu) noexcept { return val1 + (val2-val1)*mu; } -inline ALfloat cubic(ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat mu) noexcept +inline float cubic(float val1, float val2, float val3, float val4, float mu) noexcept { - ALfloat mu2 = mu*mu, mu3 = mu2*mu; - ALfloat a0 = -0.5f*mu3 + mu2 + -0.5f*mu; - ALfloat a1 = 1.5f*mu3 + -2.5f*mu2 + 1.0f; - ALfloat a2 = -1.5f*mu3 + 2.0f*mu2 + 0.5f*mu; - ALfloat a3 = 0.5f*mu3 + -0.5f*mu2; + const float mu2{mu*mu}, mu3{mu2*mu}; + const float a0{-0.5f*mu3 + mu2 + -0.5f*mu}; + const float a1{ 1.5f*mu3 + -2.5f*mu2 + 1.0f}; + const float a2{-1.5f*mu3 + 2.0f*mu2 + 0.5f*mu}; + const float a3{ 0.5f*mu3 + -0.5f*mu2}; return val1*a0 + val2*a1 + val3*a2 + val4*a3; } @@ -140,9 +140,9 @@ void ComputePanGains(const MixParams *mix, const float*RESTRICT coeffs, const fl const al::span<float,MAX_OUTPUT_CHANNELS> gains); -inline std::array<ALfloat,MAX_AMBI_CHANNELS> GetAmbiIdentityRow(size_t i) noexcept +inline std::array<float,MAX_AMBI_CHANNELS> GetAmbiIdentityRow(size_t i) noexcept { - std::array<ALfloat,MAX_AMBI_CHANNELS> ret{}; + std::array<float,MAX_AMBI_CHANNELS> ret{}; ret[i] = 1.0f; return ret; } @@ -153,7 +153,7 @@ void aluMixData(ALCdevice *device, void *OutBuffer, const ALuint NumSamples, /* Caller must lock the device state, and the mixer must not be running. */ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...) DECL_FORMAT(printf, 2, 3); -extern const ALfloat ConeScale; -extern const ALfloat ZScale; +extern const float ConeScale; +extern const float ZScale; #endif |