SoundPlayer: Convert to double before calculating

freq_bin was converted to double after it was calculated, so there was
a much higher probability it could be 0 instead of some comma number,
which meant that the bars always stayed on top.
This commit is contained in:
Karol Kosek 2021-09-03 23:04:56 +02:00 committed by Andreas Kling
parent 43c37ae701
commit 1814f66c63
Notes: sideshowbarker 2024-07-19 17:15:10 +09:00

View File

@ -28,7 +28,7 @@ void BarsVisualizationWidget::paint_event(GUI::PaintEvent& event)
fft(m_sample_buffer, false);
double max = AK::sqrt(m_sample_count * 2.);
double freq_bin = m_samplerate / m_sample_count;
double freq_bin = m_samplerate / (double)m_sample_count;
constexpr int group_count = 60;
Vector<double, group_count> groups;