X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Faudioscopes%2Faudiospectrum.h;h=77308afa98e21f50cb1fb208ed708c9c39694c81;hb=634e5785b160bbd16d73a7f9b149236b2fd24fed;hp=e3e2498ece4a19e5ef553a79addda77b22e5efb2;hpb=893498c6ea67208b800b6ae0c354ba1f5641edc2;p=kdenlive diff --git a/src/audioscopes/audiospectrum.h b/src/audioscopes/audiospectrum.h index e3e2498e..77308afa 100644 --- a/src/audioscopes/audiospectrum.h +++ b/src/audioscopes/audiospectrum.h @@ -17,13 +17,19 @@ #ifndef AUDIOSPECTRUM_H #define AUDIOSPECTRUM_H +// Enables debugging +//#define DEBUG_AUDIOSPEC + +// Show overmodulation +#define DETECT_OVERMODULATION + #include #include #include #include "abstractaudioscopewidget.h" #include "ui_audiospectrum_ui.h" -#include "tools/kiss_fftr.h" +#include "kiss_fft/tools/kiss_fftr.h" #include "ffttools.h" class AudioSpectrum_UI; @@ -37,16 +43,12 @@ public: // Implemented virtual methods QString widgetName() const; - static const QString directions[]; // Mainly for debug output - enum RescaleDirection { North, Northeast, East, Southeast }; - enum RescaleDimension { Min_dB, Max_dB, Max_Hz }; - protected: ///// Implemented methods ///// QRect scopeRect(); QImage renderHUD(uint accelerationFactor); - QImage renderAudioScope(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, const int newData); QImage renderBackground(uint accelerationFactor); bool isHUDDependingOnInput() const; bool isScopeDependingOnInput() const; @@ -54,16 +56,21 @@ protected: virtual void readConfig(); void writeConfig(); - void mouseMoveEvent(QMouseEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); + virtual void handleMouseDrag(const QPoint &movement, const RescaleDirection rescaleDirection, const Qt::KeyboardModifiers rescaleModifiers); private: Ui::AudioSpectrum_UI *ui; QAction *m_aResetHz; + QAction *m_aTrackMouse; + QAction *m_aShowMax; FFTTools m_fftTools; + QVector m_lastFFT; + QSemaphore m_lastFFTLock; + + QVector m_peaks; + QVector m_peakMap; /** Contains the plot only; m_scopeRect contains text and widgets as well */ QRect m_innerScopeRect; @@ -75,28 +82,16 @@ private: /** Maximum frequency (limited by the sampling rate if determined automatically). Stored for the painters. */ - uint m_freqMax; + int m_freqMax; /** The user has chosen a custom frequency. */ bool m_customFreq; + float colorizeFactor; - /** Returns a signature for a kiss_fft configuration - used as a hash in the cache */ - static const QString cfgSignature(const int size); - - - ///// Movement detection ///// - const int m_rescaleMinDist; - const float m_rescaleVerticalThreshold; - - bool m_rescaleActive; - bool m_rescalePropertiesLocked; - bool m_rescaleFirstRescaleDone; - short m_rescaleScale; - Qt::KeyboardModifiers m_rescaleModifiers; - AudioSpectrum::RescaleDirection m_rescaleClockDirection; - QPoint m_rescaleStartPoint; - +#ifdef DEBUG_AUDIOSPEC + long m_timeTotal; + long m_showTotal; +#endif private slots: