File indexing completed on 2024-04-28 04:51:59
0001 /* 0002 SPDX-FileCopyrightText: 2012 Simon Andreas Eugster <simon.eu@gmail.com> 0003 This file is part of kdenlive. See www.kdenlive.org. 0004 0005 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 #pragma once 0009 0010 #include <QImage> 0011 0012 #include <sys/types.h> 0013 0014 /** 0015 This class holds the correlation of two audio samples. 0016 It is mainly a container for data, the correlation itself is calculated 0017 in the class AudioCorrelation. 0018 */ 0019 class AudioCorrelationInfo 0020 { 0021 public: 0022 AudioCorrelationInfo(size_t mainSize, size_t subSize); 0023 ~AudioCorrelationInfo(); 0024 0025 size_t size() const; 0026 qint64 *correlationVector(); 0027 qint64 const *correlationVector() const; 0028 0029 /** 0030 Returns the maximum value in the correlation vector. 0031 If it has not been set before with setMax(), it will be calculated. 0032 */ 0033 qint64 max() const; 0034 void setMax(qint64 max); ///< Can be set to avoid calculating the max again in this function 0035 0036 /** 0037 Returns the index of the largest value in the correlation vector 0038 */ 0039 size_t maxIndex() const; 0040 0041 QImage toImage(size_t height = 400) const; 0042 0043 private: 0044 size_t m_mainSize; 0045 size_t m_subSize; 0046 0047 qint64 *m_correlationVector; 0048 qint64 m_max; 0049 };