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

SoundPlayer: Auto refresh visualization widgets

Visualization widgets should only have to tell how many samples they
need per frame and have a render method which receives all data relevant
to draw the next frame.
This commit is contained in:
Arne Elster 2022-01-09 22:46:06 +01:00 committed by Andreas Kling
parent 02462b6068
commit 9edaa033e5
7 changed files with 115 additions and 107 deletions

View file

@ -10,20 +10,12 @@
#include "VisualizationWidget.h"
#include <LibGUI/Frame.h>
namespace Audio {
class Buffer;
}
class SampleWidget final : public VisualizationWidget {
C_OBJECT(SampleWidget)
public:
virtual ~SampleWidget() override = default;
void set_buffer(RefPtr<Audio::Buffer>) override;
private:
SampleWidget() = default;
virtual void paint_event(GUI::PaintEvent&) override;
RefPtr<Audio::Buffer> m_buffer;
SampleWidget();
virtual void render(GUI::PaintEvent&, FixedArray<double> const& samples) override;
};