]> git.sesse.net Git - kdenlive/blob - testingArea/audioEnvelope.h
Audio alignment works.
[kdenlive] / testingArea / audioEnvelope.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 AUDIOENVELOPE_H
12 #define AUDIOENVELOPE_H
13
14 #include "audioInfo.h"
15 #include <mlt++/Mlt.h>
16
17 class QImage;
18 class AudioEnvelope
19 {
20 public:
21     AudioEnvelope(Mlt::Producer *producer);
22     ~AudioEnvelope();
23
24     /// Returns the envelope, calculates it if necessary.
25     int64_t const* envelope();
26     int envelopeSize() const;
27
28     void loadEnvelope();
29     int64_t loadStdDev();
30     void normalizeEnvelope(bool clampTo0 = false);
31
32     QImage drawEnvelope();
33
34     void dumpInfo() const;
35
36 private:
37     int64_t *m_envelope;
38     Mlt::Producer *m_producer;
39     AudioInfo *m_info;
40
41     int m_envelopeSize;
42     int64_t m_envelopeMax;
43     int64_t m_envelopeMean;
44     int64_t m_envelopeStdDev;
45
46     bool m_envelopeStdDevCalculated;
47     bool m_envelopeIsNormalized;
48 };
49
50 #endif // AUDIOENVELOPE_H