]> git.sesse.net Git - kdenlive/blob - src/audioscopes/ffttools.h
Audio scopes: Caching window functions for better performance
[kdenlive] / src / audioscopes / ffttools.h
1 /***************************************************************************
2  *   Copyright (C) 2010 by Simon Andreas Eugster (simon.eu@gmail.com)      *
3  *   This file is part of kdenlive. See www.kdenlive.org.                  *
4  *                                                                         *
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  ***************************************************************************/
10
11 #ifndef FFTTOOLS_H
12 #define FFTTOOLS_H
13
14 #include <QVector>
15
16 class FFTTools
17 {
18 public:
19     FFTTools();
20
21     enum WindowType { Window_Rect, Window_Triangle, Window_Hamming };
22
23     /** Creates a vector containing the factors for the selected window functions.
24         The last element in the vector (at position size+1) contains the area of
25         this window function compared to the rectangular window (e.g. for a triangular
26         window the factor will be 0.5).
27         Knowing this factor is important for the Fourier Transformation as the
28         values in the frequency domain will be scaled by this factor and need to be
29         re-scaled for proper dB display.
30         The additional parameter describes:
31         * Nothing for the Rectangular window
32         * The left and right start values for the Triangular window (i.e. ranges between param and 1;
33           default is 0)
34         * Nothing for the Hamming window
35     */
36     static const QVector<float> window(const WindowType windowType, const int size, const float param);
37
38     static const QString windowSignature(const WindowType windowType, const int size, const float param);
39
40 };
41
42 #endif // FFTTOOLS_H