From bb46cec0b1acd8848774aedba45adb929108fa8e Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 20 Aug 2019 14:30:04 -0700 Subject: Pass samplesToDo as size_t to effects --- alc/effects/compressor.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'alc/effects/compressor.cpp') diff --git a/alc/effects/compressor.cpp b/alc/effects/compressor.cpp index 63867762..e2f644ed 100644 --- a/alc/effects/compressor.cpp +++ b/alc/effects/compressor.cpp @@ -51,7 +51,7 @@ struct CompressorState 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 samplesOut) override; + void process(const size_t samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span samplesOut) override; DEF_NEWDEL(CompressorState) }; @@ -85,18 +85,18 @@ void CompressorState::update(const ALCcontext*, const ALeffectslot *slot, const } } -void CompressorState::process(const ALsizei samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span samplesOut) +void CompressorState::process(const size_t samplesToDo, const FloatBufferLine *RESTRICT samplesIn, const ALsizei numInput, const al::span samplesOut) { - for(ALsizei base{0};base < samplesToDo;) + for(size_t base{0u};base < samplesToDo;) { ALfloat gains[256]; - const ALsizei td{mini(256, samplesToDo-base)}; + const size_t td{minz(256, samplesToDo-base)}; /* Generate the per-sample gains from the signal envelope. */ ALfloat env{mEnvFollower}; if(mEnabled) { - for(ALsizei i{0};i < td;++i) + for(size_t i{0u};i < td;++i) { /* Clamp the absolute amplitude to the defined envelope limits, * then attack or release the envelope to reach it. @@ -120,7 +120,7 @@ void CompressorState::process(const ALsizei samplesToDo, const FloatBufferLine * * ensure smooth gain changes when the compressor is turned on and * off. */ - for(ALsizei i{0};i < td;++i) + for(size_t i{0u};i < td;++i) { const ALfloat amplitude{1.0f}; if(amplitude > env) @@ -144,7 +144,7 @@ void CompressorState::process(const ALsizei samplesToDo, const FloatBufferLine * if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD)) continue; - for(ALsizei i{0};i < td;i++) + for(size_t i{0u};i < td;i++) output[base+i] += samplesIn[j][base+i] * gains[i] * gain; } } -- cgit v1.2.3