mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 11:45:07 +00:00

This is a first pass at refactoring SoundPlayer so that the View widget is decoupled from the player itself. In doing so, this fixed a couple of issues, including possibly inconsistent states (e.g. player could be paused and stopped at the same time). With the change, Player actually controls the show, and calls methods overriden by its subclasses to perform actions, such as update the Seek bar; the hard work of massaging the raw data is done by the Player class, so subclasses don't need to reimplement any of these things. This also removes some copies of playlist management code that happened to be copied+pasted inside callbacks of buttons -- it now lives inside a neatly packaged Playlist class, and the Player only asks for the next song to play. In addition, the menu bar has been slightly rearranged.
28 lines
536 B
C++
28 lines
536 B
C++
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "VisualizationWidget.h"
|
|
#include <LibGUI/Frame.h>
|
|
|
|
namespace Audio {
|
|
class Buffer;
|
|
}
|
|
|
|
class SampleWidget final : public VisualizationWidget {
|
|
C_OBJECT(SampleWidget)
|
|
public:
|
|
virtual ~SampleWidget() override;
|
|
|
|
void set_buffer(RefPtr<Audio::Buffer>) override;
|
|
|
|
private:
|
|
SampleWidget();
|
|
virtual void paint_event(GUI::PaintEvent&) override;
|
|
|
|
RefPtr<Audio::Buffer> m_buffer;
|
|
};
|