// SPDX-FileCopyrightText: 2024 Gary Wang // // SPDX-License-Identifier: MIT #pragma once #include #include class QAudioBufferOutput; class FFTSpectrum : public QWidget { Q_OBJECT Q_PROPERTY(QMediaPlayer * mediaPlayer MEMBER m_mediaPlayer WRITE setMediaPlayer NOTIFY mediaPlayerChanged) public: explicit FFTSpectrum(QWidget* parent); ~FFTSpectrum(); void setMediaPlayer(QMediaPlayer* player); signals: void mediaPlayerChanged(); protected: void paintEvent(QPaintEvent* e) override; private: QMediaPlayer* m_mediaPlayer = nullptr; QAudioBufferOutput* m_audioBufferOutput = nullptr; std::vector m_freq; };