diff --git a/Userland/Applications/Piano/Music.h b/Userland/Applications/Piano/Music.h index 55dc329704..bfb4a4c930 100644 --- a/Userland/Applications/Piano/Music.h +++ b/Userland/Applications/Piano/Music.h @@ -23,7 +23,8 @@ struct Sample { i16 right; }; -constexpr int sample_count = 1 << 9; +// HACK: needs to increase with device sample rate, but all of the sample_count stuff is static for now +constexpr int sample_count = 1 << 12; constexpr int buffer_size = sample_count * sizeof(Sample); diff --git a/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp b/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp index 3be48ff79c..f6ccd353b2 100644 --- a/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp +++ b/Userland/Applications/SoundPlayer/BarsVisualizationWidget.cpp @@ -97,7 +97,10 @@ void BarsVisualizationWidget::set_buffer(RefPtr buffer, int sampl if (m_is_using_last) return; m_is_using_last = true; - VERIFY(buffer->sample_count() >= 256); + // FIXME: We should dynamically adapt to the sample count and e.g. perform the fft over multiple buffers. + // For now, the visualizer doesn't work with extremely low global sample rates. + if (buffer->sample_count() < 256) + return; m_sample_count = round_previous_power_of_2(samples_to_use); m_sample_buffer.resize(m_sample_count); for (int i = 0; i < m_sample_count; i++) {