From dc8479928c5aee4c6ad6fe4f59006fb604cee701 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 18 Sep 2016 09:38:01 +0900 Subject: Sources: Run clang-format on everything. --- src/audio_core/interpolate.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/audio_core/interpolate.cpp') diff --git a/src/audio_core/interpolate.cpp b/src/audio_core/interpolate.cpp index fcd3aa066..7751c545d 100644 --- a/src/audio_core/interpolate.cpp +++ b/src/audio_core/interpolate.cpp @@ -17,7 +17,8 @@ constexpr u64 scale_mask = scale_factor - 1; /// Here we step over the input in steps of rate_multiplier, until we consume all of the input. /// Three adjacent samples are passed to fn each step. template -static StereoBuffer16 StepOverSamples(State& state, const StereoBuffer16& input, float rate_multiplier, Function fn) { +static StereoBuffer16 StepOverSamples(State& state, const StereoBuffer16& input, + float rate_multiplier, Function fn) { ASSERT(rate_multiplier > 0); if (input.size() < 2) @@ -63,22 +64,21 @@ static StereoBuffer16 StepOverSamples(State& state, const StereoBuffer16& input, } StereoBuffer16 None(State& state, const StereoBuffer16& input, float rate_multiplier) { - return StepOverSamples(state, input, rate_multiplier, [](u64 fraction, const auto& x0, const auto& x1, const auto& x2) { - return x0; - }); + return StepOverSamples( + state, input, rate_multiplier, + [](u64 fraction, const auto& x0, const auto& x1, const auto& x2) { return x0; }); } StereoBuffer16 Linear(State& state, const StereoBuffer16& input, float rate_multiplier) { // Note on accuracy: Some values that this produces are +/- 1 from the actual firmware. - return StepOverSamples(state, input, rate_multiplier, [](u64 fraction, const auto& x0, const auto& x1, const auto& x2) { + return StepOverSamples(state, input, rate_multiplier, [](u64 fraction, const auto& x0, + const auto& x1, const auto& x2) { // This is a saturated subtraction. (Verified by black-box fuzzing.) s64 delta0 = MathUtil::Clamp(x1[0] - x0[0], -32768, 32767); s64 delta1 = MathUtil::Clamp(x1[1] - x0[1], -32768, 32767); - return std::array { - static_cast(x0[0] + fraction * delta0 / scale_factor), - static_cast(x0[1] + fraction * delta1 / scale_factor) - }; + return std::array{static_cast(x0[0] + fraction * delta0 / scale_factor), + static_cast(x0[1] + fraction * delta1 / scale_factor)}; }); } -- cgit v1.2.3 From 396a8d91a4423d9c793eeff0798d544613647511 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sun, 18 Sep 2016 18:01:46 -0700 Subject: Manually tweak source formatting and then re-run clang-format --- src/audio_core/interpolate.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/audio_core/interpolate.cpp') diff --git a/src/audio_core/interpolate.cpp b/src/audio_core/interpolate.cpp index 7751c545d..cb1c58a67 100644 --- a/src/audio_core/interpolate.cpp +++ b/src/audio_core/interpolate.cpp @@ -71,15 +71,17 @@ StereoBuffer16 None(State& state, const StereoBuffer16& input, float rate_multip StereoBuffer16 Linear(State& state, const StereoBuffer16& input, float rate_multiplier) { // Note on accuracy: Some values that this produces are +/- 1 from the actual firmware. - return StepOverSamples(state, input, rate_multiplier, [](u64 fraction, const auto& x0, - const auto& x1, const auto& x2) { - // This is a saturated subtraction. (Verified by black-box fuzzing.) - s64 delta0 = MathUtil::Clamp(x1[0] - x0[0], -32768, 32767); - s64 delta1 = MathUtil::Clamp(x1[1] - x0[1], -32768, 32767); - - return std::array{static_cast(x0[0] + fraction * delta0 / scale_factor), - static_cast(x0[1] + fraction * delta1 / scale_factor)}; - }); + return StepOverSamples(state, input, rate_multiplier, + [](u64 fraction, const auto& x0, const auto& x1, const auto& x2) { + // This is a saturated subtraction. (Verified by black-box fuzzing.) + s64 delta0 = MathUtil::Clamp(x1[0] - x0[0], -32768, 32767); + s64 delta1 = MathUtil::Clamp(x1[1] - x0[1], -32768, 32767); + + return std::array{ + static_cast(x0[0] + fraction * delta0 / scale_factor), + static_cast(x0[1] + fraction * delta1 / scale_factor), + }; + }); } } // namespace AudioInterp -- cgit v1.2.3 From ebdae19fd226104baec712b9da9939ff82ef3c3a Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 21 Sep 2016 00:21:23 +0900 Subject: Remove empty newlines in #include blocks. This makes clang-format useful on those. Also add a bunch of forgotten transitive includes, which otherwise prevented compilation. --- src/audio_core/interpolate.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/audio_core/interpolate.cpp') diff --git a/src/audio_core/interpolate.cpp b/src/audio_core/interpolate.cpp index cb1c58a67..8a5d4181a 100644 --- a/src/audio_core/interpolate.cpp +++ b/src/audio_core/interpolate.cpp @@ -3,7 +3,6 @@ // Refer to the license.txt file included. #include "audio_core/interpolate.h" - #include "common/assert.h" #include "common/math_util.h" -- cgit v1.2.3