X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Faudioscopes%2Faudiospectrum.h;h=77308afa98e21f50cb1fb208ed708c9c39694c81;hb=6ee97189c48f7e8271aa04fb34b650c1ae1037d2;hp=9ab399160f89b669aaff419ebdcf86af38da2ba9;hpb=97a640560f43d7f72c783c80ddf4fed419c4adb2;p=kdenlive diff --git a/src/audioscopes/audiospectrum.h b/src/audioscopes/audiospectrum.h index 9ab39916..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; @@ -50,18 +56,22 @@ protected: virtual void readConfig(); void writeConfig(); - virtual void handleMouseDrag(const QPoint movement, const RescaleDirection rescaleDirection, const Qt::KeyboardModifiers rescaleModifiers); + 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; @@ -72,24 +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; - /** This is linear interpolation with the special property that it preserves peaks, which is required - for e.g. showing correct Decibel values (where the peak values are of interest). - Consider f = {0, 100, 0} - x = {0.5, 1.5}: With default linear interpolation x0 and x1 would both be mapped to 50. - This function maps x1 (the first position after the peak) to 100. - - @param in The source vector containing the data - @param targetSize Number of interpolation nodes between ... - @param left the left array index in the in-vector and ... - @param right the right array index (both inclusive). - @param fill If right lies outside of the array bounds (which is perfectly fine here) then this value - will be used for filling the missing information. - */ - static const QVector interpolatePeakPreserving(const QVector in, const uint targetSize, uint left = 0, uint right = 0, float fill = 0.0); + float colorizeFactor; + +#ifdef DEBUG_AUDIOSPEC + long m_timeTotal; + long m_showTotal; +#endif private slots: