]> git.sesse.net Git - kdenlive/blob - src/lib/audio/audioCorrelationInfo.h
4d8416bf54d8547cc3e42534357d5734a6c84a14
[kdenlive] / src / lib / audio / audioCorrelationInfo.h
1 /***************************************************************************
2  *   Copyright (C) 2012 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 AUDIOCORRELATIONINFO_H
12 #define AUDIOCORRELATIONINFO_H
13
14 #include <QImage>
15
16 /**
17   This class holds the correlation of two audio samples.
18   It is mainly a container for data, the correlation itself is calculated
19   in the class AudioCorrelation.
20   */
21 class AudioCorrelationInfo
22 {
23 public:
24     AudioCorrelationInfo(int mainSize, int subSize);
25     ~AudioCorrelationInfo();
26
27     int size() const;
28     int64_t* correlationVector();
29     int64_t const* correlationVector() const;
30
31     /**
32       Returns the maximum value in the correlation vector.
33       If it has not been set before with setMax(), it will be calculated.
34       */
35     int64_t max() const;
36     void setMax(int64_t max); ///< Can be set to avoid calculating the max again in this function
37
38     /**
39       Returns the index of the largest value in the correlation vector
40       */
41     int maxIndex() const;
42
43     QImage toImage(int height = 400) const;
44
45 private:
46     int m_mainSize;
47     int m_subSize;
48
49     int64_t *m_correlationVector;
50     int64_t m_max;
51
52 };
53
54 #endif // AUDIOCORRELATIONINFO_H