1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

SoundPlayer+LibDSP: Move the FFT implementation to LibDSP

LibDSP can greatly benefit from this nice FFT implementation, so let's
move it into the fitting library :^)

Note that this now requires linking SoundPlayer against LibDSP. That's
not an issue (LibDSP is rather small currently anyways), as we can
probably make great use of it in the future anyways.
This commit is contained in:
kleines Filmröllchen 2021-11-20 17:44:12 +01:00 committed by Linus Groh
parent 4cbf7f24be
commit a099a77e82
5 changed files with 14 additions and 6 deletions

View file

@ -5,8 +5,8 @@
*/
#include "BarsVisualizationWidget.h"
#include "AudioAlgorithms.h"
#include <AK/Math.h>
#include <LibDSP/FFT.h>
#include <LibGUI/Event.h>
#include <LibGUI/Menu.h>
#include <LibGUI/Painter.h>
@ -25,7 +25,7 @@ void BarsVisualizationWidget::paint_event(GUI::PaintEvent& event)
if (m_sample_buffer.is_empty())
return;
fft(m_sample_buffer, false);
LibDSP::fft(m_sample_buffer, false);
double max = AK::sqrt(m_sample_count * 2.);
double freq_bin = m_samplerate / (double)m_sample_count;