Clean up some more shadowing warnings

This commit is contained in:
Chris Robinson
2019-09-16 07:16:31 -07:00
parent e16e2269b6
commit bf2c865d39
8 changed files with 49 additions and 47 deletions
+7 -7
View File
@@ -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);
+10 -11
View File
@@ -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
+6 -8
View File
@@ -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
{
+4 -4
View File
@@ -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);
+4 -3
View File
@@ -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);
}
}
+7 -5
View File
@@ -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);
}
}
+7 -5
View File
@@ -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);
}
}
+4 -4
View File
@@ -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]);