aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-02-19 02:30:01 -0800
committerChris Robinson <[email protected]>2019-02-19 02:30:01 -0800
commita75bc26173252b26ff2a75c5851b5399b025152a (patch)
tree9facc078103165618369b44dd0a5bc316336f3c1
parent2c04095d22b46fe1f27577e3c781cf2f9fcdd415 (diff)
Reduce some indenting
-rw-r--r--Alc/alu.cpp52
1 files changed, 25 insertions, 27 deletions
diff --git a/Alc/alu.cpp b/Alc/alu.cpp
index d63d1ca6..3b4ecfbd 100644
--- a/Alc/alu.cpp
+++ b/Alc/alu.cpp
@@ -1630,16 +1630,15 @@ void ApplyDither(ALfloat (*Samples)[BUFFERSIZE], ALuint *dither_seed, const ALfl
{
ASSUME(SamplesToDo > 0);
ALfloat *buffer{al::assume_aligned<16>(input)};
- std::transform(buffer, buffer+SamplesToDo, buffer,
- [&seed,invscale,quant_scale](ALfloat sample) noexcept -> ALfloat
- {
- ALfloat val = sample * quant_scale;
- ALuint rng0 = dither_rng(&seed);
- ALuint rng1 = dither_rng(&seed);
- val += static_cast<ALfloat>(rng0*(1.0/UINT_MAX) - rng1*(1.0/UINT_MAX));
- return fast_roundf(val) * invscale;
- }
- );
+ auto dither_sample = [&seed,invscale,quant_scale](ALfloat sample) noexcept -> ALfloat
+ {
+ ALfloat val{sample * quant_scale};
+ ALuint rng0{dither_rng(&seed)};
+ ALuint rng1{dither_rng(&seed)};
+ val += static_cast<ALfloat>(rng0*(1.0/UINT_MAX) - rng1*(1.0/UINT_MAX));
+ return fast_roundf(val) * invscale;
+ };
+ std::transform(buffer, buffer+SamplesToDo, buffer, dither_sample);
};
std::for_each(Samples, Samples+numchans, dither_channel);
*dither_seed = seed;
@@ -1755,7 +1754,7 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples)
assert(lidx >= 0 && ridx >= 0 && cidx >= 0);
ApplyStablizer(device->Stablizer.get(), device->RealOut.Buffer, lidx, ridx, cidx,
- SamplesToDo, device->RealOut.NumChannels);
+ SamplesToDo, device->RealOut.NumChannels);
}
/* Apply compression, limiting sample amplitude if needed or desired. */
@@ -1771,7 +1770,7 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples)
*/
if(device->DitherDepth > 0.0f)
ApplyDither(device->RealOut.Buffer, &device->DitherSeed, device->DitherDepth,
- SamplesToDo, device->RealOut.NumChannels);
+ SamplesToDo, device->RealOut.NumChannels);
if(LIKELY(OutBuffer))
{
@@ -1835,22 +1834,21 @@ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...)
}
}
- std::for_each(ctx->Voices, ctx->Voices+ctx->VoiceCount.load(std::memory_order_acquire),
- [ctx](ALvoice *voice) -> void
- {
- if(!voice->Playing.load(std::memory_order_acquire)) return;
- ALuint sid{voice->SourceID.load(std::memory_order_relaxed)};
- if(!sid) return;
+ auto stop_voice = [ctx](ALvoice *voice) -> void
+ {
+ if(!voice->Playing.load(std::memory_order_acquire)) return;
+ ALuint sid{voice->SourceID.load(std::memory_order_relaxed)};
+ if(!sid) return;
- voice->SourceID.store(0u, std::memory_order_relaxed);
- voice->Playing.store(false, std::memory_order_release);
- /* If the source's voice was playing, it's now effectively
- * stopped (the source state will be updated the next time it's
- * checked).
- */
- SendSourceStoppedEvent(ctx, sid);
- }
- );
+ voice->SourceID.store(0u, std::memory_order_relaxed);
+ voice->Playing.store(false, std::memory_order_release);
+ /* If the source's voice was playing, it's now effectively stopped
+ * (the source state will be updated the next time it's checked).
+ */
+ SendSourceStoppedEvent(ctx, sid);
+ };
+ std::for_each(ctx->Voices, ctx->Voices+ctx->VoiceCount.load(std::memory_order_acquire),
+ stop_voice);
ctx = ctx->next.load(std::memory_order_relaxed);
}