mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 22:35:07 +00:00

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
38 lines
1 KiB
C++
38 lines
1 KiB
C++
/*
|
|
* Copyright (c) 2021, Cesar Torres <shortanemoia@protonmail.com>
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "VisualizationWidget.h"
|
|
#include <AK/Complex.h>
|
|
#include <LibAudio/Buffer.h>
|
|
#include <LibGUI/Frame.h>
|
|
|
|
class BarsVisualizationWidget final : public VisualizationWidget {
|
|
C_OBJECT(BarsVisualizationWidget)
|
|
|
|
public:
|
|
~BarsVisualizationWidget() override = default;
|
|
void set_buffer(RefPtr<Audio::Buffer> buffer) override;
|
|
void set_samplerate(int samplerate) override;
|
|
|
|
private:
|
|
BarsVisualizationWidget();
|
|
void set_buffer(RefPtr<Audio::Buffer> buffer, int samples_to_use);
|
|
|
|
void paint_event(GUI::PaintEvent&) override;
|
|
void context_menu_event(GUI::ContextMenuEvent& event) override;
|
|
|
|
Vector<Complex<double>> m_sample_buffer;
|
|
Vector<int> m_gfx_falling_bars;
|
|
int m_last_id;
|
|
int m_sample_count;
|
|
int m_samplerate;
|
|
bool m_is_using_last;
|
|
bool m_adjust_frequencies;
|
|
RefPtr<GUI::Menu> m_context_menu;
|
|
};
|