File indexing completed on 2024-04-28 04:52:21
0001 /* 0002 SPDX-FileCopyrightText: 2010 Simon Andreas Eugster <simon.eu@gmail.com> 0003 This file is part of kdenlive. See www.kdenlive.org. 0004 0005 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 #pragma once 0009 0010 #include <QWidget> 0011 0012 #include <cstdint> 0013 0014 #include "../../definitions.h" 0015 #include "../abstractscopewidget.h" 0016 0017 class Render; 0018 0019 /** 0020 * @brief Abstract class for scopes analyzing audio samples. 0021 */ 0022 class AbstractAudioScopeWidget : public AbstractScopeWidget 0023 { 0024 Q_OBJECT 0025 public: 0026 explicit AbstractAudioScopeWidget(bool trackMouse = false, QWidget *parent = nullptr); 0027 ~AbstractAudioScopeWidget() override; 0028 0029 public Q_SLOTS: 0030 void slotReceiveAudio(const audioShortVector &sampleData, int freq, int num_channels, int num_samples); 0031 0032 protected: 0033 /** @brief This is just a wrapper function, subclasses can use renderAudioScope. */ 0034 QImage renderScope(uint accelerationFactor) override; 0035 0036 ///// Unimplemented Methods ///// 0037 /** @brief Scope renderer. Must emit signalScopeRenderingFinished() 0038 when calculation has finished, to allow multi-threading. 0039 accelerationFactor hints how much faster than usual the calculation should be accomplished, if possible. */ 0040 virtual QImage renderAudioScope(uint accelerationFactor, const audioShortVector &audioFrame, const int freq, const int num_channels, const int num_samples, 0041 const int newData) = 0; 0042 0043 int m_freq{0}; 0044 int m_nChannels{0}; 0045 int m_nSamples{0}; 0046 0047 private: 0048 audioShortVector m_audioFrame; 0049 QAtomicInt m_newData; 0050 };