diff options
Diffstat (limited to 'alc/effects')
-rw-r--r-- | alc/effects/autowah.cpp | 78 | ||||
-rw-r--r-- | alc/effects/chorus.cpp | 68 | ||||
-rw-r--r-- | alc/effects/compressor.cpp | 40 | ||||
-rw-r--r-- | alc/effects/dedicated.cpp | 24 | ||||
-rw-r--r-- | alc/effects/distortion.cpp | 42 | ||||
-rw-r--r-- | alc/effects/echo.cpp | 38 | ||||
-rw-r--r-- | alc/effects/equalizer.cpp | 24 | ||||
-rw-r--r-- | alc/effects/fshifter.cpp | 24 | ||||
-rw-r--r-- | alc/effects/modulator.cpp | 36 | ||||
-rw-r--r-- | alc/effects/null.cpp | 16 | ||||
-rw-r--r-- | alc/effects/pshifter.cpp | 18 | ||||
-rw-r--r-- | alc/effects/reverb.cpp | 320 | ||||
-rw-r--r-- | alc/effects/vmorpher.cpp | 70 |
13 files changed, 399 insertions, 399 deletions
diff --git a/alc/effects/autowah.cpp b/alc/effects/autowah.cpp index 48a90f76..32e366e0 100644 --- a/alc/effects/autowah.cpp +++ b/alc/effects/autowah.cpp @@ -40,33 +40,33 @@ namespace { struct AutowahState final : public EffectState { /* Effect parameters */ - ALfloat mAttackRate; - ALfloat mReleaseRate; - ALfloat mResonanceGain; - ALfloat mPeakGain; - ALfloat mFreqMinNorm; - ALfloat mBandwidthNorm; - ALfloat mEnvDelay; + float mAttackRate; + float mReleaseRate; + float mResonanceGain; + float mPeakGain; + float mFreqMinNorm; + float mBandwidthNorm; + float mEnvDelay; /* Filter components derived from the envelope. */ struct { - ALfloat cos_w0; - ALfloat alpha; + float cos_w0; + float alpha; } mEnv[BUFFERSIZE]; struct { /* Effect filters' history. */ struct { - ALfloat z1, z2; + float z1, z2; } Filter; /* Effect gains for each output channel */ - ALfloat CurrentGains[MAX_OUTPUT_CHANNELS]; - ALfloat TargetGains[MAX_OUTPUT_CHANNELS]; + float CurrentGains[MAX_OUTPUT_CHANNELS]; + float TargetGains[MAX_OUTPUT_CHANNELS]; } mChans[MAX_AMBI_CHANNELS]; /* Effects buffers */ - alignas(16) ALfloat mBufferOut[BUFFERSIZE]; + alignas(16) float mBufferOut[BUFFERSIZE]; bool deviceUpdate(const ALCdevice *device) override; @@ -109,7 +109,7 @@ void AutowahState::update(const ALCcontext *context, const ALeffectslot *slot, c const ALCdevice *device{context->mDevice.get()}; const auto frequency = static_cast<float>(device->Frequency); - const ALfloat ReleaseTime{clampf(props->Autowah.ReleaseTime, 0.001f, 1.0f)}; + const float ReleaseTime{clampf(props->Autowah.ReleaseTime, 0.001f, 1.0f)}; mAttackRate = std::exp(-1.0f / (props->Autowah.AttackTime*frequency)); mReleaseRate = std::exp(-1.0f / (ReleaseTime*frequency)); @@ -129,17 +129,17 @@ void AutowahState::update(const ALCcontext *context, const ALeffectslot *slot, c void AutowahState::process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) { - const ALfloat attack_rate = mAttackRate; - const ALfloat release_rate = mReleaseRate; - const ALfloat res_gain = mResonanceGain; - const ALfloat peak_gain = mPeakGain; - const ALfloat freq_min = mFreqMinNorm; - const ALfloat bandwidth = mBandwidthNorm; - - ALfloat env_delay{mEnvDelay}; + const float attack_rate{mAttackRate}; + const float release_rate{mReleaseRate}; + const float res_gain{mResonanceGain}; + const float peak_gain{mPeakGain}; + const float freq_min{mFreqMinNorm}; + const float bandwidth{mBandwidthNorm}; + + float env_delay{mEnvDelay}; for(size_t i{0u};i < samplesToDo;i++) { - ALfloat w0, sample, a; + float w0, sample, a; /* Envelope follower described on the book: Audio Effects, Theory, * Implementation and Application. @@ -150,8 +150,8 @@ void AutowahState::process(const size_t samplesToDo, const al::span<const FloatB /* Calculate the cos and alpha components for this sample's filter. */ w0 = minf((bandwidth*env_delay + freq_min), 0.46f) * al::MathDefs<float>::Tau(); - mEnv[i].cos_w0 = cosf(w0); - mEnv[i].alpha = sinf(w0)/(2.0f * Q_FACTOR); + mEnv[i].cos_w0 = std::cos(w0); + mEnv[i].alpha = std::sin(w0)/(2.0f * Q_FACTOR); } mEnvDelay = env_delay; @@ -164,15 +164,15 @@ void AutowahState::process(const size_t samplesToDo, const al::span<const FloatB * envelope. Because the filter changes for each sample, the * coefficients are transient and don't need to be held. */ - ALfloat z1{chandata->Filter.z1}; - ALfloat z2{chandata->Filter.z2}; + float z1{chandata->Filter.z1}; + float z2{chandata->Filter.z2}; for(size_t i{0u};i < samplesToDo;i++) { - const ALfloat alpha = mEnv[i].alpha; - const ALfloat cos_w0 = mEnv[i].cos_w0; - ALfloat input, output; - ALfloat a[3], b[3]; + const float alpha{mEnv[i].alpha}; + const float cos_w0{mEnv[i].cos_w0}; + float input, output; + float a[3], b[3]; b[0] = 1.0f + alpha*res_gain; b[1] = -2.0f * cos_w0; @@ -198,7 +198,7 @@ void AutowahState::process(const size_t samplesToDo, const al::span<const FloatB } -void Autowah_setParamf(EffectProps *props, ALCcontext *context, ALenum param, ALfloat val) +void Autowah_setParamf(EffectProps *props, ALCcontext *context, ALenum param, float val) { switch(param) { @@ -230,15 +230,15 @@ void Autowah_setParamf(EffectProps *props, ALCcontext *context, ALenum param, AL context->setError(AL_INVALID_ENUM, "Invalid autowah float property 0x%04x", param); } } -void Autowah_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +void Autowah_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const float *vals) { Autowah_setParamf(props, context, param, vals[0]); } -void Autowah_setParami(EffectProps*, ALCcontext *context, ALenum param, ALint) +void Autowah_setParami(EffectProps*, ALCcontext *context, ALenum param, int) { context->setError(AL_INVALID_ENUM, "Invalid autowah integer property 0x%04x", param); } -void Autowah_setParamiv(EffectProps*, ALCcontext *context, ALenum param, const ALint*) +void Autowah_setParamiv(EffectProps*, ALCcontext *context, ALenum param, const int*) { context->setError(AL_INVALID_ENUM, "Invalid autowah integer vector property 0x%04x", param); } -void Autowah_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) +void Autowah_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, float *val) { switch(param) { @@ -263,12 +263,12 @@ void Autowah_getParamf(const EffectProps *props, ALCcontext *context, ALenum par } } -void Autowah_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +void Autowah_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, float *vals) { Autowah_getParamf(props, context, param, vals); } -void Autowah_getParami(const EffectProps*, ALCcontext *context, ALenum param, ALint*) +void Autowah_getParami(const EffectProps*, ALCcontext *context, ALenum param, int*) { context->setError(AL_INVALID_ENUM, "Invalid autowah integer property 0x%04x", param); } -void Autowah_getParamiv(const EffectProps*, ALCcontext *context, ALenum param, ALint*) +void Autowah_getParamiv(const EffectProps*, ALCcontext *context, ALenum param, int*) { context->setError(AL_INVALID_ENUM, "Invalid autowah integer vector property 0x%04x", param); } DEFINE_ALEFFECT_VTABLE(Autowah); diff --git a/alc/effects/chorus.cpp b/alc/effects/chorus.cpp index a6408fce..c425ccc9 100644 --- a/alc/effects/chorus.cpp +++ b/alc/effects/chorus.cpp @@ -55,7 +55,7 @@ enum class WaveForm { }; void GetTriangleDelays(ALuint *delays, const ALuint start_offset, const ALuint lfo_range, - const ALfloat lfo_scale, const ALfloat depth, const ALsizei delay, const size_t todo) + const float lfo_scale, const float depth, const ALsizei delay, const size_t todo) { ASSUME(lfo_range > 0); ASSUME(todo > 0); @@ -71,7 +71,7 @@ void GetTriangleDelays(ALuint *delays, const ALuint start_offset, const ALuint l } void GetSinusoidDelays(ALuint *delays, const ALuint start_offset, const ALuint lfo_range, - const ALfloat lfo_scale, const ALfloat depth, const ALsizei delay, const size_t todo) + const float lfo_scale, const float depth, const ALsizei delay, const size_t todo) { ASSUME(lfo_range > 0); ASSUME(todo > 0); @@ -87,25 +87,25 @@ void GetSinusoidDelays(ALuint *delays, const ALuint start_offset, const ALuint l } struct ChorusState final : public EffectState { - al::vector<ALfloat,16> mSampleBuffer; + al::vector<float,16> mSampleBuffer; ALuint mOffset{0}; ALuint mLfoOffset{0}; ALuint mLfoRange{1}; - ALfloat mLfoScale{0.0f}; + float mLfoScale{0.0f}; ALuint mLfoDisp{0}; /* Gains for left and right sides */ struct { - ALfloat Current[MAX_OUTPUT_CHANNELS]{}; - ALfloat Target[MAX_OUTPUT_CHANNELS]{}; + float Current[MAX_OUTPUT_CHANNELS]{}; + float Target[MAX_OUTPUT_CHANNELS]{}; } mGains[2]; /* effect parameters */ WaveForm mWaveform{}; - ALint mDelay{0}; - ALfloat mDepth{0.0f}; - ALfloat mFeedback{0.0f}; + int mDelay{0}; + float mDepth{0.0f}; + float mFeedback{0.0f}; bool deviceUpdate(const ALCdevice *device) override; @@ -117,7 +117,7 @@ struct ChorusState final : public EffectState { bool ChorusState::deviceUpdate(const ALCdevice *Device) { - constexpr ALfloat max_delay{maxf(AL_CHORUS_MAX_DELAY, AL_FLANGER_MAX_DELAY)}; + constexpr float max_delay{maxf(AL_CHORUS_MAX_DELAY, AL_FLANGER_MAX_DELAY)}; const auto frequency = static_cast<float>(Device->Frequency); const size_t maxlen{NextPowerOf2(float2uint(max_delay*2.0f*frequency) + 1u)}; @@ -164,7 +164,7 @@ void ChorusState::update(const ALCcontext *Context, const ALeffectslot *Slot, co mFeedback = props->Chorus.Feedback; /* Gains for left and right sides */ - ALfloat coeffs[2][MAX_AMBI_CHANNELS]; + float coeffs[2][MAX_AMBI_CHANNELS]; CalcDirectionCoeffs({-1.0f, 0.0f, 0.0f}, 0.0f, coeffs[0]); CalcDirectionCoeffs({ 1.0f, 0.0f, 0.0f}, 0.0f, coeffs[1]); @@ -172,7 +172,7 @@ void ChorusState::update(const ALCcontext *Context, const ALeffectslot *Slot, co ComputePanGains(target.Main, coeffs[0], Slot->Params.Gain, mGains[0].Target); ComputePanGains(target.Main, coeffs[1], Slot->Params.Gain, mGains[1].Target); - ALfloat rate{props->Chorus.Rate}; + float rate{props->Chorus.Rate}; if(!(rate > 0.0f)) { mLfoOffset = 0; @@ -185,7 +185,7 @@ void ChorusState::update(const ALCcontext *Context, const ALeffectslot *Slot, co /* Calculate LFO coefficient (number of samples per cycle). Limit the * max range to avoid overflow when calculating the displacement. */ - ALuint lfo_range{float2uint(minf(frequency/rate + 0.5f, ALfloat{INT_MAX/360 - 180}))}; + ALuint lfo_range{float2uint(minf(frequency/rate + 0.5f, float{INT_MAX/360 - 180}))}; mLfoOffset = mLfoOffset * lfo_range / mLfoRange; mLfoRange = lfo_range; @@ -200,7 +200,7 @@ void ChorusState::update(const ALCcontext *Context, const ALeffectslot *Slot, co } /* Calculate lfo phase displacement */ - ALint phase{props->Chorus.Phase}; + int phase{props->Chorus.Phase}; if(phase < 0) phase = 360 + phase; mLfoDisp = (mLfoRange*static_cast<ALuint>(phase) + 180) / 360; } @@ -209,9 +209,9 @@ void ChorusState::update(const ALCcontext *Context, const ALeffectslot *Slot, co void ChorusState::process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) { const size_t bufmask{mSampleBuffer.size()-1}; - const ALfloat feedback{mFeedback}; + const float feedback{mFeedback}; const ALuint avgdelay{(static_cast<ALuint>(mDelay) + (FRACTIONONE>>1)) >> FRACTIONBITS}; - ALfloat *RESTRICT delaybuf{mSampleBuffer.data()}; + float *RESTRICT delaybuf{mSampleBuffer.data()}; ALuint offset{mOffset}; for(size_t base{0u};base < samplesToDo;) @@ -235,7 +235,7 @@ void ChorusState::process(const size_t samplesToDo, const al::span<const FloatBu } mLfoOffset = (mLfoOffset+static_cast<ALuint>(todo)) % mLfoRange; - alignas(16) ALfloat temps[2][256]; + alignas(16) float temps[2][256]; for(size_t i{0u};i < todo;i++) { // Feed the buffer's input first (necessary for delays < 1). @@ -243,7 +243,7 @@ void ChorusState::process(const size_t samplesToDo, const al::span<const FloatBu // Tap for the left output. ALuint delay{offset - (moddelays[0][i]>>FRACTIONBITS)}; - ALfloat mu{static_cast<float>(moddelays[0][i]&FRACTIONMASK) * (1.0f/FRACTIONONE)}; + float mu{static_cast<float>(moddelays[0][i]&FRACTIONMASK) * (1.0f/FRACTIONONE)}; temps[0][i] = cubic(delaybuf[(delay+1) & bufmask], delaybuf[(delay ) & bufmask], delaybuf[(delay-1) & bufmask], delaybuf[(delay-2) & bufmask], mu); @@ -269,7 +269,7 @@ void ChorusState::process(const size_t samplesToDo, const al::span<const FloatBu } -void Chorus_setParami(EffectProps *props, ALCcontext *context, ALenum param, ALint val) +void Chorus_setParami(EffectProps *props, ALCcontext *context, ALenum param, int val) { switch(param) { @@ -289,9 +289,9 @@ void Chorus_setParami(EffectProps *props, ALCcontext *context, ALenum param, ALi context->setError(AL_INVALID_ENUM, "Invalid chorus integer property 0x%04x", param); } } -void Chorus_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +void Chorus_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const int *vals) { Chorus_setParami(props, context, param, vals[0]); } -void Chorus_setParamf(EffectProps *props, ALCcontext *context, ALenum param, ALfloat val) +void Chorus_setParamf(EffectProps *props, ALCcontext *context, ALenum param, float val) { switch(param) { @@ -323,10 +323,10 @@ void Chorus_setParamf(EffectProps *props, ALCcontext *context, ALenum param, ALf context->setError(AL_INVALID_ENUM, "Invalid chorus float property 0x%04x", param); } } -void Chorus_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +void Chorus_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const float *vals) { Chorus_setParamf(props, context, param, vals[0]); } -void Chorus_getParami(const EffectProps *props, ALCcontext *context, ALenum param, ALint *val) +void Chorus_getParami(const EffectProps *props, ALCcontext *context, ALenum param, int *val) { switch(param) { @@ -342,9 +342,9 @@ void Chorus_getParami(const EffectProps *props, ALCcontext *context, ALenum para context->setError(AL_INVALID_ENUM, "Invalid chorus integer property 0x%04x", param); } } -void Chorus_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +void Chorus_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, int *vals) { Chorus_getParami(props, context, param, vals); } -void Chorus_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) +void Chorus_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, float *val) { switch(param) { @@ -368,7 +368,7 @@ void Chorus_getParamf(const EffectProps *props, ALCcontext *context, ALenum para context->setError(AL_INVALID_ENUM, "Invalid chorus float property 0x%04x", param); } } -void Chorus_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +void Chorus_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, float *vals) { Chorus_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Chorus); @@ -393,7 +393,7 @@ EffectProps ChorusStateFactory::getDefaultProps() const noexcept } -void Flanger_setParami(EffectProps *props, ALCcontext *context, ALenum param, ALint val) +void Flanger_setParami(EffectProps *props, ALCcontext *context, ALenum param, int val) { switch(param) { @@ -413,9 +413,9 @@ void Flanger_setParami(EffectProps *props, ALCcontext *context, ALenum param, AL context->setError(AL_INVALID_ENUM, "Invalid flanger integer property 0x%04x", param); } } -void Flanger_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +void Flanger_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const int *vals) { Flanger_setParami(props, context, param, vals[0]); } -void Flanger_setParamf(EffectProps *props, ALCcontext *context, ALenum param, ALfloat val) +void Flanger_setParamf(EffectProps *props, ALCcontext *context, ALenum param, float val) { switch(param) { @@ -447,10 +447,10 @@ void Flanger_setParamf(EffectProps *props, ALCcontext *context, ALenum param, AL context->setError(AL_INVALID_ENUM, "Invalid flanger float property 0x%04x", param); } } -void Flanger_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +void Flanger_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const float *vals) { Flanger_setParamf(props, context, param, vals[0]); } -void Flanger_getParami(const EffectProps *props, ALCcontext *context, ALenum param, ALint *val) +void Flanger_getParami(const EffectProps *props, ALCcontext *context, ALenum param, int *val) { switch(param) { @@ -466,9 +466,9 @@ void Flanger_getParami(const EffectProps *props, ALCcontext *context, ALenum par context->setError(AL_INVALID_ENUM, "Invalid flanger integer property 0x%04x", param); } } -void Flanger_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +void Flanger_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, int *vals) { Flanger_getParami(props, context, param, vals); } -void Flanger_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) +void Flanger_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, float *val) { switch(param) { @@ -492,7 +492,7 @@ void Flanger_getParamf(const EffectProps *props, ALCcontext *context, ALenum par context->setError(AL_INVALID_ENUM, "Invalid flanger float property 0x%04x", param); } } -void Flanger_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +void Flanger_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, float *vals) { Flanger_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Flanger); diff --git a/alc/effects/compressor.cpp b/alc/effects/compressor.cpp index e5e0339f..d5cb0c75 100644 --- a/alc/effects/compressor.cpp +++ b/alc/effects/compressor.cpp @@ -40,13 +40,13 @@ namespace { struct CompressorState final : public EffectState { /* Effect gains for each channel */ - ALfloat mGain[MAX_AMBI_CHANNELS][MAX_OUTPUT_CHANNELS]{}; + float mGain[MAX_AMBI_CHANNELS][MAX_OUTPUT_CHANNELS]{}; /* Effect parameters */ bool mEnabled{true}; - ALfloat mAttackMult{1.0f}; - ALfloat mReleaseMult{1.0f}; - ALfloat mEnvFollower{1.0f}; + float mAttackMult{1.0f}; + float mReleaseMult{1.0f}; + float mEnvFollower{1.0f}; bool deviceUpdate(const ALCdevice *device) override; @@ -61,8 +61,8 @@ bool CompressorState::deviceUpdate(const ALCdevice *device) /* Number of samples to do a full attack and release (non-integer sample * counts are okay). */ - const ALfloat attackCount = static_cast<ALfloat>(device->Frequency) * ATTACK_TIME; - const ALfloat releaseCount = static_cast<ALfloat>(device->Frequency) * RELEASE_TIME; + const float attackCount = static_cast<float>(device->Frequency) * ATTACK_TIME; + const float releaseCount = static_cast<float>(device->Frequency) * RELEASE_TIME; /* Calculate per-sample multipliers to attack and release at the desired * rates. @@ -89,11 +89,11 @@ void CompressorState::process(const size_t samplesToDo, const al::span<const Flo { for(size_t base{0u};base < samplesToDo;) { - ALfloat gains[256]; + float gains[256]; const size_t td{minz(256, samplesToDo-base)}; /* Generate the per-sample gains from the signal envelope. */ - ALfloat env{mEnvFollower}; + float env{mEnvFollower}; if(mEnabled) { for(size_t i{0u};i < td;++i) @@ -101,7 +101,7 @@ void CompressorState::process(const size_t samplesToDo, const al::span<const Flo /* Clamp the absolute amplitude to the defined envelope limits, * then attack or release the envelope to reach it. */ - const ALfloat amplitude{clampf(std::fabs(samplesIn[0][base+i]), AMP_ENVELOPE_MIN, + const float amplitude{clampf(std::fabs(samplesIn[0][base+i]), AMP_ENVELOPE_MIN, AMP_ENVELOPE_MAX)}; if(amplitude > env) env = minf(env*mAttackMult, amplitude); @@ -122,7 +122,7 @@ void CompressorState::process(const size_t samplesToDo, const al::span<const Flo */ for(size_t i{0u};i < td;++i) { - const ALfloat amplitude{1.0f}; + const float amplitude{1.0f}; if(amplitude > env) env = minf(env*mAttackMult, amplitude); else if(amplitude < env) @@ -137,10 +137,10 @@ void CompressorState::process(const size_t samplesToDo, const al::span<const Flo auto changains = std::addressof(mGain[0]); for(const auto &input : samplesIn) { - const ALfloat *outgains{*(changains++)}; + const float *outgains{*(changains++)}; for(FloatBufferLine &output : samplesOut) { - const ALfloat gain{*(outgains++)}; + const float gain{*(outgains++)}; if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD)) continue; @@ -154,7 +154,7 @@ void CompressorState::process(const size_t samplesToDo, const al::span<const Flo } -void Compressor_setParami(EffectProps *props, ALCcontext *context, ALenum param, ALint val) +void Compressor_setParami(EffectProps *props, ALCcontext *context, ALenum param, int val) { switch(param) { @@ -169,14 +169,14 @@ void Compressor_setParami(EffectProps *props, ALCcontext *context, ALenum param, param); } } -void Compressor_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +void Compressor_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const int *vals) { Compressor_setParami(props, context, param, vals[0]); } -void Compressor_setParamf(EffectProps*, ALCcontext *context, ALenum param, ALfloat) +void Compressor_setParamf(EffectProps*, ALCcontext *context, ALenum param, float) { context->setError(AL_INVALID_ENUM, "Invalid compressor float property 0x%04x", param); } -void Compressor_setParamfv(EffectProps*, ALCcontext *context, ALenum param, const ALfloat*) +void Compressor_setParamfv(EffectProps*, ALCcontext *context, ALenum param, const float*) { context->setError(AL_INVALID_ENUM, "Invalid compressor float-vector property 0x%04x", param); } -void Compressor_getParami(const EffectProps *props, ALCcontext *context, ALenum param, ALint *val) +void Compressor_getParami(const EffectProps *props, ALCcontext *context, ALenum param, int *val) { switch(param) { @@ -189,11 +189,11 @@ void Compressor_getParami(const EffectProps *props, ALCcontext *context, ALenum param); } } -void Compressor_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +void Compressor_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, int *vals) { Compressor_getParami(props, context, param, vals); } -void Compressor_getParamf(const EffectProps*, ALCcontext *context, ALenum param, ALfloat*) +void Compressor_getParamf(const EffectProps*, ALCcontext *context, ALenum param, float*) { context->setError(AL_INVALID_ENUM, "Invalid compressor float property 0x%04x", param); } -void Compressor_getParamfv(const EffectProps*, ALCcontext *context, ALenum param, ALfloat*) +void Compressor_getParamfv(const EffectProps*, ALCcontext *context, ALenum param, float*) { context->setError(AL_INVALID_ENUM, "Invalid compressor float-vector property 0x%04x", param); } DEFINE_ALEFFECT_VTABLE(Compressor); diff --git a/alc/effects/dedicated.cpp b/alc/effects/dedicated.cpp index e1640498..98a516bd 100644 --- a/alc/effects/dedicated.cpp +++ b/alc/effects/dedicated.cpp @@ -33,8 +33,8 @@ namespace { struct DedicatedState final : public EffectState { - ALfloat mCurrentGains[MAX_OUTPUT_CHANNELS]; - ALfloat mTargetGains[MAX_OUTPUT_CHANNELS]; + float mCurrentGains[MAX_OUTPUT_CHANNELS]; + float mTargetGains[MAX_OUTPUT_CHANNELS]; bool deviceUpdate(const ALCdevice *device) override; @@ -54,7 +54,7 @@ void DedicatedState::update(const ALCcontext*, const ALeffectslot *slot, const E { std::fill(std::begin(mTargetGains), std::end(mTargetGains), 0.0f); - const ALfloat Gain{slot->Params.Gain * props->Dedicated.Gain}; + const float Gain{slot->Params.Gain * props->Dedicated.Gain}; if(slot->Params.EffectType == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT) { @@ -79,7 +79,7 @@ void DedicatedState::update(const ALCcontext*, const ALeffectslot *slot, const E } else { - ALfloat coeffs[MAX_AMBI_CHANNELS]; + float coeffs[MAX_AMBI_CHANNELS]; CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}, 0.0f, coeffs); mOutTarget = target.Main->Buffer; @@ -95,11 +95,11 @@ void DedicatedState::process(const size_t samplesToDo, const al::span<const Floa } -void Dedicated_setParami(EffectProps*, ALCcontext *context, ALenum param, ALint) +void Dedicated_setParami(EffectProps*, ALCcontext *context, ALenum param, int) { context->setError(AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param); } -void Dedicated_setParamiv(EffectProps*, ALCcontext *context, ALenum param, const ALint*) +void Dedicated_setParamiv(EffectProps*, ALCcontext *context, ALenum param, const int*) { context->setError(AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x", param); } -void Dedicated_setParamf(EffectProps *props, ALCcontext *context, ALenum param, ALfloat val) +void Dedicated_setParamf(EffectProps *props, ALCcontext *context, ALenum param, float val) { switch(param) { @@ -113,14 +113,14 @@ void Dedicated_setParamf(EffectProps *props, ALCcontext *context, ALenum param, context->setError(AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param); } } -void Dedicated_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +void Dedicated_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const float *vals) { Dedicated_setParamf(props, context, param, vals[0]); } -void Dedicated_getParami(const EffectProps*, ALCcontext *context, ALenum param, ALint*) +void Dedicated_getParami(const EffectProps*, ALCcontext *context, ALenum param, int*) { context->setError(AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param); } -void Dedicated_getParamiv(const EffectProps*, ALCcontext *context, ALenum param, ALint*) +void Dedicated_getParamiv(const EffectProps*, ALCcontext *context, ALenum param, int*) { context->setError(AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x", param); } -void Dedicated_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) +void Dedicated_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, float *val) { switch(param) { @@ -132,7 +132,7 @@ void Dedicated_getParamf(const EffectProps *props, ALCcontext *context, ALenum p context->setError(AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param); } } -void Dedicated_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +void Dedicated_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, float *vals) { Dedicated_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Dedicated); diff --git a/alc/effects/distortion.cpp b/alc/effects/distortion.cpp index 85b8c6fc..ca214991 100644 --- a/alc/effects/distortion.cpp +++ b/alc/effects/distortion.cpp @@ -35,15 +35,15 @@ namespace { struct DistortionState final : public EffectState { /* Effect gains for each channel */ - ALfloat mGain[MAX_OUTPUT_CHANNELS]{}; + float mGain[MAX_OUTPUT_CHANNELS]{}; /* Effect parameters */ BiquadFilter mLowpass; BiquadFilter mBandpass; - ALfloat mAttenuation{}; - ALfloat mEdgeCoeff{}; + float mAttenuation{}; + float mEdgeCoeff{}; - ALfloat mBuffer[2][BUFFERSIZE]{}; + float mBuffer[2][BUFFERSIZE]{}; bool deviceUpdate(const ALCdevice *device) override; @@ -65,17 +65,17 @@ void DistortionState::update(const ALCcontext *context, const ALeffectslot *slot const ALCdevice *device{context->mDevice.get()}; /* Store waveshaper edge settings. */ - const ALfloat edge{ - minf(std::sin(al::MathDefs<float>::Pi()*0.5f * props->Distortion.Edge), 0.99f)}; + const float edge{minf(std::sin(al::MathDefs<float>::Pi()*0.5f * props->Distortion.Edge), + 0.99f)}; mEdgeCoeff = 2.0f * edge / (1.0f-edge); - ALfloat cutoff{props->Distortion.LowpassCutoff}; + float cutoff{props->Distortion.LowpassCutoff}; /* Bandwidth value is constant in octaves. */ - ALfloat bandwidth{(cutoff / 2.0f) / (cutoff * 0.67f)}; + float bandwidth{(cutoff / 2.0f) / (cutoff * 0.67f)}; /* Divide normalized frequency by the amount of oversampling done during * processing. */ - auto frequency = static_cast<ALfloat>(device->Frequency); + auto frequency = static_cast<float>(device->Frequency); mLowpass.setParamsFromBandwidth(BiquadType::LowPass, cutoff/frequency/4.0f, 1.0f, bandwidth); cutoff = props->Distortion.EQCenter; @@ -83,7 +83,7 @@ void DistortionState::update(const ALCcontext *context, const ALeffectslot *slot bandwidth = props->Distortion.EQBandwidth / (cutoff * 0.67f); mBandpass.setParamsFromBandwidth(BiquadType::BandPass, cutoff/frequency/4.0f, 1.0f, bandwidth); - ALfloat coeffs[MAX_AMBI_CHANNELS]; + float coeffs[MAX_AMBI_CHANNELS]; CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}, 0.0f, coeffs); mOutTarget = target.Main->Buffer; @@ -92,7 +92,7 @@ void DistortionState::update(const ALCcontext *context, const ALeffectslot *slot void DistortionState::process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) { - const ALfloat fc{mEdgeCoeff}; + const float fc{mEdgeCoeff}; for(size_t base{0u};base < samplesToDo;) { /* Perform 4x oversampling to avoid aliasing. Oversampling greatly @@ -134,13 +134,13 @@ void DistortionState::process(const size_t samplesToDo, const al::span<const Flo mBandpass.process({mBuffer[0], todo}, mBuffer[1]); todo >>= 2; - const ALfloat *outgains{mGain}; + const float *outgains{mGain}; for(FloatBufferLine &output : samplesOut) { /* Fourth step, final, do attenuation and perform decimation, * storing only one sample out of four. */ - const ALfloat gain{*(outgains++)}; + const float gain{*(outgains++)}; if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD)) continue; @@ -153,11 +153,11 @@ void DistortionState::process(const size_t samplesToDo, const al::span<const Flo } -void Distortion_setParami(EffectProps*, ALCcontext *context, ALenum param, ALint) +void Distortion_setParami(EffectProps*, ALCcontext *context, ALenum param, int) { context->setError(AL_INVALID_ENUM, "Invalid distortion integer property 0x%04x", param); } -void Distortion_setParamiv(EffectProps*, ALCcontext *context, ALenum param, const ALint*) +void Distortion_setParamiv(EffectProps*, ALCcontext *context, ALenum param, const int*) { context->setError(AL_INVALID_ENUM, "Invalid distortion integer-vector property 0x%04x", param); } -void Distortion_setParamf(EffectProps *props, ALCcontext *context, ALenum param, ALfloat val) +void Distortion_setParamf(EffectProps *props, ALCcontext *context, ALenum param, float val) { switch(param) { @@ -195,14 +195,14 @@ void Distortion_setParamf(EffectProps *props, ALCcontext *context, ALenum param, context->setError(AL_INVALID_ENUM, "Invalid distortion float property 0x%04x", param); } } -void Distortion_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +void Distortion_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const float *vals) { Distortion_setParamf(props, context, param, vals[0]); } -void Distortion_getParami(const EffectProps*, ALCcontext *context, ALenum param, ALint*) +void Distortion_getParami(const EffectProps*, ALCcontext *context, ALenum param, int*) { context->setError(AL_INVALID_ENUM, "Invalid distortion integer property 0x%04x", param); } -void Distortion_getParamiv(const EffectProps*, ALCcontext *context, ALenum param, ALint*) +void Distortion_getParamiv(const EffectProps*, ALCcontext *context, ALenum param, int*) { context->setError(AL_INVALID_ENUM, "Invalid distortion integer-vector property 0x%04x", param); } -void Distortion_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) +void Distortion_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, float *val) { switch(param) { @@ -230,7 +230,7 @@ void Distortion_getParamf(const EffectProps *props, ALCcontext *context, ALenum context->setError(AL_INVALID_ENUM, "Invalid distortion float property 0x%04x", param); } } -void Distortion_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +void Distortion_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, float *vals) { Distortion_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Distortion); diff --git a/alc/effects/echo.cpp b/alc/effects/echo.cpp index bc778d46..047e551a 100644 --- a/alc/effects/echo.cpp +++ b/alc/effects/echo.cpp @@ -37,7 +37,7 @@ namespace { struct EchoState final : public EffectState { - al::vector<ALfloat,16> mSampleBuffer; + al::vector<float,16> mSampleBuffer; // The echo is two tap. The delay is the number of samples from before the // current offset @@ -48,14 +48,14 @@ struct EchoState final : public EffectState { /* The panning gains for the two taps */ struct { - ALfloat Current[MAX_OUTPUT_CHANNELS]{}; - ALfloat Target[MAX_OUTPUT_CHANNELS]{}; + float Current[MAX_OUTPUT_CHANNELS]{}; + float Target[MAX_OUTPUT_CHANNELS]{}; } mGains[2]; BiquadFilter mFilter; - ALfloat mFeedGain{0.0f}; + float mFeedGain{0.0f}; - alignas(16) ALfloat mTempBuffer[2][BUFFERSIZE]; + alignas(16) float mTempBuffer[2][BUFFERSIZE]; bool deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; @@ -91,20 +91,20 @@ bool EchoState::deviceUpdate(const ALCdevice *Device) void EchoState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) { const ALCdevice *device{context->mDevice.get()}; - const auto frequency = static_cast<ALfloat>(device->Frequency); + const auto frequency = static_cast<float>(device->Frequency); mTap[0].delay = maxu(float2uint(props->Echo.Delay*frequency + 0.5f), 1); mTap[1].delay = float2uint(props->Echo.LRDelay*frequency + 0.5f) + mTap[0].delay; - const ALfloat gainhf{maxf(1.0f - props->Echo.Damping, 0.0625f)}; /* Limit -24dB */ + const float gainhf{maxf(1.0f - props->Echo.Damping, 0.0625f)}; /* Limit -24dB */ mFilter.setParamsFromSlope(BiquadType::HighShelf, LOWPASSFREQREF/frequency, gainhf, 1.0f); mFeedGain = props->Echo.Feedback; /* Convert echo spread (where 0 = center, +/-1 = sides) to angle. */ - const ALfloat angle{std::asin(props->Echo.Spread)}; + const float angle{std::asin(props->Echo.Spread)}; - ALfloat coeffs[2][MAX_AMBI_CHANNELS]; + float coeffs[2][MAX_AMBI_CHANNELS]; CalcAngleCoeffs(-angle, 0.0f, 0.0f, coeffs[0]); CalcAngleCoeffs( angle, 0.0f, 0.0f, coeffs[1]); @@ -116,11 +116,11 @@ void EchoState::update(const ALCcontext *context, const ALeffectslot *slot, cons void EchoState::process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) { const size_t mask{mSampleBuffer.size()-1}; - ALfloat *RESTRICT delaybuf{mSampleBuffer.data()}; + float *RESTRICT delaybuf{mSampleBuffer.data()}; size_t offset{mOffset}; size_t tap1{offset - mTap[0].delay}; size_t tap2{offset - mTap[1].delay}; - ALfloat z1, z2; + float z1, z2; ASSUME(samplesToDo > 0); @@ -157,11 +157,11 @@ void EchoState::process(const size_t samplesToDo, const al::span<const FloatBuff } -void Echo_setParami(EffectProps*, ALCcontext *context, ALenum param, ALint) +void Echo_setParami(EffectProps*, ALCcontext *context, ALenum param, int) { context->setError(AL_INVALID_ENUM, "Invalid echo integer property 0x%04x", param); } -void Echo_setParamiv(EffectProps*, ALCcontext *context, ALenum param, const ALint*) +void Echo_setParamiv(EffectProps*, ALCcontext *context, ALenum param, const int*) { context->setError(AL_INVALID_ENUM, "Invalid echo integer-vector property 0x%04x", param); } -void Echo_setParamf(EffectProps *props, ALCcontext *context, ALenum param, ALfloat val) +void Echo_setParamf(EffectProps *props, ALCcontext *context, ALenum param, float val) { switch(param) { @@ -199,14 +199,14 @@ void Echo_setParamf(EffectProps *props, ALCcontext *context, ALenum param, ALflo context->setError(AL_INVALID_ENUM, "Invalid echo float property 0x%04x", param); } } -void Echo_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +void Echo_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const float *vals) { Echo_setParamf(props, context, param, vals[0]); } -void Echo_getParami(const EffectProps*, ALCcontext *context, ALenum param, ALint*) +void Echo_getParami(const EffectProps*, ALCcontext *context, ALenum param, int*) { context->setError(AL_INVALID_ENUM, "Invalid echo integer property 0x%04x", param); } -void Echo_getParamiv(const EffectProps*, ALCcontext *context, ALenum param, ALint*) +void Echo_getParamiv(const EffectProps*, ALCcontext *context, ALenum param, int*) { context->setError(AL_INVALID_ENUM, "Invalid echo integer-vector property 0x%04x", param); } -void Echo_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) +void Echo_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, float *val) { switch(param) { @@ -234,7 +234,7 @@ void Echo_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, context->setError(AL_INVALID_ENUM, "Invalid echo float property 0x%04x", param); } } -void Echo_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +void Echo_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, float *vals) { Echo_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Echo); diff --git a/alc/effects/equalizer.cpp b/alc/effects/equalizer.cpp index 072a87e7..366ba58f 100644 --- a/alc/effects/equalizer.cpp +++ b/alc/effects/equalizer.cpp @@ -84,8 +84,8 @@ struct EqualizerState final : public EffectState { BiquadFilter filter[4]; /* Effect gains for each channel */ - ALfloat CurrentGains[MAX_OUTPUT_CHANNELS]{}; - ALfloat TargetGains[MAX_OUTPUT_CHANNELS]{}; + float CurrentGains[MAX_OUTPUT_CHANNELS]{}; + float TargetGains[MAX_OUTPUT_CHANNELS]{}; } mChans[MAX_AMBI_CHANNELS]; FloatBufferLine mSampleBuffer{}; @@ -112,8 +112,8 @@ bool EqualizerState::deviceUpdate(const ALCdevice*) void EqualizerState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) { const ALCdevice *device{context->mDevice.get()}; - auto frequency = static_cast<ALfloat>(device->Frequency); - ALfloat gain, f0norm; + auto frequency = static_cast<float>(device->Frequency); + float gain, f0norm; /* Calculate coefficients for the each type of filter. Note that the shelf * and peaking filters' gain is for the centerpoint of the transition band, @@ -174,11 +174,11 @@ void EqualizerState::process(const size_t samplesToDo, const al::span<const Floa } -void Equalizer_setParami(EffectProps*, ALCcontext *context, ALenum param, ALint) +void Equalizer_setParami(EffectProps*, ALCcontext *context, ALenum param, int) { context->setError(AL_INVALID_ENUM, "Invalid equalizer integer property 0x%04x", param); } -void Equalizer_setParamiv(EffectProps*, ALCcontext *context, ALenum param, const ALint*) +void Equalizer_setParamiv(EffectProps*, ALCcontext *context, ALenum param, const int*) { context->setError(AL_INVALID_ENUM, "Invalid equalizer integer-vector property 0x%04x", param); } -void Equalizer_setParamf(EffectProps *props, ALCcontext *context, ALenum param, ALfloat val) +void Equalizer_setParamf(EffectProps *props, ALCcontext *context, ALenum param, float val) { switch(param) { @@ -246,14 +246,14 @@ void Equalizer_setParamf(EffectProps *props, ALCcontext *context, ALenum param, context->setError(AL_INVALID_ENUM, "Invalid equalizer float property 0x%04x", param); } } -void Equalizer_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +void Equalizer_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const float *vals) { Equalizer_setParamf(props, context, param, vals[0]); } -void Equalizer_getParami(const EffectProps*, ALCcontext *context, ALenum param, ALint*) +void Equalizer_getParami(const EffectProps*, ALCcontext *context, ALenum param, int*) { context->setError(AL_INVALID_ENUM, "Invalid equalizer integer property 0x%04x", param); } -void Equalizer_getParamiv(const EffectProps*, ALCcontext *context, ALenum param, ALint*) +void Equalizer_getParamiv(const EffectProps*, ALCcontext *context, ALenum param, int*) { context->setError(AL_INVALID_ENUM, "Invalid equalizer integer-vector property 0x%04x", param); } -void Equalizer_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) +void Equalizer_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, float *val) { switch(param) { @@ -301,7 +301,7 @@ void Equalizer_getParamf(const EffectProps *props, ALCcontext *context, ALenum p context->setError(AL_INVALID_ENUM, "Invalid equalizer float property 0x%04x", param); } } -void Equalizer_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +void Equalizer_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, float *vals) { Equalizer_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Equalizer); diff --git a/alc/effects/fshifter.cpp b/alc/effects/fshifter.cpp index fb859e23..2d299e74 100644 --- a/alc/effects/fshifter.cpp +++ b/alc/effects/fshifter.cpp @@ -77,8 +77,8 @@ struct FshifterState final : public EffectState { /* Effect gains for each output channel */ struct { - ALfloat Current[MAX_OUTPUT_CHANNELS]{}; - ALfloat Target[MAX_OUTPUT_CHANNELS]{}; + float Current[MAX_OUTPUT_CHANNELS]{}; + float Target[MAX_OUTPUT_CHANNELS]{}; } mGains[2]; @@ -150,7 +150,7 @@ void FshifterState::update(const ALCcontext *context, const ALeffectslot *slot, break; } - ALfloat coeffs[2][MAX_AMBI_CHANNELS]; + float coeffs[2][MAX_AMBI_CHANNELS]; CalcDirectionCoeffs({-1.0f, 0.0f, 0.0f}, 0.0f, coeffs[0]); CalcDirectionCoeffs({ 1.0f, 0.0f, 0.0f}, 0.0f, coeffs[1]); @@ -198,7 +198,7 @@ void FshifterState::process(const size_t samplesToDo, const al::span<const Float } /* Process frequency shifter using the analytic signal obtained. */ - ALfloat *RESTRICT BufferOut{mBufferOut}; + float *RESTRICT BufferOut{mBufferOut}; for(ALsizei c{0};c < 2;++c) { const ALuint phase_step{mPhaseStep[c]}; @@ -221,7 +221,7 @@ void FshifterState::process(const size_t samplesToDo, const al::span<const Float } -void Fshifter_setParamf(EffectProps *props, ALCcontext *context, ALenum param, ALfloat val) +void Fshifter_setParamf(EffectProps *props, ALCcontext *context, ALenum param, float val) { switch(param) { @@ -236,10 +236,10 @@ void Fshifter_setParamf(EffectProps *props, ALCcontext *context, ALenum param, A param); } } -void Fshifter_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +void Fshifter_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const float *vals) { Fshifter_setParamf(props, context, param, vals[0]); } -void Fshifter_setParami(EffectProps *props, ALCcontext *context, ALenum param, ALint val) +void Fshifter_setParami(EffectProps *props, ALCcontext *context, ALenum param, int val) { switch(param) { @@ -260,10 +260,10 @@ void Fshifter_setParami(EffectProps *props, ALCcontext *context, ALenum param, A param); } } -void Fshifter_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +void Fshifter_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const int *vals) { Fshifter_setParami(props, context, param, vals[0]); } -void Fshifter_getParami(const EffectProps *props, ALCcontext *context, ALenum param, ALint *val) +void Fshifter_getParami(const EffectProps *props, ALCcontext *context, ALenum param, int *val) { switch(param) { @@ -278,10 +278,10 @@ void Fshifter_getParami(const EffectProps *props, ALCcontext *context, ALenum pa param); } } -void Fshifter_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +void Fshifter_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, int *vals) { Fshifter_getParami(props, context, param, vals); } -void Fshifter_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) +void Fshifter_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, float *val) { switch(param) { @@ -294,7 +294,7 @@ void Fshifter_getParamf(const EffectProps *props, ALCcontext *context, ALenum pa param); } } -void Fshifter_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +void Fshifter_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, float *vals) { Fshifter_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Fshifter); diff --git a/alc/effects/modulator.cpp b/alc/effects/modulator.cpp index 5967cd40..26401ada 100644 --- a/alc/effects/modulator.cpp +++ b/alc/effects/modulator.cpp @@ -77,8 +77,8 @@ struct ModulatorState final : public EffectState { struct { BiquadFilter Filter; - ALfloat CurrentGains[MAX_OUTPUT_CHANNELS]{}; - ALfloat TargetGains[MAX_OUTPUT_CHANNELS]{}; + float CurrentGains[MAX_OUTPUT_CHANNELS]{}; + float TargetGains[MAX_OUTPUT_CHANNELS]{}; } mChans[MAX_AMBI_CHANNELS]; @@ -103,8 +103,8 @@ void ModulatorState::update(const ALCcontext *context, const ALeffectslot *slot, { const ALCdevice *device{context->mDevice.get()}; - const float step{props->Modulator.Frequency / static_cast<ALfloat>(device->Frequency)}; - mStep = fastf2u(clampf(step*WAVEFORM_FRACONE, 0.0f, ALfloat{WAVEFORM_FRACONE-1})); + const float step{props->Modulator.Frequency / static_cast<float>(device->Frequency)}; + mStep = fastf2u(clampf(step*WAVEFORM_FRACONE, 0.0f, float{WAVEFORM_FRACONE-1})); if(mStep == 0) mGetSamples = Modulate<One>; @@ -115,7 +115,7 @@ void ModulatorState::update(const ALCcontext *context, const ALeffectslot *slot, else /*if(props->Modulator.Waveform == AL_RING_MODULATOR_SQUARE)*/ mGetSamples = Modulate<Square>; - float f0norm{props->Modulator.HighPassCutoff / static_cast<ALfloat>(device->Frequency)}; + float f0norm{props->Modulator.HighPassCutoff / static_cast<float>(device->Frequency)}; f0norm = clampf(f0norm, 1.0f/512.0f, 0.49f); /* Bandwidth value is constant in octaves. */ mChans[0].Filter.setParamsFromBandwidth(BiquadType::HighPass, f0norm, 1.0f, 0.75f); @@ -134,7 +134,7 @@ void ModulatorState::process(const size_t samplesToDo, const al::span<const Floa { for(size_t base{0u};base < samplesToDo;) { - alignas(16) ALfloat modsamples[MAX_UPDATE_SAMPLES]; + alignas(16) float modsamples[MAX_UPDATE_SAMPLES]; size_t td{minz(MAX_UPDATE_SAMPLES, samplesToDo-base)}; mGetSamples(modsamples, mIndex, mStep, td); @@ -144,7 +144,7 @@ void ModulatorState::process(const size_t samplesToDo, const al::span<const Floa auto chandata = std::addressof(mChans[0]); for(const auto &input : samplesIn) { - alignas(16) ALfloat temps[MAX_UPDATE_SAMPLES]; + alignas(16) float temps[MAX_UPDATE_SAMPLES]; chandata->Filter.process({&input[base], td}, temps); for(size_t i{0u};i < td;i++) @@ -160,7 +160,7 @@ void ModulatorState::process(const size_t samplesToDo, const al::span<const Floa } -void Modulator_setParamf(EffectProps *props, ALCcontext *context, ALenum param, ALfloat val) +void Modulator_setParamf(EffectProps *props, ALCcontext *context, ALenum param, float val) { switch(param) { @@ -180,15 +180,15 @@ void Modulator_setParamf(EffectProps *props, ALCcontext *context, ALenum param, context->setError(AL_INVALID_ENUM, "Invalid modulator float property 0x%04x", param); } } -void Modulator_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +void Modulator_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const float *vals) { Modulator_setParamf(props, context, param, vals[0]); } -void Modulator_setParami(EffectProps *props, ALCcontext *context, ALenum param, ALint val) +void Modulator_setParami(EffectProps *props, ALCcontext *context, ALenum param, int val) { switch(param) { case AL_RING_MODULATOR_FREQUENCY: case AL_RING_MODULATOR_HIGHPASS_CUTOFF: - Modulator_setParamf(props, context, param, static_cast<ALfloat>(val)); + Modulator_setParamf(props, context, param, static_cast<float>(val)); break; case AL_RING_MODULATOR_WAVEFORM: @@ -201,18 +201,18 @@ void Modulator_setParami(EffectProps *props, ALCcontext *context, ALenum param, context->setError(AL_INVALID_ENUM, "Invalid modulator integer property 0x%04x", param); } } -void Modulator_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +void Modulator_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const int *vals) { Modulator_setParami(props, context, param, vals[0]); } -void Modulator_getParami(const EffectProps *props, ALCcontext *context, ALenum param, ALint *val) +void Modulator_getParami(const EffectProps *props, ALCcontext *context, ALenum param, int *val) { switch(param) { case AL_RING_MODULATOR_FREQUENCY: - *val = static_cast<ALint>(props->Modulator.Frequency); + *val = static_cast<int>(props->Modulator.Frequency); break; case AL_RING_MODULATOR_HIGHPASS_CUTOFF: - *val = static_cast<ALint>(props->Modulator.HighPassCutoff); + *val = static_cast<int>(props->Modulator.HighPassCutoff); break; case AL_RING_MODULATOR_WAVEFORM: *val = props->Modulator.Waveform; @@ -222,9 +222,9 @@ void Modulator_getParami(const EffectProps *props, ALCcontext *context, ALenum p context->setError(AL_INVALID_ENUM, "Invalid modulator integer property 0x%04x", param); } } -void Modulator_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +void Modulator_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, int *vals) { Modulator_getParami(props, context, param, vals); } -void Modulator_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) +void Modulator_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, float *val) { switch(param) { @@ -239,7 +239,7 @@ void Modulator_getParamf(const EffectProps *props, ALCcontext *context, ALenum p context->setError(AL_INVALID_ENUM, "Invalid modulator float property 0x%04x", param); } } -void Modulator_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +void Modulator_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, float *vals) { Modulator_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Modulator); diff --git a/alc/effects/null.cpp b/alc/effects/null.cpp index 306b9365..b9429745 100644 --- a/alc/effects/null.cpp +++ b/alc/effects/null.cpp @@ -64,7 +64,7 @@ void NullState::process(const size_t/*samplesToDo*/, } -void NullEffect_setParami(EffectProps* /*props*/, ALCcontext *context, ALenum param, ALint /*val*/) +void NullEffect_setParami(EffectProps* /*props*/, ALCcontext *context, ALenum param, int /*val*/) { switch(param) { @@ -72,7 +72,7 @@ void NullEffect_setParami(EffectProps* /*props*/, ALCcontext *context, ALenum pa context->setError(AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x", param); } } -void NullEffect_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +void NullEffect_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const int *vals) { switch(param) { @@ -80,7 +80,7 @@ void NullEffect_setParamiv(EffectProps *props, ALCcontext *context, ALenum param NullEffect_setParami(props, context, param, vals[0]); } } -void NullEffect_setParamf(EffectProps* /*props*/, ALCcontext *context, ALenum param, ALfloat /*val*/) +void NullEffect_setParamf(EffectProps* /*props*/, ALCcontext *context, ALenum param, float /*val*/) { switch(param) { @@ -88,7 +88,7 @@ void NullEffect_setParamf(EffectProps* /*props*/, ALCcontext *context, ALenum pa context->setError(AL_INVALID_ENUM, "Invalid null effect float property 0x%04x", param); } } -void NullEffect_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +void NullEffect_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const float *vals) { switch(param) { @@ -97,7 +97,7 @@ void NullEffect_setParamfv(EffectProps *props, ALCcontext *context, ALenum param } } -void NullEffect_getParami(const EffectProps* /*props*/, ALCcontext *context, ALenum param, ALint* /*val*/) +void NullEffect_getParami(const EffectProps* /*props*/, ALCcontext *context, ALenum param, int* /*val*/) { switch(param) { @@ -105,7 +105,7 @@ void NullEffect_getParami(const EffectProps* /*props*/, ALCcontext *context, ALe context->setError(AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x", param); } } -void NullEffect_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +void NullEffect_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, int *vals) { switch(param) { @@ -113,7 +113,7 @@ void NullEffect_getParamiv(const EffectProps *props, ALCcontext *context, ALenum NullEffect_getParami(props, context, param, vals); } } -void NullEffect_getParamf(const EffectProps* /*props*/, ALCcontext *context, ALenum param, ALfloat* /*val*/) +void NullEffect_getParamf(const EffectProps* /*props*/, ALCcontext *context, ALenum param, float* /*val*/) { switch(param) { @@ -121,7 +121,7 @@ void NullEffect_getParamf(const EffectProps* /*props*/, ALCcontext *context, ALe context->setError(AL_INVALID_ENUM, "Invalid null effect float property 0x%04x", param); } } -void NullEffect_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +void NullEffect_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, float *vals) { switch(param) { diff --git a/alc/effects/pshifter.cpp b/alc/effects/pshifter.cpp index f433ec46..1c9c473c 100644 --- a/alc/effects/pshifter.cpp +++ b/alc/effects/pshifter.cpp @@ -132,7 +132,7 @@ void PshifterState::update(const ALCcontext*, const ALeffectslot *slot, const Ef mPitchShiftI = fastf2u(pitch*FRACTIONONE); mPitchShift = mPitchShiftI * double{1.0/FRACTIONONE}; - ALfloat coeffs[MAX_AMBI_CHANNELS]; + float coeffs[MAX_AMBI_CHANNELS]; CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}, 0.0f, coeffs); mOutTarget = target.Main->Buffer; @@ -253,12 +253,12 @@ void PshifterState::process(const size_t samplesToDo, const al::span<const Float } -void Pshifter_setParamf(EffectProps*, ALCcontext *context, ALenum param, ALfloat) +void Pshifter_setParamf(EffectProps*, ALCcontext *context, ALenum param, float) { context->setError(AL_INVALID_ENUM, "Invalid pitch shifter float property 0x%04x", param); } -void Pshifter_setParamfv(EffectProps*, ALCcontext *context, ALenum param, const ALfloat*) +void Pshifter_setParamfv(EffectProps*, ALCcontext *context, ALenum param, const float*) { context->setError(AL_INVALID_ENUM, "Invalid pitch shifter float-vector property 0x%04x", param); } -void Pshifter_setParami(EffectProps *props, ALCcontext *context, ALenum param, ALint val) +void Pshifter_setParami(EffectProps *props, ALCcontext *context, ALenum param, int val) { switch(param) { @@ -279,10 +279,10 @@ void Pshifter_setParami(EffectProps *props, ALCcontext *context, ALenum param, A param); } } -void Pshifter_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +void Pshifter_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const int *vals) { Pshifter_setParami(props, context, param, vals[0]); } -void Pshifter_getParami(const EffectProps *props, ALCcontext *context, ALenum param, ALint *val) +void Pshifter_getParami(const EffectProps *props, ALCcontext *context, ALenum param, int *val) { switch(param) { @@ -298,12 +298,12 @@ void Pshifter_getParami(const EffectProps *props, ALCcontext *context, ALenum pa param); } } -void Pshifter_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +void Pshifter_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, int *vals) { Pshifter_getParami(props, context, param, vals); } -void Pshifter_getParamf(const EffectProps*, ALCcontext *context, ALenum param, ALfloat*) +void Pshifter_getParamf(const EffectProps*, ALCcontext *context, ALenum param, float*) { context->setError(AL_INVALID_ENUM, "Invalid pitch shifter float property 0x%04x", param); } -void Pshifter_getParamfv(const EffectProps*, ALCcontext *context, ALenum param, ALfloat*) +void Pshifter_getParamfv(const EffectProps*, ALCcontext *context, ALenum param, float*) { context->setError(AL_INVALID_ENUM, "Invalid pitch shifter float vector-property 0x%04x", param); } DEFINE_ALEFFECT_VTABLE(Pshifter); diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index ae092b55..c97818f2 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -42,7 +42,7 @@ /* This is a user config option for modifying the overall output of the reverb * effect. */ -ALfloat ReverbBoost = 1.0f; +float ReverbBoost = 1.0f; namespace { @@ -82,7 +82,7 @@ constexpr float MODULATION_DEPTH_COEFF{0.05f}; * tetrahedron, but it's close enough. Should the model be extended to 8-lines * in the future, true opposites can be used. */ -alignas(16) constexpr ALfloat B2A[NUM_LINES][MAX_AMBI_CHANNELS]{ +alignas(16) constexpr float B2A[NUM_LINES][MAX_AMBI_CHANNELS]{ { 0.288675134595f, 0.288675134595f, 0.288675134595f, 0.288675134595f }, { 0.288675134595f, -0.288675134595f, -0.288675134595f, 0.288675134595f }, { 0.288675134595f, 0.288675134595f, -0.288675134595f, -0.288675134595f }, @@ -90,7 +90,7 @@ alignas(16) constexpr ALfloat B2A[NUM_LINES][MAX_AMBI_CHANNELS]{ }; /* Converts A-Format to B-Format. */ -alignas(16) constexpr ALfloat A2B[NUM_LINES][NUM_LINES]{ +alignas(16) constexpr float A2B[NUM_LINES][NUM_LINES]{ { 0.866025403785f, 0.866025403785f, 0.866025403785f, 0.866025403785f }, { 0.866025403785f, -0.866025403785f, 0.866025403785f, -0.866025403785f }, { 0.866025403785f, -0.866025403785f, -0.866025403785f, 0.866025403785f }, @@ -113,7 +113,7 @@ alignas(16) constexpr ALfloat A2B[NUM_LINES][NUM_LINES]{ * The density scale below will result in a max line multiplier of 50, for an * effective size range of 5m to 50m. */ -constexpr ALfloat DENSITY_SCALE{125000.0f}; +constexpr float DENSITY_SCALE{125000.0f}; /* All delay line lengths are specified in seconds. * @@ -159,7 +159,7 @@ constexpr ALfloat DENSITY_SCALE{125000.0f}; * * Assuming an average of 1m, we get the following taps: */ -constexpr std::array<ALfloat,NUM_LINES> EARLY_TAP_LENGTHS{{ +constexpr std::array<float,NUM_LINES> EARLY_TAP_LENGTHS{{ 0.0000000e+0f, 2.0213520e-4f, 4.2531060e-4f, 6.7171600e-4f }}; @@ -169,7 +169,7 @@ constexpr std::array<ALfloat,NUM_LINES> EARLY_TAP_LENGTHS{{ * * Where a is the approximate maximum all-pass cycle limit (20). */ -constexpr std::array<ALfloat,NUM_LINES> EARLY_ALLPASS_LENGTHS{{ +constexpr std::array<float,NUM_LINES> EARLY_ALLPASS_LENGTHS{{ 9.7096800e-5f, 1.0720356e-4f, 1.1836234e-4f, 1.3068260e-4f }}; @@ -195,7 +195,7 @@ constexpr std::array<ALfloat,NUM_LINES> EARLY_ALLPASS_LENGTHS{{ * * Using an average dimension of 1m, we get: */ -constexpr std::array<ALfloat,NUM_LINES> EARLY_LINE_LENGTHS{{ +constexpr std::array<float,NUM_LINES> EARLY_LINE_LENGTHS{{ 5.9850400e-4f, 1.0913150e-3f, 1.5376658e-3f, 1.9419362e-3f }}; @@ -203,7 +203,7 @@ constexpr std::array<ALfloat,NUM_LINES> EARLY_LINE_LENGTHS{{ * * A_i = (5 / 3) L_i / r_1 */ -constexpr std::array<ALfloat,NUM_LINES> LATE_ALLPASS_LENGTHS{{ +constexpr std::array<float,NUM_LINES> LATE_ALLPASS_LENGTHS{{ 1.6182800e-4f, 2.0389060e-4f, 2.8159360e-4f, 3.2365600e-4f }}; @@ -222,7 +222,7 @@ constexpr std::array<ALfloat,NUM_LINES> LATE_ALLPASS_LENGTHS{{ * * For our 1m average room, we get: */ -constexpr std::array<ALfloat,NUM_LINES> LATE_LINE_LENGTHS{{ +constexpr std::array<float,NUM_LINES> LATE_LINE_LENGTHS{{ 1.9419362e-3f, 2.4466860e-3f, 3.3791220e-3f, 3.8838720e-3f }}; @@ -246,7 +246,7 @@ struct DelayLineI { { Line = sampleBuffer + LineOffset; } /* Calculate the length of a delay line and store its mask and offset. */ - ALuint calcLineLength(const ALfloat length, const uintptr_t offset, const ALfloat frequency, + ALuint calcLineLength(const float length, const uintptr_t offset, const float frequency, const ALuint extra) { /* All line lengths are powers of 2, calculated from their lengths in @@ -263,7 +263,7 @@ struct DelayLineI { return samples; } - void write(size_t offset, const size_t c, const ALfloat *RESTRICT in, const size_t count) const noexcept + void write(size_t offset, const size_t c, const float *RESTRICT in, const size_t count) const noexcept { ASSUME(count > 0); for(size_t i{0u};i < count;) @@ -279,25 +279,25 @@ struct DelayLineI { struct VecAllpass { DelayLineI Delay; - ALfloat Coeff{0.0f}; - size_t Offset[NUM_LINES][2]{}; + float Coeff{0.0f}; + size_t Offset[NUM_LINES][2]{}; void processFaded(const al::span<ReverbUpdateLine,NUM_LINES> samples, size_t offset, - const ALfloat xCoeff, const ALfloat yCoeff, ALfloat fadeCount, const ALfloat fadeStep, + const float xCoeff, const float yCoeff, float fadeCount, const float fadeStep, const size_t todo); void processUnfaded(const al::span<ReverbUpdateLine,NUM_LINES> samples, size_t offset, - const ALfloat xCoeff, const ALfloat yCoeff, const size_t todo); + const float xCoeff, const float yCoeff, const size_t todo); }; struct T60Filter { /* Two filters are used to adjust the signal. One to control the low * frequencies, and one to control the high frequencies. */ - ALfloat MidGain[2]{0.0f, 0.0f}; + float MidGain[2]{0.0f, 0.0f}; BiquadFilter HFFilter, LFFilter; - void calcCoeffs(const ALfloat length, const ALfloat lfDecayTime, const ALfloat mfDecayTime, - const ALfloat hfDecayTime, const ALfloat lf0norm, const ALfloat hf0norm); + void calcCoeffs(const float length, const float lfDecayTime, const float mfDecayTime, + const float hfDecayTime, const float lf0norm, const float hf0norm); /* Applies the two T60 damping filter sections. */ void process(const al::span<float> samples) @@ -317,15 +317,15 @@ struct EarlyReflections { * reflections. */ DelayLineI Delay; - size_t Offset[NUM_LINES][2]{}; - ALfloat Coeff[NUM_LINES][2]{}; + size_t Offset[NUM_LINES][2]{}; + float Coeff[NUM_LINES][2]{}; /* The gain for each output channel based on 3D panning. */ - ALfloat CurrentGain[NUM_LINES][MAX_OUTPUT_CHANNELS]{}; - ALfloat PanGain[NUM_LINES][MAX_OUTPUT_CHANNELS]{}; + float CurrentGain[NUM_LINES][MAX_OUTPUT_CHANNELS]{}; + float PanGain[NUM_LINES][MAX_OUTPUT_CHANNELS]{}; - void updateLines(const ALfloat density, const ALfloat diffusion, const ALfloat decayTime, - const ALfloat frequency); + void updateLines(const float density, const float diffusion, const float decayTime, + const float frequency); }; @@ -354,7 +354,7 @@ struct LateReverb { /* Attenuation to compensate for the modal density and decay rate of the * late lines. */ - ALfloat DensityGain[2]{0.0f, 0.0f}; + float DensityGain[2]{0.0f, 0.0f}; /* T60 decay filters are used to simulate absorption. */ T60Filter T60[NUM_LINES]; @@ -365,12 +365,12 @@ struct LateReverb { VecAllpass VecAp; /* The gain for each output channel based on 3D panning. */ - ALfloat CurrentGain[NUM_LINES][MAX_OUTPUT_CHANNELS]{}; - ALfloat PanGain[NUM_LINES][MAX_OUTPUT_CHANNELS]{}; + float CurrentGain[NUM_LINES][MAX_OUTPUT_CHANNELS]{}; + float PanGain[NUM_LINES][MAX_OUTPUT_CHANNELS]{}; - void updateLines(const ALfloat density, const ALfloat diffusion, const ALfloat lfDecayTime, - const ALfloat mfDecayTime, const ALfloat hfDecayTime, const ALfloat lf0norm, - const ALfloat hf0norm, const ALfloat frequency); + void updateLines(const float density, const float diffusion, const float lfDecayTime, + const float mfDecayTime, const float hfDecayTime, const float lf0norm, + const float hf0norm, const float frequency); }; struct ReverbState final : public EffectState { @@ -404,16 +404,16 @@ struct ReverbState final : public EffectState { DelayLineI mDelay; /* Tap points for early reflection delay. */ - size_t mEarlyDelayTap[NUM_LINES][2]{}; - ALfloat mEarlyDelayCoeff[NUM_LINES][2]{}; + size_t mEarlyDelayTap[NUM_LINES][2]{}; + float mEarlyDelayCoeff[NUM_LINES][2]{}; /* Tap points for late reverb feed and delay. */ size_t mLateFeedTap{}; size_t mLateDelayTap[NUM_LINES][2]{}; /* Coefficients for the all-pass and line scattering matrices. */ - ALfloat mMixX{0.0f}; - ALfloat mMixY{0.0f}; + float mMixX{0.0f}; + float mMixY{0.0f}; EarlyReflections mEarly; @@ -439,7 +439,7 @@ struct ReverbState final : public EffectState { const size_t counter, const size_t offset, const size_t todo); MixOutT mMixOut{&ReverbState::MixOutPlain}; - std::array<ALfloat,MAX_AMBI_ORDER+1> mOrderScales{}; + std::array<float,MAX_AMBI_ORDER+1> mOrderScales{}; std::array<std::array<BandSplitter,NUM_LINES>,2> mAmbiSplitter; @@ -483,7 +483,7 @@ struct ReverbState final : public EffectState { /* Apply scaling to the B-Format's HF response to "upsample" it to * higher-order output. */ - const ALfloat hfscale{(c==0) ? mOrderScales[0] : mOrderScales[1]}; + const float hfscale{(c==0) ? mOrderScales[0] : mOrderScales[1]}; mAmbiSplitter[0][c].applyHfScale(tmpspan, hfscale); MixSamples(tmpspan, samplesOut, mEarly.CurrentGain[c], mEarly.PanGain[c], counter, @@ -495,7 +495,7 @@ struct ReverbState final : public EffectState { MixRowSamples(tmpspan, {A2B[c], NUM_LINES}, mLateSamples[0].data(), mLateSamples[0].size()); - const ALfloat hfscale{(c==0) ? mOrderScales[0] : mOrderScales[1]}; + const float hfscale{(c==0) ? mOrderScales[0] : mOrderScales[1]}; mAmbiSplitter[1][c].applyHfScale(tmpspan, hfscale); MixSamples(tmpspan, samplesOut, mLate.CurrentGain[c], mLate.PanGain[c], counter, @@ -503,20 +503,20 @@ struct ReverbState final : public EffectState { } } - bool allocLines(const ALfloat frequency); + bool allocLines(const float frequency); - void updateDelayLine(const ALfloat earlyDelay, const ALfloat lateDelay, const ALfloat density, - const ALfloat decayTime, const ALfloat frequency); - void update3DPanning(const ALfloat *ReflectionsPan, const ALfloat *LateReverbPan, - const ALfloat earlyGain, const ALfloat lateGain, const EffectTarget &target); + void updateDelayLine(const float earlyDelay, const float lateDelay, const float density, + const float decayTime, const float frequency); + void update3DPanning(const float *ReflectionsPan, const float *LateReverbPan, + const float earlyGain, const float lateGain, const EffectTarget &target); void earlyUnfaded(const size_t offset, const size_t todo); - void earlyFaded(const size_t offset, const size_t todo, const ALfloat fade, - const ALfloat fadeStep); + void earlyFaded(const size_t offset, const size_t todo, const float fade, + const float fadeStep); void lateUnfaded(const size_t offset, const size_t todo); - void lateFaded(const size_t offset, const size_t todo, const ALfloat fade, - const ALfloat fadeStep); + void lateFaded(const size_t offset, const size_t todo, const float fade, + const float fadeStep); bool deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; @@ -529,14 +529,14 @@ struct ReverbState final : public EffectState { * Device Update * **************************************/ -inline ALfloat CalcDelayLengthMult(ALfloat density) +inline float CalcDelayLengthMult(float density) { return maxf(5.0f, std::cbrt(density*DENSITY_SCALE)); } /* Calculates the delay line metrics and allocates the shared sample buffer * for all lines given the sample rate (frequency). If an allocation failure * occurs, it returns AL_FALSE. */ -bool ReverbState::allocLines(const ALfloat frequency) +bool ReverbState::allocLines(const float frequency) { /* All delay line lengths are calculated to accomodate the full range of * lengths given their respective paramters. @@ -546,14 +546,14 @@ bool ReverbState::allocLines(const ALfloat frequency) /* Multiplier for the maximum density value, i.e. density=1, which is * actually the least density... */ - ALfloat multiplier{CalcDelayLengthMult(AL_EAXREVERB_MAX_DENSITY)}; + float multiplier{CalcDelayLengthMult(AL_EAXREVERB_MAX_DENSITY)}; /* The main delay length includes the maximum early reflection delay, the * largest early tap width, the maximum late reverb delay, and the * largest late tap width. Finally, it must also be extended by the * update size (BUFFERSIZE) for block processing. */ - ALfloat length{AL_EAXREVERB_MAX_REFLECTIONS_DELAY + EARLY_TAP_LENGTHS.back()*multiplier + + float length{AL_EAXREVERB_MAX_REFLECTIONS_DELAY + EARLY_TAP_LENGTHS.back()*multiplier + AL_EAXREVERB_MAX_LATE_REVERB_DELAY + (LATE_LINE_LENGTHS.back() - LATE_LINE_LENGTHS.front())/float{NUM_LINES}*multiplier}; totalSamples += mDelay.calcLineLength(length, totalSamples, frequency, BUFFERSIZE); @@ -601,13 +601,13 @@ bool ReverbState::allocLines(const ALfloat frequency) bool ReverbState::deviceUpdate(const ALCdevice *device) { - const auto frequency = static_cast<ALfloat>(device->Frequency); + const auto frequency = static_cast<float>(device->Frequency); /* Allocate the delay lines. */ if(!allocLines(frequency)) return false; - const ALfloat multiplier{CalcDelayLengthMult(AL_EAXREVERB_MAX_DENSITY)}; + const float multiplier{CalcDelayLengthMult(AL_EAXREVERB_MAX_DENSITY)}; /* The late feed taps are set a fixed position past the latest delay tap. */ mLateFeedTap = float2uint( @@ -679,19 +679,19 @@ bool ReverbState::deviceUpdate(const ALCdevice *device) /* Calculate a decay coefficient given the length of each cycle and the time * until the decay reaches -60 dB. */ -inline ALfloat CalcDecayCoeff(const ALfloat length, const ALfloat decayTime) +inline float CalcDecayCoeff(const float length, const float decayTime) { return std::pow(REVERB_DECAY_GAIN, length/decayTime); } /* Calculate a decay length from a coefficient and the time until the decay * reaches -60 dB. */ -inline ALfloat CalcDecayLength(const ALfloat coeff, const ALfloat decayTime) +inline float CalcDecayLength(const float coeff, const float decayTime) { return std::log10(coeff) * decayTime / std::log10(REVERB_DECAY_GAIN); } /* Calculate an attenuation to be applied to the input of any echo models to * compensate for modal density and decay time. */ -inline ALfloat CalcDensityGain(const ALfloat a) +inline float CalcDensityGain(const float a) { /* The energy of a signal can be obtained by finding the area under the * squared signal. This takes the form of Sum(x_n^2), where x is the @@ -710,11 +710,11 @@ inline ALfloat CalcDensityGain(const ALfloat a) } /* Calculate the scattering matrix coefficients given a diffusion factor. */ -inline ALvoid CalcMatrixCoeffs(const ALfloat diffusion, ALfloat *x, ALfloat *y) +inline ALvoid CalcMatrixCoeffs(const float diffusion, float *x, float *y) { /* The matrix is of order 4, so n is sqrt(4 - 1). */ - ALfloat n{std::sqrt(3.0f)}; - ALfloat t{diffusion * std::atan(n)}; + float n{std::sqrt(3.0f)}; + float t{diffusion * std::atan(n)}; /* Calculate the first mixing matrix coefficient. */ *x = std::cos(t); @@ -725,16 +725,16 @@ inline ALvoid CalcMatrixCoeffs(const ALfloat diffusion, ALfloat *x, ALfloat *y) /* Calculate the limited HF ratio for use with the late reverb low-pass * filters. */ -ALfloat CalcLimitedHfRatio(const ALfloat hfRatio, const ALfloat airAbsorptionGainHF, - const ALfloat decayTime) +float CalcLimitedHfRatio(const float hfRatio, const float airAbsorptionGainHF, + const float decayTime) { /* Find the attenuation due to air absorption in dB (converting delay * time to meters using the speed of sound). Then reversing the decay * equation, solve for HF ratio. The delay length is cancelled out of * the equation, so it can be calculated once for all lines. */ - ALfloat limitRatio{1.0f / - (CalcDecayLength(airAbsorptionGainHF, decayTime) * SPEEDOFSOUNDMETRESPERSEC)}; + float limitRatio{1.0f / CalcDecayLength(airAbsorptionGainHF, decayTime) / + SPEEDOFSOUNDMETRESPERSEC}; /* Using the limit calculated above, apply the upper bound to the HF ratio. */ @@ -746,9 +746,9 @@ ALfloat CalcLimitedHfRatio(const ALfloat hfRatio, const ALfloat airAbsorptionGai * of specified length, using a combination of two shelf filter sections given * decay times for each band split at two reference frequencies. */ -void T60Filter::calcCoeffs(const ALfloat length, const ALfloat lfDecayTime, - const ALfloat mfDecayTime, const ALfloat hfDecayTime, const ALfloat lf0norm, - const ALfloat hf0norm) +void T60Filter::calcCoeffs(const float length, const float lfDecayTime, + const float mfDecayTime, const float hfDecayTime, const float lf0norm, + const float hf0norm) { const float mfGain{CalcDecayCoeff(length, mfDecayTime)}; const float lfGain{CalcDecayCoeff(length, lfDecayTime) / mfGain}; @@ -760,10 +760,10 @@ void T60Filter::calcCoeffs(const ALfloat length, const ALfloat lfDecayTime, } /* Update the early reflection line lengths and gain coefficients. */ -void EarlyReflections::updateLines(const ALfloat density, const ALfloat diffusion, - const ALfloat decayTime, const ALfloat frequency) +void EarlyReflections::updateLines(const float density, const float diffusion, + const float decayTime, const float frequency) { - const ALfloat multiplier{CalcDelayLengthMult(density)}; + const float multiplier{CalcDelayLengthMult(density)}; /* Calculate the all-pass feed-back/forward coefficient. */ VecAp.Coeff = std::sqrt(0.5f) * std::pow(diffusion, 2.0f); @@ -771,7 +771,7 @@ void EarlyReflections::updateLines(const ALfloat density, const ALfloat diffusio for(size_t i{0u};i < NUM_LINES;i++) { /* Calculate the length (in seconds) of each all-pass line. */ - ALfloat length{EARLY_ALLPASS_LENGTHS[i] * multiplier}; + float length{EARLY_ALLPASS_LENGTHS[i] * multiplier}; /* Calculate the delay offset for each all-pass line. */ VecAp.Offset[i][1] = float2uint(length * frequency); @@ -821,16 +821,16 @@ void Modulation::updateModulator(float modTime, float modDepth, float frequency) } /* Update the late reverb line lengths and T60 coefficients. */ -void LateReverb::updateLines(const ALfloat density, const ALfloat diffusion, - const ALfloat lfDecayTime, const ALfloat mfDecayTime, const ALfloat hfDecayTime, - const ALfloat lf0norm, const ALfloat hf0norm, const ALfloat frequency) +void LateReverb::updateLines(const float density, const float diffusion, + const float lfDecayTime, const float mfDecayTime, const float hfDecayTime, + const float lf0norm, const float hf0norm, const float frequency) { /* Scaling factor to convert the normalized reference frequencies from * representing 0...freq to 0...max_reference. */ - const ALfloat norm_weight_factor{frequency / AL_EAXREVERB_MAX_HFREFERENCE}; + const float norm_weight_factor{frequency / AL_EAXREVERB_MAX_HFREFERENCE}; - const ALfloat late_allpass_avg{ + const float late_allpass_avg{ std::accumulate(LATE_ALLPASS_LENGTHS.begin(), LATE_ALLPASS_LENGTHS.end(), 0.0f) / float{NUM_LINES}}; @@ -842,15 +842,15 @@ void LateReverb::updateLines(const ALfloat density, const ALfloat diffusion, * The average length of the delay lines is used to calculate the * attenuation coefficient. */ - const ALfloat multiplier{CalcDelayLengthMult(density)}; - ALfloat length{std::accumulate(LATE_LINE_LENGTHS.begin(), LATE_LINE_LENGTHS.end(), 0.0f) / + const float multiplier{CalcDelayLengthMult(density)}; + float length{std::accumulate(LATE_LINE_LENGTHS.begin(), LATE_LINE_LENGTHS.end(), 0.0f) / float{NUM_LINES} * multiplier}; length += late_allpass_avg * multiplier; /* The density gain calculation uses an average decay time weighted by * approximate bandwidth. This attempts to compensate for losses of energy * that reduce decay time due to scattering into highly attenuated bands. */ - const ALfloat decayTimeWeighted{ + const float decayTimeWeighted{ (lf0norm*norm_weight_factor)*lfDecayTime + (hf0norm*norm_weight_factor - lf0norm*norm_weight_factor)*mfDecayTime + (1.0f - hf0norm*norm_weight_factor)*hfDecayTime}; @@ -888,10 +888,10 @@ void LateReverb::updateLines(const ALfloat density, const ALfloat diffusion, /* Update the offsets for the main effect delay line. */ -void ReverbState::updateDelayLine(const ALfloat earlyDelay, const ALfloat lateDelay, - const ALfloat density, const ALfloat decayTime, const ALfloat frequency) +void ReverbState::updateDelayLine(const float earlyDelay, const float lateDelay, + const float density, const float decayTime, const float frequency) { - const ALfloat multiplier{CalcDelayLengthMult(density)}; + const float multiplier{CalcDelayLengthMult(density)}; /* Early reflection taps are decorrelated by means of an average room * reflection approximation described above the definition of the taps. @@ -905,7 +905,7 @@ void ReverbState::updateDelayLine(const ALfloat earlyDelay, const ALfloat lateDe */ for(size_t i{0u};i < NUM_LINES;i++) { - ALfloat length{earlyDelay + EARLY_TAP_LENGTHS[i]*multiplier}; + float length{earlyDelay + EARLY_TAP_LENGTHS[i]*multiplier}; mEarlyDelayTap[i][1] = float2uint(length * frequency); length = EARLY_TAP_LENGTHS[i]*multiplier; @@ -922,7 +922,7 @@ void ReverbState::updateDelayLine(const ALfloat earlyDelay, const ALfloat lateDe * focal strength. This function results in a B-Format transformation matrix * that spatially focuses the signal in the desired direction. */ -alu::Matrix GetTransformFromVector(const ALfloat *vec) +alu::Matrix GetTransformFromVector(const float *vec) { constexpr float sqrt_3{1.73205080756887719318f}; @@ -933,8 +933,8 @@ alu::Matrix GetTransformFromVector(const ALfloat *vec) * rest of OpenAL which use right-handed. This is fixed by negating Z, * which cancels out with the B-Format Z negation. */ - ALfloat norm[3]; - ALfloat mag{std::sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2])}; + float norm[3]; + float mag{std::sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2])}; if(mag > 1.0f) { norm[0] = vec[0] / mag * -sqrt_3; @@ -962,8 +962,8 @@ alu::Matrix GetTransformFromVector(const ALfloat *vec) } /* Update the early and late 3D panning gains. */ -void ReverbState::update3DPanning(const ALfloat *ReflectionsPan, const ALfloat *LateReverbPan, - const ALfloat earlyGain, const ALfloat lateGain, const EffectTarget &target) +void ReverbState::update3DPanning(const float *ReflectionsPan, const float *LateReverbPan, + const float earlyGain, const float lateGain, const EffectTarget &target) { /* Create matrices that transform a B-Format signal according to the * panning vectors. @@ -974,13 +974,13 @@ void ReverbState::update3DPanning(const ALfloat *ReflectionsPan, const ALfloat * mOutTarget = target.Main->Buffer; for(size_t i{0u};i < NUM_LINES;i++) { - const ALfloat coeffs[MAX_AMBI_CHANNELS]{earlymat[0][i], earlymat[1][i], earlymat[2][i], + const float coeffs[MAX_AMBI_CHANNELS]{earlymat[0][i], earlymat[1][i], earlymat[2][i], earlymat[3][i]}; ComputePanGains(target.Main, coeffs, earlyGain, mEarly.PanGain[i]); } for(size_t i{0u};i < NUM_LINES;i++) { - const ALfloat coeffs[MAX_AMBI_CHANNELS]{latemat[0][i], latemat[1][i], latemat[2][i], + const float coeffs[MAX_AMBI_CHANNELS]{latemat[0][i], latemat[1][i], latemat[2][i], latemat[3][i]}; ComputePanGains(target.Main, coeffs, lateGain, mLate.PanGain[i]); } @@ -989,7 +989,7 @@ void ReverbState::update3DPanning(const ALfloat *ReflectionsPan, const ALfloat * void ReverbState::update(const ALCcontext *Context, const ALeffectslot *Slot, const EffectProps *props, const EffectTarget target) { const ALCdevice *Device{Context->mDevice.get()}; - const auto frequency = static_cast<ALfloat>(Device->Frequency); + const auto frequency = static_cast<float>(Device->Frequency); /* Calculate the master filters */ float hf0norm{minf(props->Reverb.HFReference/frequency, 0.49f)}; @@ -1016,15 +1016,15 @@ void ReverbState::update(const ALCcontext *Context, const ALeffectslot *Slot, co /* If the HF limit parameter is flagged, calculate an appropriate limit * based on the air absorption parameter. */ - ALfloat hfRatio{props->Reverb.DecayHFRatio}; + float hfRatio{props->Reverb.DecayHFRatio}; if(props->Reverb.DecayHFLimit && props->Reverb.AirAbsorptionGainHF < 1.0f) hfRatio = CalcLimitedHfRatio(hfRatio, props->Reverb.AirAbsorptionGainHF, props->Reverb.DecayTime); /* Calculate the LF/HF decay times. */ - const ALfloat lfDecayTime{clampf(props->Reverb.DecayTime * props->Reverb.DecayLFRatio, + const float lfDecayTime{clampf(props->Reverb.DecayTime * props->Reverb.DecayLFRatio, AL_EAXREVERB_MIN_DECAY_TIME, AL_EAXREVERB_MAX_DECAY_TIME)}; - const ALfloat hfDecayTime{clampf(props->Reverb.DecayTime * hfRatio, + const float hfDecayTime{clampf(props->Reverb.DecayTime * hfRatio, AL_EAXREVERB_MIN_DECAY_TIME, AL_EAXREVERB_MAX_DECAY_TIME)}; /* Update the modulator rate and depth. */ @@ -1036,7 +1036,7 @@ void ReverbState::update(const ALCcontext *Context, const ALeffectslot *Slot, co props->Reverb.DecayTime, hfDecayTime, lf0norm, hf0norm, frequency); /* Update early and late 3D panning. */ - const ALfloat gain{props->Reverb.Gain * Slot->Params.Gain * ReverbBoost}; + const float gain{props->Reverb.Gain * Slot->Params.Gain * ReverbBoost}; update3DPanning(props->Reverb.ReflectionsPan, props->Reverb.LateReverbPan, props->Reverb.ReflectionsGain*gain, props->Reverb.LateReverbGain*gain, target); @@ -1121,7 +1121,7 @@ void ReverbState::update(const ALCcontext *Context, const ALeffectslot *Slot, co * whose combination of signs are being iterated. */ inline auto VectorPartialScatter(const std::array<float,NUM_LINES> &RESTRICT in, - const ALfloat xCoeff, const ALfloat yCoeff) -> std::array<float,NUM_LINES> + const float xCoeff, const float yCoeff) -> std::array<float,NUM_LINES> { std::array<float,NUM_LINES> out; out[0] = xCoeff*in[0] + yCoeff*( in[1] + -in[2] + in[3]); @@ -1132,8 +1132,8 @@ inline auto VectorPartialScatter(const std::array<float,NUM_LINES> &RESTRICT in, } /* Utilizes the above, but reverses the input channels. */ -void VectorScatterRevDelayIn(const DelayLineI delay, size_t offset, const ALfloat xCoeff, - const ALfloat yCoeff, const al::span<const ReverbUpdateLine,NUM_LINES> in, const size_t count) +void VectorScatterRevDelayIn(const DelayLineI delay, size_t offset, const float xCoeff, + const float yCoeff, const al::span<const ReverbUpdateLine,NUM_LINES> in, const size_t count) { ASSUME(count > 0); @@ -1163,10 +1163,10 @@ void VectorScatterRevDelayIn(const DelayLineI delay, size_t offset, const ALfloa * line processing and non-transitional processing. */ void VecAllpass::processUnfaded(const al::span<ReverbUpdateLine,NUM_LINES> samples, size_t offset, - const ALfloat xCoeff, const ALfloat yCoeff, const size_t todo) + const float xCoeff, const float yCoeff, const size_t todo) { const DelayLineI delay{Delay}; - const ALfloat feedCoeff{Coeff}; + const float feedCoeff{Coeff}; ASSUME(todo > 0); @@ -1188,8 +1188,8 @@ void VecAllpass::processUnfaded(const al::span<ReverbUpdateLine,NUM_LINES> sampl std::array<float,NUM_LINES> f; for(size_t j{0u};j < NUM_LINES;j++) { - const ALfloat input{samples[j][i]}; - const ALfloat out{delay.Line[vap_offset[j]++][j] - feedCoeff*input}; + const float input{samples[j][i]}; + const float out{delay.Line[vap_offset[j]++][j] - feedCoeff*input}; f[j] = input + feedCoeff*out; samples[j][i] = out; @@ -1201,11 +1201,11 @@ void VecAllpass::processUnfaded(const al::span<ReverbUpdateLine,NUM_LINES> sampl } } void VecAllpass::processFaded(const al::span<ReverbUpdateLine,NUM_LINES> samples, size_t offset, - const ALfloat xCoeff, const ALfloat yCoeff, ALfloat fadeCount, const ALfloat fadeStep, + const float xCoeff, const float yCoeff, float fadeCount, const float fadeStep, const size_t todo) { const DelayLineI delay{Delay}; - const ALfloat feedCoeff{Coeff}; + const float feedCoeff{Coeff}; ASSUME(todo > 0); @@ -1240,8 +1240,8 @@ void VecAllpass::processFaded(const al::span<ReverbUpdateLine,NUM_LINES> samples for(size_t j{0u};j < NUM_LINES;j++) { - const ALfloat input{samples[j][i]}; - const ALfloat out{f[j] - feedCoeff*input}; + const float input{samples[j][i]}; + const float out{f[j] - feedCoeff*input}; f[j] = input + feedCoeff*out; samples[j][i] = out; @@ -1276,8 +1276,8 @@ void ReverbState::earlyUnfaded(const size_t offset, const size_t todo) { const DelayLineI early_delay{mEarly.Delay}; const DelayLineI main_delay{mDelay}; - const ALfloat mixX{mMixX}; - const ALfloat mixY{mMixY}; + const float mixX{mMixX}; + const float mixY{mMixY}; ASSUME(todo > 0); @@ -1287,7 +1287,7 @@ void ReverbState::earlyUnfaded(const size_t offset, const size_t todo) for(size_t j{0u};j < NUM_LINES;j++) { size_t early_delay_tap{offset - mEarlyDelayTap[j][0]}; - const ALfloat coeff{mEarlyDelayCoeff[j][0]}; + const float coeff{mEarlyDelayCoeff[j][0]}; for(size_t i{0u};i < todo;) { early_delay_tap &= main_delay.Mask; @@ -1309,8 +1309,8 @@ void ReverbState::earlyUnfaded(const size_t offset, const size_t todo) for(size_t j{0u};j < NUM_LINES;j++) { size_t feedb_tap{offset - mEarly.Offset[j][0]}; - const ALfloat feedb_coeff{mEarly.Coeff[j][0]}; - float *out = mEarlySamples[j].data(); + const float feedb_coeff{mEarly.Coeff[j][0]}; + float *out{mEarlySamples[j].data()}; for(size_t i{0u};i < todo;) { @@ -1332,13 +1332,13 @@ void ReverbState::earlyUnfaded(const size_t offset, const size_t todo) const size_t late_feed_tap{offset - mLateFeedTap}; VectorScatterRevDelayIn(main_delay, late_feed_tap, mixX, mixY, mEarlySamples, todo); } -void ReverbState::earlyFaded(const size_t offset, const size_t todo, const ALfloat fade, - const ALfloat fadeStep) +void ReverbState::earlyFaded(const size_t offset, const size_t todo, const float fade, + const float fadeStep) { const DelayLineI early_delay{mEarly.Delay}; const DelayLineI main_delay{mDelay}; - const ALfloat mixX{mMixX}; - const ALfloat mixY{mMixY}; + const float mixX{mMixX}; + const float mixY{mMixY}; ASSUME(todo > 0); @@ -1346,10 +1346,10 @@ void ReverbState::earlyFaded(const size_t offset, const size_t todo, const ALflo { size_t early_delay_tap0{offset - mEarlyDelayTap[j][0]}; size_t early_delay_tap1{offset - mEarlyDelayTap[j][1]}; - const ALfloat oldCoeff{mEarlyDelayCoeff[j][0]}; - const ALfloat oldCoeffStep{-oldCoeff * fadeStep}; - const ALfloat newCoeffStep{mEarlyDelayCoeff[j][1] * fadeStep}; - ALfloat fadeCount{fade}; + const float oldCoeff{mEarlyDelayCoeff[j][0]}; + const float oldCoeffStep{-oldCoeff * fadeStep}; + const float newCoeffStep{mEarlyDelayCoeff[j][1] * fadeStep}; + float fadeCount{fade}; for(size_t i{0u};i < todo;) { @@ -1358,8 +1358,8 @@ void ReverbState::earlyFaded(const size_t offset, const size_t todo, const ALflo size_t td{minz(main_delay.Mask+1 - maxz(early_delay_tap0, early_delay_tap1), todo-i)}; do { fadeCount += 1.0f; - const ALfloat fade0{oldCoeff + oldCoeffStep*fadeCount}; - const ALfloat fade1{newCoeffStep*fadeCount}; + const float fade0{oldCoeff + oldCoeffStep*fadeCount}; + const float fade1{newCoeffStep*fadeCount}; mTempSamples[j][i++] = main_delay.Line[early_delay_tap0++][j]*fade0 + main_delay.Line[early_delay_tap1++][j]*fade1; @@ -1373,11 +1373,11 @@ void ReverbState::earlyFaded(const size_t offset, const size_t todo, const ALflo { size_t feedb_tap0{offset - mEarly.Offset[j][0]}; size_t feedb_tap1{offset - mEarly.Offset[j][1]}; - const ALfloat feedb_oldCoeff{mEarly.Coeff[j][0]}; - const ALfloat feedb_oldCoeffStep{-feedb_oldCoeff * fadeStep}; - const ALfloat feedb_newCoeffStep{mEarly.Coeff[j][1] * fadeStep}; - float *out = mEarlySamples[j].data(); - ALfloat fadeCount{fade}; + const float feedb_oldCoeff{mEarly.Coeff[j][0]}; + const float feedb_oldCoeffStep{-feedb_oldCoeff * fadeStep}; + const float feedb_newCoeffStep{mEarly.Coeff[j][1] * fadeStep}; + float *out{mEarlySamples[j].data()}; + float fadeCount{fade}; for(size_t i{0u};i < todo;) { @@ -1387,8 +1387,8 @@ void ReverbState::earlyFaded(const size_t offset, const size_t todo, const ALflo do { fadeCount += 1.0f; - const ALfloat fade0{feedb_oldCoeff + feedb_oldCoeffStep*fadeCount}; - const ALfloat fade1{feedb_newCoeffStep*fadeCount}; + const float fade0{feedb_oldCoeff + feedb_oldCoeffStep*fadeCount}; + const float fade1{feedb_newCoeffStep*fadeCount}; out[i] = mTempSamples[j][i] + early_delay.Line[feedb_tap0++][j]*fade0 + early_delay.Line[feedb_tap1++][j]*fade1; @@ -1455,8 +1455,8 @@ void ReverbState::lateUnfaded(const size_t offset, const size_t todo) { const DelayLineI late_delay{mLate.Delay}; const DelayLineI main_delay{mDelay}; - const ALfloat mixX{mMixX}; - const ALfloat mixY{mMixY}; + const float mixX{mMixX}; + const float mixY{mMixY}; ASSUME(todo > 0); @@ -1470,8 +1470,8 @@ void ReverbState::lateUnfaded(const size_t offset, const size_t todo) { size_t late_delay_tap{offset - mLateDelayTap[j][0]}; size_t late_feedb_tap{offset - mLate.Offset[j][0]}; - const ALfloat midGain{mLate.T60[j].MidGain[0]}; - const ALfloat densityGain{mLate.DensityGain[0] * midGain}; + const float midGain{mLate.T60[j].MidGain[0]}; + const float densityGain{mLate.DensityGain[0] * midGain}; for(size_t i{0u};i < todo;) { @@ -1514,13 +1514,13 @@ void ReverbState::lateUnfaded(const size_t offset, const size_t todo) /* Finally, scatter and bounce the results to refeed the feedback buffer. */ VectorScatterRevDelayIn(late_delay, offset, mixX, mixY, mTempSamples, todo); } -void ReverbState::lateFaded(const size_t offset, const size_t todo, const ALfloat fade, - const ALfloat fadeStep) +void ReverbState::lateFaded(const size_t offset, const size_t todo, const float fade, + const float fadeStep) { const DelayLineI late_delay{mLate.Delay}; const DelayLineI main_delay{mDelay}; - const ALfloat mixX{mMixX}; - const ALfloat mixY{mMixY}; + const float mixX{mMixX}; + const float mixY{mMixY}; ASSUME(todo > 0); @@ -1528,19 +1528,19 @@ void ReverbState::lateFaded(const size_t offset, const size_t todo, const ALfloa for(size_t j{0u};j < NUM_LINES;j++) { - const ALfloat oldMidGain{mLate.T60[j].MidGain[0]}; - const ALfloat midGain{mLate.T60[j].MidGain[1]}; - const ALfloat oldMidStep{-oldMidGain * fadeStep}; - const ALfloat midStep{midGain * fadeStep}; - const ALfloat oldDensityGain{mLate.DensityGain[0] * oldMidGain}; - const ALfloat densityGain{mLate.DensityGain[1] * midGain}; - const ALfloat oldDensityStep{-oldDensityGain * fadeStep}; - const ALfloat densityStep{densityGain * fadeStep}; + const float oldMidGain{mLate.T60[j].MidGain[0]}; + const float midGain{mLate.T60[j].MidGain[1]}; + const float oldMidStep{-oldMidGain * fadeStep}; + const float midStep{midGain * fadeStep}; + const float oldDensityGain{mLate.DensityGain[0] * oldMidGain}; + const float densityGain{mLate.DensityGain[1] * midGain}; + const float oldDensityStep{-oldDensityGain * fadeStep}; + const float densityStep{densityGain * fadeStep}; size_t late_delay_tap0{offset - mLateDelayTap[j][0]}; size_t late_delay_tap1{offset - mLateDelayTap[j][1]}; size_t late_feedb_tap0{offset - mLate.Offset[j][0]}; size_t late_feedb_tap1{offset - mLate.Offset[j][1]}; - ALfloat fadeCount{fade}; + float fadeCount{fade}; for(size_t i{0u};i < todo;) { @@ -1636,7 +1636,7 @@ void ReverbState::process(const size_t samplesToDo, const al::span<const FloatBu ASSUME(todo > 0); /* Generate cross-faded early reflections and late reverb. */ - auto fadeCount = static_cast<ALfloat>(base); + auto fadeCount = static_cast<float>(base); earlyFaded(offset, todo, fadeCount, fadeStep); lateFaded(offset, todo, fadeCount, fadeStep); @@ -1668,7 +1668,7 @@ void ReverbState::process(const size_t samplesToDo, const al::span<const FloatBu } -void EAXReverb_setParami(EffectProps *props, ALCcontext *context, ALenum param, ALint val) +void EAXReverb_setParami(EffectProps *props, ALCcontext *context, ALenum param, int val) { switch(param) { @@ -1683,9 +1683,9 @@ void EAXReverb_setParami(EffectProps *props, ALCcontext *context, ALenum param, param); } } -void EAXReverb_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +void EAXReverb_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const int *vals) { EAXReverb_setParami(props, context, param, vals[0]); } -void EAXReverb_setParamf(EffectProps *props, ALCcontext *context, ALenum param, ALfloat val) +void EAXReverb_setParamf(EffectProps *props, ALCcontext *context, ALenum param, float val) { switch(param) { @@ -1813,7 +1813,7 @@ void EAXReverb_setParamf(EffectProps *props, ALCcontext *context, ALenum param, context->setError(AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", param); } } -void EAXReverb_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +void EAXReverb_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const float *vals) { switch(param) { @@ -1838,7 +1838,7 @@ void EAXReverb_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, } } -void EAXReverb_getParami(const EffectProps *props, ALCcontext *context, ALenum param, ALint *val) +void EAXReverb_getParami(const EffectProps *props, ALCcontext *context, ALenum param, int *val) { switch(param) { @@ -1851,9 +1851,9 @@ void EAXReverb_getParami(const EffectProps *props, ALCcontext *context, ALenum p param); } } -void EAXReverb_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +void EAXReverb_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, int *vals) { EAXReverb_getParami(props, context, param, vals); } -void EAXReverb_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) +void EAXReverb_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, float *val) { switch(param) { @@ -1941,7 +1941,7 @@ void EAXReverb_getParamf(const EffectProps *props, ALCcontext *context, ALenum p context->setError(AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", param); } } -void EAXReverb_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +void EAXReverb_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, float *vals) { switch(param) { @@ -2005,7 +2005,7 @@ EffectProps ReverbStateFactory::getDefaultProps() const noexcept } -void StdReverb_setParami(EffectProps *props, ALCcontext *context, ALenum param, ALint val) +void StdReverb_setParami(EffectProps *props, ALCcontext *context, ALenum param, int val) { switch(param) { @@ -2019,9 +2019,9 @@ void StdReverb_setParami(EffectProps *props, ALCcontext *context, ALenum param, context->setError(AL_INVALID_ENUM, "Invalid reverb integer property 0x%04x", param); } } -void StdReverb_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const ALint *vals) +void StdReverb_setParamiv(EffectProps *props, ALCcontext *context, ALenum param, const int *vals) { StdReverb_setParami(props, context, param, vals[0]); } -void StdReverb_setParamf(EffectProps *props, ALCcontext *context, ALenum param, ALfloat val) +void StdReverb_setParamf(EffectProps *props, ALCcontext *context, ALenum param, float val) { switch(param) { @@ -2101,10 +2101,10 @@ void StdReverb_setParamf(EffectProps *props, ALCcontext *context, ALenum param, context->setError(AL_INVALID_ENUM, "Invalid reverb float property 0x%04x", param); } } -void StdReverb_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +void StdReverb_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const float *vals) { StdReverb_setParamf(props, context, param, vals[0]); } -void StdReverb_getParami(const EffectProps *props, ALCcontext *context, ALenum param, ALint *val) +void StdReverb_getParami(const EffectProps *props, ALCcontext *context, ALenum param, int *val) { switch(param) { @@ -2116,9 +2116,9 @@ void StdReverb_getParami(const EffectProps *props, ALCcontext *context, ALenum p context->setError(AL_INVALID_ENUM, "Invalid reverb integer property 0x%04x", param); } } -void StdReverb_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, ALint *vals) +void StdReverb_getParamiv(const EffectProps *props, ALCcontext *context, ALenum param, int *vals) { StdReverb_getParami(props, context, param, vals); } -void StdReverb_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) +void StdReverb_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, float *val) { switch(param) { @@ -2174,7 +2174,7 @@ void StdReverb_getParamf(const EffectProps *props, ALCcontext *context, ALenum p context->setError(AL_INVALID_ENUM, "Invalid reverb float property 0x%04x", param); } } -void StdReverb_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +void StdReverb_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, float *vals) { StdReverb_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(StdReverb); diff --git a/alc/effects/vmorpher.cpp b/alc/effects/vmorpher.cpp index 7628461f..5004f2b2 100644 --- a/alc/effects/vmorpher.cpp +++ b/alc/effects/vmorpher.cpp @@ -71,32 +71,32 @@ void Oscillate(float *RESTRICT dst, ALuint index, const ALuint step, size_t todo struct FormantFilter { - ALfloat mCoeff{0.0f}; - ALfloat mGain{1.0f}; - ALfloat mS1{0.0f}; - ALfloat mS2{0.0f}; + float mCoeff{0.0f}; + float mGain{1.0f}; + float mS1{0.0f}; + float mS2{0.0f}; FormantFilter() = default; - FormantFilter(ALfloat f0norm, ALfloat gain) + FormantFilter(float f0norm, float gain) : mCoeff{std::tan(al::MathDefs<float>::Pi() * f0norm)}, mGain{gain} { } - inline void process(const ALfloat *samplesIn, ALfloat *samplesOut, const size_t numInput) + inline void process(const float *samplesIn, float *samplesOut, const size_t numInput) { /* A state variable filter from a topology-preserving transform. * Based on a talk given by Ivan Cohen: https://www.youtube.com/watch?v=esjHXGPyrhg */ - const ALfloat g{mCoeff}; - const ALfloat gain{mGain}; - const ALfloat h{1.0f / (1.0f + (g/Q_FACTOR) + (g*g))}; - ALfloat s1{mS1}; - ALfloat s2{mS2}; + const float g{mCoeff}; + const float gain{mGain}; + const float h{1.0f / (1.0f + (g/Q_FACTOR) + (g*g))}; + float s1{mS1}; + float s2{mS2}; for(size_t i{0u};i < numInput;i++) { - const ALfloat H{(samplesIn[i] - (1.0f/Q_FACTOR + g)*s1 - s2)*h}; - const ALfloat B{g*H + s1}; - const ALfloat L{g*B + s2}; + const float H{(samplesIn[i] - (1.0f/Q_FACTOR + g)*s1 - s2)*h}; + const float B{g*H + s1}; + const float L{g*B + s2}; s1 = g*H + B; s2 = g*B + L; @@ -122,8 +122,8 @@ struct VmorpherState final : public EffectState { FormantFilter Formants[NUM_FILTERS][NUM_FORMANTS]; /* Effect gains for each channel */ - ALfloat CurrentGains[MAX_OUTPUT_CHANNELS]{}; - ALfloat TargetGains[MAX_OUTPUT_CHANNELS]{}; + float CurrentGains[MAX_OUTPUT_CHANNELS]{}; + float TargetGains[MAX_OUTPUT_CHANNELS]{}; } mChans[MAX_AMBI_CHANNELS]; void (*mGetSamples)(float*RESTRICT, ALuint, const ALuint, size_t){}; @@ -132,19 +132,19 @@ struct VmorpherState final : public EffectState { ALuint mStep{1}; /* Effects buffers */ - ALfloat mSampleBufferA[MAX_UPDATE_SAMPLES]{}; - ALfloat mSampleBufferB[MAX_UPDATE_SAMPLES]{}; + float mSampleBufferA[MAX_UPDATE_SAMPLES]{}; + float mSampleBufferB[MAX_UPDATE_SAMPLES]{}; bool deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; void process(const size_t samplesToDo, const al::span<const FloatBufferLine> samplesIn, const al::span<FloatBufferLine> samplesOut) override; - static std::array<FormantFilter,4> getFiltersByPhoneme(ALenum phoneme, ALfloat frequency, ALfloat pitch); + static std::array<FormantFilter,4> getFiltersByPhoneme(ALenum phoneme, float frequency, float pitch); DEF_NEWDEL(VmorpherState) }; -std::array<FormantFilter,4> VmorpherState::getFiltersByPhoneme(ALenum phoneme, ALfloat frequency, ALfloat pitch) +std::array<FormantFilter,4> VmorpherState::getFiltersByPhoneme(ALenum phoneme, float frequency, float pitch) { /* Using soprano formant set of values to * better match mid-range frequency space. @@ -210,9 +210,9 @@ bool VmorpherState::deviceUpdate(const ALCdevice* /*device*/) void VmorpherState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) { const ALCdevice *device{context->mDevice.get()}; - const ALfloat frequency{static_cast<ALfloat>(device->Frequency)}; - const ALfloat step{props->Vmorpher.Rate / frequency}; - mStep = fastf2u(clampf(step*WAVEFORM_FRACONE, 0.0f, ALfloat{WAVEFORM_FRACONE-1})); + const float frequency{static_cast<float>(device->Frequency)}; + const float step{props->Vmorpher.Rate / frequency}; + mStep = fastf2u(clampf(step*WAVEFORM_FRACONE, 0.0f, float{WAVEFORM_FRACONE-1})); if(mStep == 0) mGetSamples = Oscillate<Half>; @@ -223,9 +223,9 @@ void VmorpherState::update(const ALCcontext *context, const ALeffectslot *slot, else /*if(props->Vmorpher.Waveform == AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE)*/ mGetSamples = Oscillate<Triangle>; - const ALfloat pitchA{std::pow(2.0f, + const float pitchA{std::pow(2.0f, static_cast<float>(props->Vmorpher.PhonemeACoarseTuning) / 12.0f)}; - const ALfloat pitchB{std::pow(2.0f, + const float pitchB{std::pow(2.0f, static_cast<float>(props->Vmorpher.PhonemeBCoarseTuning) / 12.0f)}; auto vowelA = getFiltersByPhoneme(props->Vmorpher.PhonemeA, frequency, pitchA); @@ -253,7 +253,7 @@ void VmorpherState::process(const size_t samplesToDo, const al::span<const Float */ for(size_t base{0u};base < samplesToDo;) { - alignas(16) ALfloat lfo[MAX_UPDATE_SAMPLES]; + alignas(16) float lfo[MAX_UPDATE_SAMPLES]; const size_t td{minz(MAX_UPDATE_SAMPLES, samplesToDo-base)}; mGetSamples(lfo, mIndex, mStep, td); @@ -281,7 +281,7 @@ void VmorpherState::process(const size_t samplesToDo, const al::span<const Float vowelB[2].process(&input[base], mSampleBufferB, td); vowelB[3].process(&input[base], mSampleBufferB, td); - alignas(16) ALfloat blended[MAX_UPDATE_SAMPLES]; + alignas(16) float blended[MAX_UPDATE_SAMPLES]; for(size_t i{0u};i < td;i++) blended[i] = lerp(mSampleBufferA[i], mSampleBufferB[i], lfo[i]); @@ -296,7 +296,7 @@ void VmorpherState::process(const size_t samplesToDo, const al::span<const Float } -void Vmorpher_setParami(EffectProps* props, ALCcontext *context, ALenum param, ALint val) +void Vmorpher_setParami(EffectProps* props, ALCcontext *context, ALenum param, int val) { switch(param) { @@ -335,9 +335,9 @@ void Vmorpher_setParami(EffectProps* props, ALCcontext *context, ALenum param, A param); } } -void Vmorpher_setParamiv(EffectProps*, ALCcontext *context, ALenum param, const ALint*) +void Vmorpher_setParamiv(EffectProps*, ALCcontext *context, ALenum param, const int*) { context->setError(AL_INVALID_ENUM, "Invalid vocal morpher integer-vector property 0x%04x", param); } -void Vmorpher_setParamf(EffectProps *props, ALCcontext *context, ALenum param, ALfloat val) +void Vmorpher_setParamf(EffectProps *props, ALCcontext *context, ALenum param, float val) { switch(param) { @@ -352,10 +352,10 @@ void Vmorpher_setParamf(EffectProps *props, ALCcontext *context, ALenum param, A param); } } -void Vmorpher_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const ALfloat *vals) +void Vmorpher_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const float *vals) { Vmorpher_setParamf(props, context, param, vals[0]); } -void Vmorpher_getParami(const EffectProps* props, ALCcontext *context, ALenum param, ALint* val) +void Vmorpher_getParami(const EffectProps* props, ALCcontext *context, ALenum param, int* val) { switch(param) { @@ -384,9 +384,9 @@ void Vmorpher_getParami(const EffectProps* props, ALCcontext *context, ALenum pa param); } } -void Vmorpher_getParamiv(const EffectProps*, ALCcontext *context, ALenum param, ALint*) +void Vmorpher_getParamiv(const EffectProps*, ALCcontext *context, ALenum param, int*) { context->setError(AL_INVALID_ENUM, "Invalid vocal morpher integer-vector property 0x%04x", param); } -void Vmorpher_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *val) +void Vmorpher_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, float *val) { switch(param) { @@ -399,7 +399,7 @@ void Vmorpher_getParamf(const EffectProps *props, ALCcontext *context, ALenum pa param); } } -void Vmorpher_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, ALfloat *vals) +void Vmorpher_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, float *vals) { Vmorpher_getParamf(props, context, param, vals); } DEFINE_ALEFFECT_VTABLE(Vmorpher); |