From 9f9b64d280d50b39c92e8e12c6f45ef78a72b4ea Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 13 Oct 2020 16:00:33 -0400 Subject: audio_core/CMakeLists: Make warnings consistent with core Normalizes the warnings shared between audio_core and core. --- src/audio_core/algorithm/interpolate.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/audio_core/algorithm/interpolate.cpp') diff --git a/src/audio_core/algorithm/interpolate.cpp b/src/audio_core/algorithm/interpolate.cpp index 689a54508..699fcb84c 100644 --- a/src/audio_core/algorithm/interpolate.cpp +++ b/src/audio_core/algorithm/interpolate.cpp @@ -146,7 +146,7 @@ std::vector Interpolate(InterpolationState& state, std::vector input, return {}; if (ratio <= 0) { - LOG_CRITICAL(Audio, "Nonsensical interpolation ratio {}", ratio); + LOG_ERROR(Audio, "Nonsensical interpolation ratio {}", ratio); return input; } @@ -164,7 +164,8 @@ std::vector Interpolate(InterpolationState& state, std::vector input, const std::size_t num_frames{input.size() / 2}; std::vector output; - output.reserve(static_cast(input.size() / ratio + InterpolationState::taps)); + output.reserve(static_cast(static_cast(input.size()) / ratio + + InterpolationState::taps)); for (std::size_t frame{}; frame < num_frames; ++frame) { const std::size_t lut_index{(state.fraction >> 8) * InterpolationState::taps}; -- cgit v1.2.3 From be1954e04cb5a0c3a526f78ed5490a5e65310280 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 15 Oct 2020 14:49:45 -0400 Subject: core: Fix clang build Recent changes to the build system that made more warnings be flagged as errors caused building via clang to break. Fixes #4795 --- src/audio_core/algorithm/interpolate.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/audio_core/algorithm/interpolate.cpp') diff --git a/src/audio_core/algorithm/interpolate.cpp b/src/audio_core/algorithm/interpolate.cpp index 699fcb84c..587ee5b7b 100644 --- a/src/audio_core/algorithm/interpolate.cpp +++ b/src/audio_core/algorithm/interpolate.cpp @@ -167,8 +167,8 @@ std::vector Interpolate(InterpolationState& state, std::vector input, output.reserve(static_cast(static_cast(input.size()) / ratio + InterpolationState::taps)); - for (std::size_t frame{}; frame < num_frames; ++frame) { - const std::size_t lut_index{(state.fraction >> 8) * InterpolationState::taps}; + for (std::size_t frame = 0; frame < num_frames; ++frame) { + const auto lut_index{static_cast(state.fraction >> 8) * InterpolationState::taps}; std::rotate(state.history.begin(), state.history.end() - 1, state.history.end()); state.history[0][0] = input[frame * 2 + 0]; @@ -225,7 +225,7 @@ void Resample(s32* output, const s32* input, s32 pitch, s32& fraction, std::size output[i] = (l0 * s0 + l1 * s1 + l2 * s2 + l3 * s3) >> 15; fraction += pitch; - index += (fraction >> 15); + index += static_cast(fraction >> 15); fraction &= 0x7fff; } } -- cgit v1.2.3 From 3d592972dc3fd61cc88771b889eff237e4e03e0f Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 20 Oct 2020 19:07:39 -0700 Subject: Revert "core: Fix clang build" --- src/audio_core/algorithm/interpolate.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/audio_core/algorithm/interpolate.cpp') diff --git a/src/audio_core/algorithm/interpolate.cpp b/src/audio_core/algorithm/interpolate.cpp index 587ee5b7b..699fcb84c 100644 --- a/src/audio_core/algorithm/interpolate.cpp +++ b/src/audio_core/algorithm/interpolate.cpp @@ -167,8 +167,8 @@ std::vector Interpolate(InterpolationState& state, std::vector input, output.reserve(static_cast(static_cast(input.size()) / ratio + InterpolationState::taps)); - for (std::size_t frame = 0; frame < num_frames; ++frame) { - const auto lut_index{static_cast(state.fraction >> 8) * InterpolationState::taps}; + for (std::size_t frame{}; frame < num_frames; ++frame) { + const std::size_t lut_index{(state.fraction >> 8) * InterpolationState::taps}; std::rotate(state.history.begin(), state.history.end() - 1, state.history.end()); state.history[0][0] = input[frame * 2 + 0]; @@ -225,7 +225,7 @@ void Resample(s32* output, const s32* input, s32 pitch, s32& fraction, std::size output[i] = (l0 * s0 + l1 * s1 + l2 * s2 + l3 * s3) >> 15; fraction += pitch; - index += static_cast(fraction >> 15); + index += (fraction >> 15); fraction &= 0x7fff; } } -- cgit v1.2.3 From fa5a1a4bfd4b2ba85a9f9644035edfe9a8fd8b68 Mon Sep 17 00:00:00 2001 From: 16-Bit-Dog <67922228+16-Bit-Dog@users.noreply.github.com> Date: Wed, 30 Dec 2020 19:03:26 -0500 Subject: Make the coding conventions more consistant lut_index had 0 added when nothing was supposed to be added despite this, index was not added to 0 when nothing was supposed to be added... --- src/audio_core/algorithm/interpolate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/audio_core/algorithm/interpolate.cpp') diff --git a/src/audio_core/algorithm/interpolate.cpp b/src/audio_core/algorithm/interpolate.cpp index 699fcb84c..3b4144e21 100644 --- a/src/audio_core/algorithm/interpolate.cpp +++ b/src/audio_core/algorithm/interpolate.cpp @@ -218,7 +218,7 @@ void Resample(s32* output, const s32* input, s32 pitch, s32& fraction, std::size const auto l2 = lut[lut_index + 2]; const auto l3 = lut[lut_index + 3]; - const auto s0 = static_cast(input[index]); + const auto s0 = static_cast(input[index + 0]); const auto s1 = static_cast(input[index + 1]); const auto s2 = static_cast(input[index + 2]); const auto s3 = static_cast(input[index + 3]); -- cgit v1.2.3