1 /***************************************************************************
2 * Copyright (C) 2010 by Simon Andreas Eugster (simon.eu@gmail.com) *
3 * This file is part of kdenlive. See www.kdenlive.org. *
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 ***************************************************************************/
11 #ifndef AUDIOSPECTRUM_H
12 #define AUDIOSPECTRUM_H
16 #include "abstractaudioscopewidget.h"
17 #include "ui_audiospectrum_ui.h"
18 #include "tools/kiss_fftr.h"
20 class AudioSpectrum_UI;
22 class AudioSpectrum : public AbstractAudioScopeWidget {
26 AudioSpectrum(QWidget *parent = 0);
29 // Implemented virtual methods
30 QString widgetName() const;
32 static const QString directions[]; // Mainly for debug output
33 enum RescaleDirection { North, Northeast, East, Southeast };
34 enum RescaleDimension { Min_dB, Max_dB, Max_Hz };
38 ///// Implemented methods /////
40 QImage renderHUD(uint accelerationFactor);
41 QImage renderAudioScope(uint accelerationFactor, const QVector<int16_t> audioFrame, const int freq, const int num_channels, const int num_samples);
42 QImage renderBackground(uint accelerationFactor);
43 bool isHUDDependingOnInput() const;
44 bool isScopeDependingOnInput() const;
45 bool isBackgroundDependingOnInput() const;
46 virtual void readConfig();
49 void mouseMoveEvent(QMouseEvent *event);
50 void mousePressEvent(QMouseEvent *event);
51 void mouseReleaseEvent(QMouseEvent *event);
54 Ui::AudioSpectrum_UI *ui;
60 QActionGroup *m_agScale;
64 /** Lower bound for the dB value to display */
66 /** Upper bound (max: 0) */
69 /** Maximum frequency (depends on the sampling rate)
70 Stored for the HUD painter */
74 ///// Movement detection /////
75 const int m_rescaleMinDist;
76 const float m_rescaleVerticalThreshold;
79 bool m_rescalePropertiesLocked;
80 bool m_rescaleFirstRescaleDone;
82 Qt::KeyboardModifiers m_rescaleModifiers;
83 AudioSpectrum::RescaleDirection m_rescaleClockDirection;
84 QPoint m_rescaleStartPoint;
93 #endif // AUDIOSPECTRUM_H