From f1d8e551688c627fa9a32d3279c1fc6b7b73596a Mon Sep 17 00:00:00 2001 From: Joel Petersson Date: Mon, 1 May 2023 18:48:26 +0200 Subject: [PATCH] SoundPlayer: Introduce buffer_reset api to VisualizationWidget Previously there was no way to clear the internal buffer in a VisualizationWidget. These buffers are what determines how a VisualizationWidget is rendered, so with this commit we are now able to reset visualizations. --- Userland/Applications/SoundPlayer/VisualizationWidget.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Userland/Applications/SoundPlayer/VisualizationWidget.h b/Userland/Applications/SoundPlayer/VisualizationWidget.h index 8ad02136e9..b908ee883b 100644 --- a/Userland/Applications/SoundPlayer/VisualizationWidget.h +++ b/Userland/Applications/SoundPlayer/VisualizationWidget.h @@ -33,6 +33,13 @@ public: m_frame_count = 0; } + void reset_buffer() + { + m_sample_buffer.clear(); + m_render_buffer.fill_with(.0f); + m_frame_count = 0; + } + virtual void set_samplerate(int samplerate) { m_samplerate = samplerate;