X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Faudioscopes%2Faudiospectrum.h;h=b159f682993a08164e19b3907a90794d27abc396;hb=062997dba4bf4cd216f3ab855995c16b275c655c;hp=a70ab0ca3902b568d607f30ff62889ad9870a0e3;hpb=db2025fcae30800f798975dedc94c951c7b51a93;p=kdenlive diff --git a/src/audioscopes/audiospectrum.h b/src/audioscopes/audiospectrum.h index a70ab0ca..b159f682 100644 --- a/src/audioscopes/audiospectrum.h +++ b/src/audioscopes/audiospectrum.h @@ -1,35 +1,83 @@ +/*************************************************************************** + * Copyright (C) 2010 by Simon Andreas Eugster (simon.eu@gmail.com) * + * This file is part of kdenlive. See www.kdenlive.org. * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +/** + Displays a spectral power distribution of audio samples. + The frequency distribution is calculated by means of a Fast Fourier Transformation. + For more information see Wikipedia:FFT and the code comments. +*/ + #ifndef AUDIOSPECTRUM_H #define AUDIOSPECTRUM_H #include +#include +#include #include "abstractaudioscopewidget.h" #include "ui_audiospectrum_ui.h" +#include "tools/kiss_fftr.h" +#include "ffttools.h" class AudioSpectrum_UI; - class AudioSpectrum : public AbstractAudioScopeWidget { Q_OBJECT public: - AudioSpectrum(Monitor *projMonitor, Monitor *clipMonitor, QWidget *parent = 0); + AudioSpectrum(QWidget *parent = 0); + ~AudioSpectrum(); // Implemented virtual methods QString widgetName() const; + protected: ///// Implemented methods ///// QRect scopeRect(); QImage renderHUD(uint accelerationFactor); - QImage renderScope(uint accelerationFactor, const QVector audioFrame, const int freq, const int num_channels, const int num_samples); + QImage renderAudioScope(uint accelerationFactor, const QVector audioFrame, const int freq, const int num_channels, const int num_samples); QImage renderBackground(uint accelerationFactor); bool isHUDDependingOnInput() const; bool isScopeDependingOnInput() const; bool isBackgroundDependingOnInput() const; virtual void readConfig(); + void writeConfig(); + + virtual void handleMouseDrag(const QPoint movement, const RescaleDirection rescaleDirection, const Qt::KeyboardModifiers rescaleModifiers); private: Ui::AudioSpectrum_UI *ui; + + QAction *m_aResetHz; + + FFTTools m_fftTools; + + /** Contains the plot only; m_scopeRect contains text and widgets as well */ + QRect m_innerScopeRect; + + /** Lower bound for the dB value to display */ + int m_dBmin; + /** Upper bound (max: 0) */ + int m_dBmax; + + /** Maximum frequency (limited by the sampling rate if determined automatically). + Stored for the painters. */ + uint m_freqMax; + /** The user has chosen a custom frequency. */ + bool m_customFreq; + + + +private slots: + void slotResetMaxFreq(); + }; #endif // AUDIOSPECTRUM_H