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 ***************************************************************************/
12 Displays a spectral power distribution of audio samples.
13 The frequency distribution is calculated by means of a Fast Fourier Transformation.
14 For more information see Wikipedia:FFT and the code comments.
17 #ifndef AUDIOSPECTRUM_H
18 #define AUDIOSPECTRUM_H
24 #include "abstractaudioscopewidget.h"
25 #include "ui_audiospectrum_ui.h"
26 #include "tools/kiss_fftr.h"
29 class AudioSpectrum_UI;
30 class AudioSpectrum : public AbstractAudioScopeWidget {
34 AudioSpectrum(QWidget *parent = 0);
37 // Implemented virtual methods
38 QString widgetName() const;
42 ///// Implemented methods /////
44 QImage renderHUD(uint accelerationFactor);
45 QImage renderAudioScope(uint accelerationFactor, const QVector<int16_t> audioFrame, const int freq, const int num_channels, const int num_samples, const int newData);
46 QImage renderBackground(uint accelerationFactor);
47 bool isHUDDependingOnInput() const;
48 bool isScopeDependingOnInput() const;
49 bool isBackgroundDependingOnInput() const;
50 virtual void readConfig();
53 virtual void handleMouseDrag(const QPoint movement, const RescaleDirection rescaleDirection, const Qt::KeyboardModifiers rescaleModifiers);
56 Ui::AudioSpectrum_UI *ui;
62 /** Contains the plot only; m_scopeRect contains text and widgets as well */
63 QRect m_innerScopeRect;
65 /** Lower bound for the dB value to display */
67 /** Upper bound (max: 0) */
70 /** Maximum frequency (limited by the sampling rate if determined automatically).
71 Stored for the painters. */
73 /** The user has chosen a custom frequency. */
79 void slotResetMaxFreq();
83 #endif // AUDIOSPECTRUM_H