diff options
author | Chris Robinson <[email protected]> | 2019-09-16 07:16:31 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-09-16 07:16:31 -0700 |
commit | bf2c865d3953370ccf9d56e7a5dc6d2d4c587be1 (patch) | |
tree | bf9dd4ec305dfc61dd5d899d883453e94f0612f3 | |
parent | e16e2269b6a18c960a25d58f43ffad5ed408bee9 (diff) |
Clean up some more shadowing warnings
-rw-r--r-- | al/source.cpp | 14 | ||||
-rw-r--r-- | alc/alu.cpp | 21 | ||||
-rw-r--r-- | alc/backends/pulseaudio.cpp | 14 | ||||
-rw-r--r-- | alc/hrtf.cpp | 8 | ||||
-rw-r--r-- | alc/mixer/mixer_c.cpp | 7 | ||||
-rw-r--r-- | alc/mixer/mixer_neon.cpp | 12 | ||||
-rw-r--r-- | alc/mixer/mixer_sse.cpp | 12 | ||||
-rw-r--r-- | alc/mixvoice.cpp | 8 |
8 files changed, 49 insertions, 47 deletions
diff --git a/al/source.cpp b/al/source.cpp index 53d2a705..f5550caf 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -2749,15 +2749,15 @@ START_API_FUNC } /* Look for an unused voice to play this source with. */ + auto find_voice = [](const ALvoice &v) noexcept -> bool + { + return v.mPlayState.load(std::memory_order_acquire) == ALvoice::Stopped + && v.mSourceID.load(std::memory_order_relaxed) == 0u; + }; auto voices_end = context->mVoices.data() + context->mVoices.size(); - voice = std::find_if(context->mVoices.data(), voices_end, - [](const ALvoice &voice) noexcept -> bool - { - return voice.mPlayState.load(std::memory_order_acquire) == ALvoice::Stopped && - voice.mSourceID.load(std::memory_order_relaxed) == 0u; - } - ); + voice = std::find_if(context->mVoices.data(), voices_end, find_voice); assert(voice != voices_end); + auto vidx = static_cast<ALuint>(std::distance(context->mVoices.data(), voice)); voice->mPlayState.store(ALvoice::Stopped, std::memory_order_release); 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<FloatBufferLine> 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<FloatBufferLine> 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<DevMap> &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<DevMap> 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<ChannelMap,7> 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<ChannelsRequest>()) - 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<float>(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_<CTag>(const al::span<float> OutBuffer, const al::span<const float> { 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_<NEONTag>(const al::span<float> OutBuffer, const al::span<const floa { for(const ALfloat gain : Gains) { - const ALfloat *RESTRICT src{InSamples}; + const ALfloat *RESTRICT intput{InSamples}; InSamples += InStride; if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD)) @@ -273,14 +273,16 @@ void MixRow_<NEONTag>(const al::span<float> OutBuffer, const al::span<const floa { const float32x4_t gain4{vdupq_n_f32(gain)}; do { - const float32x4_t val4 = vld1q_f32(src); + const float32x4_t val4 = vld1q_f32(intput); float32x4_t dry4 = vld1q_f32(out_iter); dry4 = vmlaq_f32(dry4, val4, gain4); vst1q_f32(out_iter, dry4); - out_iter += 4; src += 4; + out_iter += 4; intput += 4; } while(--todo); } - std::transform(out_iter, OutBuffer.end(), src, out_iter, - [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(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_<SSETag>(const al::span<float> OutBuffer, const al::span<const float { for(const float gain : Gains) { - const float *RESTRICT src{InSamples}; + const float *RESTRICT input{InSamples}; InSamples += InStride; if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD)) @@ -237,14 +237,16 @@ void MixRow_<SSETag>(const al::span<float> OutBuffer, const al::span<const float { const __m128 gain4 = _mm_set1_ps(gain); do { - const __m128 val4{_mm_load_ps(src)}; + const __m128 val4{_mm_load_ps(input)}; __m128 dry4{_mm_load_ps(out_iter)}; dry4 = _mm_add_ps(dry4, _mm_mul_ps(val4, gain4)); _mm_store_ps(out_iter, dry4); - out_iter += 4; src += 4; + out_iter += 4; input += 4; } while(--todo); } - std::transform(out_iter, OutBuffer.end(), src, out_iter, - [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(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<float> 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]); |