From bf2c865d3953370ccf9d56e7a5dc6d2d4c587be1 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 16 Sep 2019 07:16:31 -0700 Subject: Clean up some more shadowing warnings --- alc/alu.cpp | 21 ++++++++++----------- alc/backends/pulseaudio.cpp | 14 ++++++-------- alc/hrtf.cpp | 8 ++++---- alc/mixer/mixer_c.cpp | 7 ++++--- alc/mixer/mixer_neon.cpp | 12 +++++++----- alc/mixer/mixer_sse.cpp | 12 +++++++----- alc/mixvoice.cpp | 8 ++++---- 7 files changed, 42 insertions(+), 40 deletions(-) (limited to 'alc') diff --git a/alc/alu.cpp b/alc/alu.cpp index d7acf8d3..60c8e8e2 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -1320,17 +1320,16 @@ void ProcessParamUpdates(ALCcontext *ctx, const ALeffectslotArray &slots, bool force{CalcContextParams(ctx)}; force |= CalcListenerParams(ctx); force = std::accumulate(slots.begin(), slots.end(), force, - [ctx](const bool force, ALeffectslot *slot) -> bool - { return CalcEffectSlotParams(slot, ctx) | force; } + [ctx](const bool f, ALeffectslot *slot) -> bool + { return CalcEffectSlotParams(slot, ctx) | f; } ); - std::for_each(voices.begin(), voices.end(), - [ctx,force](ALvoice &voice) -> void - { - ALuint sid{voice.mSourceID.load(std::memory_order_acquire)}; - if(sid) CalcSourceParams(&voice, ctx, force); - } - ); + auto calc_params = [ctx,force](ALvoice &voice) -> void + { + if(ALuint sid{voice.mSourceID.load(std::memory_order_acquire)}) + CalcSourceParams(&voice, ctx, force); + }; + std::for_each(voices.begin(), voices.end(), calc_params); } IncrementRef(ctx->mUpdateCount); } @@ -1446,7 +1445,7 @@ void ApplyStablizer(FrontStablizer *Stablizer, const al::span B /* This applies the band-splitter, preserving phase at the cost of some * delay. The shorter the delay, the more error seeps into the result. */ - auto apply_splitter = [&tmpbuf,SamplesToDo](const FloatBufferLine &Buffer, + auto apply_splitter = [&tmpbuf,SamplesToDo](const FloatBufferLine &InBuf, ALfloat (&DelayBuf)[FrontStablizer::DelayLength], BandSplitter &Filter, ALfloat (&splitbuf)[2][BUFFERSIZE]) -> void { @@ -1457,7 +1456,7 @@ void ApplyStablizer(FrontStablizer *Stablizer, const al::span B */ auto tmpbuf_end = std::begin(tmpbuf) + SamplesToDo; std::copy_n(std::begin(DelayBuf), FrontStablizer::DelayLength, tmpbuf_end); - std::reverse_copy(Buffer.begin(), Buffer.begin()+SamplesToDo, std::begin(tmpbuf)); + std::reverse_copy(InBuf.begin(), InBuf.begin()+SamplesToDo, std::begin(tmpbuf)); std::copy_n(std::begin(tmpbuf), FrontStablizer::DelayLength, std::begin(DelayBuf)); /* Apply an all-pass on the reversed signal, then reverse the samples diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index e9997013..4d3b34d9 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -447,10 +447,8 @@ struct DevMap { bool checkName(const al::vector &list, const std::string &name) { - return std::find_if(list.cbegin(), list.cend(), - [&name](const DevMap &entry) -> bool - { return entry.name == name; } - ) != list.cend(); + auto match_name = [&name](const DevMap &entry) -> bool { return entry.name == name; }; + return std::find_if(list.cbegin(), list.cend(), match_name) != list.cend(); } al::vector PlaybackDevices; @@ -756,7 +754,7 @@ void PulsePlayback::sinkInfoCallbackC(pa_context *context, const pa_sink_info *i void PulsePlayback::sinkInfoCallback(pa_context*, const pa_sink_info *info, int eol) { struct ChannelMap { - DevFmtChannels chans; + DevFmtChannels fmt; pa_channel_map map; }; static constexpr std::array chanmaps{{ @@ -775,14 +773,14 @@ void PulsePlayback::sinkInfoCallback(pa_context*, const pa_sink_info *info, int return; } - auto chanmap = std::find_if(chanmaps.cbegin(), chanmaps.cend(), + auto chaniter = std::find_if(chanmaps.cbegin(), chanmaps.cend(), [info](const ChannelMap &chanmap) -> bool { return pa_channel_map_superset(&info->channel_map, &chanmap.map); } ); - if(chanmap != chanmaps.cend()) + if(chaniter != chanmaps.cend()) { if(!mDevice->Flags.get()) - mDevice->FmtChans = chanmap->chans; + mDevice->FmtChans = chaniter->fmt; } else { diff --git a/alc/hrtf.cpp b/alc/hrtf.cpp index 7d40b16c..7110478d 100644 --- a/alc/hrtf.cpp +++ b/alc/hrtf.cpp @@ -323,12 +323,12 @@ void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALuin const ALuint azidx{float2uint(az_norm*static_cast(azcount) + 0.5f) % azcount}; /* Calculate the index for the impulse response. */ - const ALuint idx{iroffset + azidx}; + const ALuint iridx{iroffset + azidx}; - min_delay = minu(min_delay, minu(Hrtf->delays[idx][0], Hrtf->delays[idx][1])); - max_delay = maxu(max_delay, maxu(Hrtf->delays[idx][0], Hrtf->delays[idx][1])); + min_delay = minu(min_delay, minu(Hrtf->delays[iridx][0], Hrtf->delays[iridx][1])); + max_delay = maxu(max_delay, maxu(Hrtf->delays[iridx][0], Hrtf->delays[iridx][1])); - return idx; + return iridx; }; std::transform(AmbiPoints, AmbiPoints+AmbiCount, idx.begin(), calc_idxs); diff --git a/alc/mixer/mixer_c.cpp b/alc/mixer/mixer_c.cpp index 7beab1a9..6e96e54e 100644 --- a/alc/mixer/mixer_c.cpp +++ b/alc/mixer/mixer_c.cpp @@ -188,13 +188,14 @@ void MixRow_(const al::span OutBuffer, const al::span { for(const float gain : Gains) { - const float *RESTRICT src{InSamples}; + const float *RESTRICT input{InSamples}; InSamples += InStride; if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD)) continue; - std::transform(OutBuffer.begin(), OutBuffer.end(), src, OutBuffer.begin(), - [gain](const ALfloat cur, const ALfloat src) -> ALfloat { return cur + src*gain; }); + auto do_mix = [gain](const float cur, const float src) noexcept -> float + { return cur + src*gain; }; + std::transform(OutBuffer.begin(), OutBuffer.end(), input, OutBuffer.begin(), do_mix); } } diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp index 2f11273a..e7313876 100644 --- a/alc/mixer/mixer_neon.cpp +++ b/alc/mixer/mixer_neon.cpp @@ -262,7 +262,7 @@ void MixRow_(const al::span OutBuffer, const al::span GAIN_SILENCE_THRESHOLD)) @@ -273,14 +273,16 @@ void MixRow_(const al::span OutBuffer, const al::span ALfloat { return cur + src*gain; }); + + auto do_mix = [gain](const float cur, const float src) noexcept -> float + { return cur + src*gain; }; + std::transform(out_iter, OutBuffer.end(), input, out_iter, do_mix); } } diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp index 65eb0dee..d47a0e66 100644 --- a/alc/mixer/mixer_sse.cpp +++ b/alc/mixer/mixer_sse.cpp @@ -226,7 +226,7 @@ void MixRow_(const al::span OutBuffer, const al::span GAIN_SILENCE_THRESHOLD)) @@ -237,14 +237,16 @@ void MixRow_(const al::span OutBuffer, const al::span ALfloat { return cur + src*gain; }); + + auto do_mix = [gain](const float cur, const float src) noexcept -> float + { return cur + src*gain; }; + std::transform(out_iter, OutBuffer.end(), input, out_iter, do_mix); } } diff --git a/alc/mixvoice.cpp b/alc/mixvoice.cpp index 2b5972f3..3d4d9cb8 100644 --- a/alc/mixvoice.cpp +++ b/alc/mixvoice.cpp @@ -763,14 +763,14 @@ void ALvoice::mix(State vstate, ALCcontext *Context, const ALuint SamplesToDo) const al::span nfcsamples{Device->NfcSampleData, DstBufferSize}; size_t chanoffset{outcount}; using FilterProc = void (NfcFilter::*)(float*,const float*,const size_t); - auto apply_nfc = [this,&parms,samples,TargetGains,Counter,OutPos,&chanoffset,nfcsamples](const FilterProc process, const size_t outcount) -> void + auto apply_nfc = [this,&parms,samples,TargetGains,Counter,OutPos,&chanoffset,nfcsamples](const FilterProc process, const size_t chancount) -> void { - if(outcount < 1) return; + if(chancount < 1) return; (parms.NFCtrlFilter.*process)(nfcsamples.data(), samples, nfcsamples.size()); - MixSamples(nfcsamples, mDirect.Buffer.subspan(chanoffset, outcount), + MixSamples(nfcsamples, mDirect.Buffer.subspan(chanoffset, chancount), parms.Gains.Current+chanoffset, TargetGains+chanoffset, Counter, OutPos); - chanoffset += outcount; + chanoffset += chancount; }; apply_nfc(&NfcFilter::process1, Device->NumChannelsPerOrder[1]); apply_nfc(&NfcFilter::process2, Device->NumChannelsPerOrder[2]); -- cgit v1.2.3