1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:47:44 +00:00

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.
This commit is contained in:
Joel Petersson 2023-05-01 18:48:26 +02:00 committed by Jelle Raaijmakers
parent d05cb50b24
commit f1d8e55168

View file

@ -33,6 +33,13 @@ public:
m_frame_count = 0; 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) virtual void set_samplerate(int samplerate)
{ {
m_samplerate = samplerate; m_samplerate = samplerate;