Audacity 3.2.0
DynamicRangeProcessorHistory.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 DynamicRangeProcessorHistory.h
7
8 Matthieu Hodgkinson
9
10**********************************************************************/
11#pragma once
12
14#include <memory>
15#include <optional>
16#include <vector>
17
18class DYNAMIC_RANGE_PROCESSOR_API DynamicRangeProcessorHistory final
19{
20public:
22
23 struct Packet
24 {
25 float time = 0.f;
26 float target = 0.f;
27 float follower = 0.f;
28 float input = 0.f;
29 float output = 0.f;
30 };
31
32 static constexpr auto maxTimeSeconds = 2.5f;
33
34 using Segment = std::vector<Packet>;
35
36 void Push(const std::vector<DynamicRangeProcessorOutputPacket>& packets);
37 void BeginNewSegment();
38 const std::vector<Segment>& GetSegments() const;
39 bool IsEmpty() const;
40
41private:
42 float GetPacketTime(const DynamicRangeProcessorOutputPacket& packet) const;
43
44 const double mSampleRate;
45 bool mBeginNewSegment = true;
46 std::vector<Segment> mSegments;
47 std::optional<long long> mFirstPacketFirstSampleIndex;
48 std::optional<long long> mExpectedNextPacketFirstSampleIndex;
49};
50
std::optional< long long > mFirstPacketFirstSampleIndex
std::optional< long long > mExpectedNextPacketFirstSampleIndex