summaryrefslogtreecommitdiff
path: root/Userland/Applications/SoundPlayer
diff options
context:
space:
mode:
authorkleines Filmröllchen <filmroellchen@serenityos.org>2022-03-04 00:20:04 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-14 22:45:05 +0100
commit9f856f3e454950d06d069fddef94de00f7cef79b (patch)
tree34efbfa258f47a13198ff6ca3b67bc9dfb03e9de /Userland/Applications/SoundPlayer
parent21266f42f10fba4a9259e53ab466051b2d724c85 (diff)
downloadserenity-9f856f3e454950d06d069fddef94de00f7cef79b.zip
SoundPlayer: Adjust peaking logic for bars visualization
This should give us better peaks by also reducing the energy on lower frequency bars.
Diffstat (limited to 'Userland/Applications/SoundPlayer')
-rw-r--r--Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp b/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp
index 810cf783a5..4553060de0 100644
--- a/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp
+++ b/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp
@@ -46,11 +46,11 @@ void BarsVisualizationWidget::render(GUI::PaintEvent& event, FixedArray<double>
groups[i / values_per_bar] /= values_per_bar;
}
- double const max_peak_value = AK::sqrt(static_cast<double>(fft_size));
+ double const max_peak_value = AK::sqrt(static_cast<double>(fft_size * 2));
for (size_t i = 0; i < bar_count; i++) {
groups[i] = AK::log(groups[i] + 1) / AK::log(max_peak_value);
if (m_adjust_frequencies)
- groups[i] *= 1 + 3.0 * i / bar_count;
+ groups[i] *= 1 + 2.0 * (static_cast<double>(i) - static_cast<double>(bar_count / 3)) / static_cast<double>(bar_count);
}
int const horizontal_margin = 30;