File indexing completed on 2024-04-28 04:52:21
0001 /* 0002 SPDX-FileCopyrightText: 2010 Marco Gittler <g.marco@freenet.de> 0003 0004 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include "abstractaudioscopewidget.h" 0010 0011 #include <QByteArray> 0012 #include <QList> 0013 #include <QTimer> 0014 0015 #include <QWidget> 0016 0017 #include <cstdint> 0018 0019 class AudioSignal : public AbstractAudioScopeWidget 0020 { 0021 Q_OBJECT 0022 public: 0023 explicit AudioSignal(QWidget *parent = nullptr); 0024 ~AudioSignal() override; 0025 /** @brief Used for checking whether audio data needs to be delivered */ 0026 bool monitoringEnabled() const; 0027 0028 QRect scopeRect() override; 0029 QImage renderHUD(uint accelerationFactor) override; 0030 QImage renderBackground(uint accelerationFactor) override; 0031 QImage renderAudioScope(uint accelerationFactor, const audioShortVector &audioFrame, const int, const int num_channels, const int samples, 0032 const int) override; 0033 0034 QString widgetName() const override { return QStringLiteral("audioSignal"); } 0035 bool isHUDDependingOnInput() const override { return false; } 0036 bool isScopeDependingOnInput() const override { return true; } 0037 bool isBackgroundDependingOnInput() const override { return false; } 0038 0039 private: 0040 double valueToPixel(double in); 0041 QTimer m_timer; 0042 QByteArray m_channels, m_peeks, m_peekage; 0043 QList<int> m_dbscale; 0044 0045 public Q_SLOTS: 0046 void showAudio(const QByteArray &); 0047 void slotReceiveAudio(audioShortVector audioSamples, int, int num_channels, int samples); 0048 private Q_SLOTS: 0049 void slotNoAudioTimeout(); 0050 0051 Q_SIGNALS: 0052 void updateAudioMonitoring(); 0053 };