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