1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:27:45 +00:00

SoundPlayer: Implement logarithmic spectrum display

Now that we have y-axis (gain) logarithmic display, we should also have
x-axis (frequency) logarithmic display; that's how our ears work. This
can be turned off with an option, but it generally looks much nicer.
This commit is contained in:
kleines Filmröllchen 2022-03-04 00:25:15 +01:00 committed by Andreas Kling
parent 9f856f3e45
commit d2510d0caa
2 changed files with 33 additions and 8 deletions

View file

@ -28,7 +28,8 @@ private:
static constexpr size_t fft_size = 512;
static constexpr size_t bar_count = 64;
static constexpr size_t values_per_bar = (fft_size / 2) / bar_count;
// Things become weird near the Nyquist limit. Just don't use that FFT data.
static constexpr size_t cutoff = fft_size - 32;
Array<Complex<double>, fft_size> m_fft_samples {};
Array<double, fft_size> m_fft_window {};
@ -36,5 +37,6 @@ private:
Array<int, bar_count> m_gfx_falling_bars {};
bool m_is_using_last;
bool m_adjust_frequencies;
bool m_logarithmic_spectrum;
RefPtr<GUI::Menu> m_context_menu;
};