diff options
Diffstat (limited to 'alc/effects/echo.cpp')
-rw-r--r-- | alc/effects/echo.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/alc/effects/echo.cpp b/alc/effects/echo.cpp index 57279005..4a9ee1bc 100644 --- a/alc/effects/echo.cpp +++ b/alc/effects/echo.cpp @@ -42,9 +42,9 @@ struct EchoState final : public EffectState { // The echo is two tap. The delay is the number of samples from before the // current offset struct { - ALsizei delay{0}; + size_t delay{0u}; } mTap[2]; - ALsizei mOffset{0}; + size_t mOffset{0u}; /* The panning gains for the two taps */ struct { @@ -59,7 +59,7 @@ struct EchoState final : public EffectState { ALboolean deviceUpdate(const ALCdevice *device) override; void update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) override; - void process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut) override; + void process(const size_t samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span<FloatBufferLine> samplesOut) override; DEF_NEWDEL(EchoState) }; @@ -117,26 +117,25 @@ void EchoState::update(const ALCcontext *context, const ALeffectslot *slot, cons ComputePanGains(target.Main, coeffs[1], slot->Params.Gain, mGains[1].Target); } -void EchoState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, const al::span<FloatBufferLine> samplesOut) +void EchoState::process(const size_t samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei /*numInput*/, const al::span<FloatBufferLine> samplesOut) { const auto mask = static_cast<ALsizei>(mSampleBuffer.size()-1); ALfloat *RESTRICT delaybuf{mSampleBuffer.data()}; - ALsizei offset{mOffset}; - ALsizei tap1{offset - mTap[0].delay}; - ALsizei tap2{offset - mTap[1].delay}; + size_t offset{mOffset}; + size_t tap1{offset - mTap[0].delay}; + size_t tap2{offset - mTap[1].delay}; ALfloat z1, z2; ASSUME(samplesToDo > 0); - ASSUME(mask > 0); std::tie(z1, z2) = mFilter.getComponents(); - for(ALsizei i{0};i < samplesToDo;) + for(size_t i{0u};i < samplesToDo;) { offset &= mask; tap1 &= mask; tap2 &= mask; - ALsizei td{mini(mask+1 - maxi(offset, maxi(tap1, tap2)), samplesToDo-i)}; + size_t td{minz(mask+1 - maxz(offset, maxz(tap1, tap2)), samplesToDo-i)}; do { /* Feed the delay buffer's input first. */ delaybuf[offset] = samplesIn[0][i]; @@ -156,8 +155,8 @@ void EchoState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRI mOffset = offset; for(ALsizei c{0};c < 2;c++) - MixSamples({mTempBuffer[c], mTempBuffer[c]+samplesToDo}, samplesOut, mGains[c].Current, - mGains[c].Target, samplesToDo, 0); + MixSamples({mTempBuffer[c], samplesToDo}, samplesOut, mGains[c].Current, mGains[c].Target, + samplesToDo, 0); } |