]> git.sesse.net Git - kdenlive/blob - src/scopes/audioscopes/abstractaudioscopewidget.h
Merge branch 'master' into audioAlign
[kdenlive] / src / scopes / audioscopes / abstractaudioscopewidget.h
1 /***************************************************************************
2  *   Copyright (C) 2010 by Simon Andreas Eugster (simon.eu@gmail.com)      *
3  *   This file is part of kdenlive. See www.kdenlive.org.                  *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  ***************************************************************************/
10
11 #ifndef ABSTRACTAUDIOSCOPEWIDGET_H
12 #define ABSTRACTAUDIOSCOPEWIDGET_H
13
14
15 #include <QtCore>
16 #include <QWidget>
17
18 #include <stdint.h>
19
20 #include "../abstractscopewidget.h"
21
22 class QMenu;
23
24 class Monitor;
25 class Render;
26
27 /**
28  \brief Abstract class for scopes analyzing audio samples.
29  */
30 class AbstractAudioScopeWidget : public AbstractScopeWidget
31 {
32     Q_OBJECT
33 public:
34     AbstractAudioScopeWidget(bool trackMouse = false, QWidget *parent = 0);
35     virtual ~AbstractAudioScopeWidget();
36
37 public slots:
38     void slotReceiveAudio(QVector<int16_t> sampleData, int freq, int num_channels, int num_samples);
39
40 protected:
41     /** @brief This is just a wrapper function, subclasses can use renderAudioScope. */
42     virtual QImage renderScope(uint accelerationFactor);
43
44     ///// Unimplemented Methods /////
45     /** @brief Scope renderer. Must emit signalScopeRenderingFinished()
46         when calculation has finished, to allow multi-threading.
47         accelerationFactor hints how much faster than usual the calculation should be accomplished, if possible. */
48     virtual QImage renderAudioScope(uint accelerationFactor,
49                                const QVector<int16_t> audioFrame, const int freq, const int num_channels, const int num_samples,
50                                const int newData) = 0;
51
52     int m_freq;
53     int m_nChannels;
54     int m_nSamples;
55
56 private:
57     QVector<int16_t> m_audioFrame;
58     QAtomicInt m_newData;
59
60 };
61
62 #endif // ABSTRACTAUDIOSCOPEWIDGET_H