]> git.sesse.net Git - kdenlive/blob - src/audioscopes/spectrogram.h
Abstract Scopes:
[kdenlive] / src / audioscopes / spectrogram.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 SPECTROGRAM_H
12 #define SPECTROGRAM_H
13
14 #include <QtCore>
15
16 #include "abstractaudioscopewidget.h"
17 #include "ui_spectrogram_ui.h"
18 #include "ffttools.h"
19
20 class Spectrogram_UI;
21 class Spectrogram : public AbstractAudioScopeWidget {
22     Q_OBJECT
23
24 public:
25     Spectrogram(QWidget *parent = 0);
26     ~Spectrogram();
27
28     QString widgetName() const;
29
30 protected:
31     ///// Implemented methods /////
32     QRect scopeRect();
33     QImage renderHUD(uint accelerationFactor);
34     QImage renderAudioScope(uint accelerationFactor, const QVector<int16_t> audioFrame, const int freq, const int num_channels, const int num_samples);
35     QImage renderBackground(uint accelerationFactor);
36     bool isHUDDependingOnInput() const;
37     bool isScopeDependingOnInput() const;
38     bool isBackgroundDependingOnInput() const;
39     virtual void readConfig();
40     void writeConfig();
41
42 private:
43     Ui::Spectrogram_UI *ui;
44     FFTTools m_fftTools;
45
46     QList<QVector<float> > m_fftHistory;
47     QImage m_fftHistoryImg;
48
49     int m_dBmin;
50     int m_dBmax;
51
52     uint m_freqMax;
53     bool m_customFreq;
54
55     QRect m_innerScopeRect;
56 };
57
58 #endif // SPECTROGRAM_H