aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-06-09 21:28:09 -0700
committerChris Robinson <[email protected]>2020-06-09 21:28:09 -0700
commitc50250c97842613694e5433b878abe8d566604bf (patch)
treefe753d69a07872e03ae32a17fd8de5c809a64fb1
parentb2b3ad570bce4e69dd6b8935c87828d41db06a5b (diff)
Use a range-for loop instead of for_each
-rw-r--r--alc/alu.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp
index eac36f58..9b077304 100644
--- a/alc/alu.cpp
+++ b/alc/alu.cpp
@@ -1983,16 +1983,16 @@ template<> inline uint8_t SampleConv(float val) noexcept
template<DevFmtType T>
void Write(const al::span<const FloatBufferLine> InBuffer, void *OutBuffer, const size_t Offset,
- const ALuint SamplesToDo, const size_t FrameStep)
+ const size_t SamplesToDo, const size_t FrameStep)
{
using SampleType = typename DevFmtTypeTraits<T>::Type;
ASSUME(FrameStep > 0);
+ ASSUME(SamplesToDo > 0);
SampleType *outbase = static_cast<SampleType*>(OutBuffer) + Offset*FrameStep;
- auto conv_channel = [&outbase,SamplesToDo,FrameStep](const FloatBufferLine &inbuf) -> void
+ for(const FloatBufferLine &inbuf : InBuffer)
{
- ASSUME(SamplesToDo > 0);
SampleType *out{outbase++};
auto conv_sample = [FrameStep,&out](const float s) noexcept -> void
{
@@ -2000,8 +2000,7 @@ void Write(const al::span<const FloatBufferLine> InBuffer, void *OutBuffer, cons
out += FrameStep;
};
std::for_each(inbuf.begin(), inbuf.begin()+SamplesToDo, conv_sample);
- };
- std::for_each(InBuffer.cbegin(), InBuffer.cend(), conv_channel);
+ }
}
} // namespace