From 91b7e8142caf297b97d6b403ee79ba2dcbcda09f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 8 Jun 2019 01:39:28 -0700 Subject: Simplify DistanceComp somewhat --- Alc/alu.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Alc/alu.cpp') diff --git a/Alc/alu.cpp b/Alc/alu.cpp index 9a1958b6..e570c2ad 100644 --- a/Alc/alu.cpp +++ b/Alc/alu.cpp @@ -1540,22 +1540,22 @@ void ApplyStablizer(FrontStablizer *Stablizer, FloatBufferLine *Buffer, const AL } } -void ApplyDistanceComp(FloatBufferLine *Samples, const DistanceComp &distcomp, - const ALsizei SamplesToDo, const ALuint numchans) +void ApplyDistanceComp(const al::span Samples, const ALsizei SamplesToDo, + const DistanceComp::DistData *distcomp) { ASSUME(SamplesToDo > 0); - ASSUME(numchans > 0); - for(ALuint c{0};c < numchans;c++) + for(auto &chanbuffer : Samples) { - const ALfloat gain{distcomp[c].Gain}; - const ALsizei base{distcomp[c].Length}; - ALfloat *distbuf{al::assume_aligned<16>(distcomp[c].Buffer)}; + const ALfloat gain{distcomp->Gain}; + const ALsizei base{distcomp->Length}; + ALfloat *distbuf{al::assume_aligned<16>(distcomp->Buffer)}; + ++distcomp; if(base < 1) continue; - ALfloat *inout{al::assume_aligned<16>(Samples[c].data())}; + ALfloat *inout{al::assume_aligned<16>(chanbuffer.data())}; auto inout_end = inout + SamplesToDo; if(LIKELY(SamplesToDo >= base)) { @@ -1716,8 +1716,8 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples) comp->process(SamplesToDo, device->RealOut.Buffer); /* Apply delays and attenuation for mismatched speaker distances. */ - ApplyDistanceComp(device->RealOut.Buffer, device->ChannelDelay, SamplesToDo, - device->RealOut.NumChannels); + ApplyDistanceComp({device->RealOut.Buffer, device->RealOut.NumChannels}, SamplesToDo, + device->ChannelDelay.as_span().cbegin()); /* Apply dithering. The compressor should have left enough headroom for * the dither noise to not saturate. -- cgit v1.2.3