diff options
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp | 4 | ||||
-rw-r--r-- | Userland/Applications/SoundPlayer/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibDSP/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibDSP/FFT.cpp (renamed from Userland/Applications/SoundPlayer/AudioAlgorithms.cpp) | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibDSP/FFT.h (renamed from Userland/Applications/SoundPlayer/AudioAlgorithms.h) | 6 |
5 files changed, 14 insertions, 6 deletions
diff --git a/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp b/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp index 4c0a584768..adf2dbdb73 100644 --- a/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp +++ b/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp @@ -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; diff --git a/Userland/Applications/SoundPlayer/CMakeLists.txt b/Userland/Applications/SoundPlayer/CMakeLists.txt index 578078938e..26f5e31c1f 100644 --- a/Userland/Applications/SoundPlayer/CMakeLists.txt +++ b/Userland/Applications/SoundPlayer/CMakeLists.txt @@ -13,11 +13,10 @@ set(SOURCES SampleWidget.cpp SoundPlayerWidgetAdvancedView.cpp BarsVisualizationWidget.cpp - AudioAlgorithms.cpp NoVisualizationWidget.cpp M3UParser.cpp PlaylistWidget.cpp ) serenity_app(SoundPlayer ICON app-sound-player) -target_link_libraries(SoundPlayer LibAudio LibGUI) +target_link_libraries(SoundPlayer LibAudio LibDSP LibGUI) diff --git a/Userland/Libraries/LibDSP/CMakeLists.txt b/Userland/Libraries/LibDSP/CMakeLists.txt index a5de6f120e..f7dc72fcd1 100644 --- a/Userland/Libraries/LibDSP/CMakeLists.txt +++ b/Userland/Libraries/LibDSP/CMakeLists.txt @@ -3,6 +3,7 @@ set(SOURCES Track.cpp Effects.cpp Synthesizers.cpp + FFT.cpp ) serenity_lib(LibDSP dsp) diff --git a/Userland/Applications/SoundPlayer/AudioAlgorithms.cpp b/Userland/Libraries/LibDSP/FFT.cpp index b25de59797..8083333f96 100644 --- a/Userland/Applications/SoundPlayer/AudioAlgorithms.cpp +++ b/Userland/Libraries/LibDSP/FFT.cpp @@ -4,10 +4,12 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "AudioAlgorithms.h" +#include "FFT.h" #include <AK/Complex.h> #include <AK/Math.h> +namespace LibDSP { + // This function uses the input vector as output too. therefore, if you wish to // leave it intact, pass a copy to this function // @@ -56,3 +58,5 @@ void fft(Vector<Complex<double>>& sample_data, bool invert) data[i] /= n; } } + +} diff --git a/Userland/Applications/SoundPlayer/AudioAlgorithms.h b/Userland/Libraries/LibDSP/FFT.h index 904c9acefe..d13d358af2 100644 --- a/Userland/Applications/SoundPlayer/AudioAlgorithms.h +++ b/Userland/Libraries/LibDSP/FFT.h @@ -9,4 +9,8 @@ #include <AK/Complex.h> #include <AK/Vector.h> -void fft(Vector<Complex<double>>& sample_data, bool invert); +namespace LibDSP { + +void fft(Vector<Complex<double>>& sample_data, bool invert = false); + +} |