1 /***************************************************************************
2 * Copyright (C) 2012 by Simon Andreas Eugster (simon.eu@gmail.com) *
3 * This file is part of kdenlive. See www.kdenlive.org. *
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 ***************************************************************************/
11 #ifndef AUDIOENVELOPE_H
12 #define AUDIOENVELOPE_H
14 #include "audioInfo.h"
15 #include <mlt++/Mlt.h>
20 The audio envelope is a simplified version of an audio track
21 with frame resolution. One entry is calculated by the sum
22 of the absolute values of all samples in the current frame.
24 See also: http://bemasc.net/wordpress/2011/07/26/an-auto-aligner-for-pitivi/
29 explicit AudioEnvelope(const QString &url, Mlt::Producer *producer, int offset = 0, int length = 0);
32 /// Returns the envelope, calculates it if necessary.
33 int64_t const* envelope();
34 int envelopeSize() const;
35 int64_t maxValue() const;
39 void normalizeEnvelope(bool clampTo0 = false);
41 QImage drawEnvelope();
43 void dumpInfo() const;
47 Mlt::Producer *m_producer;
54 int64_t m_envelopeMax;
55 int64_t m_envelopeMean;
56 int64_t m_envelopeStdDev;
58 bool m_envelopeStdDevCalculated;
59 bool m_envelopeIsNormalized;
62 #endif // AUDIOENVELOPE_H