Audacity 3.2.0
DownwardMeterValueProvider.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 DownwardMeterValueProvider.h
7
8 Matthieu Hodgkinson
9
10**********************************************************************/
11#pragma once
12
14#include "MeterValueProvider.h"
15#include <memory>
16#include <utility>
17#include <vector>
18
19class DYNAMIC_RANGE_PROCESSOR_API DownwardMeterValueProvider :
21{
22public:
23 DownwardMeterValueProvider(float upperValue = 0.f);
25 void Update(float value, bool alsoFiveSecondMax) override;
26 float GetGlobalMax() const override;
27 float GetFiveSecMax() const override;
28 float GetCurrentMax() const override;
29 Direction GetDirection() const override;
30 bool IsInvisible() const override;
31
32private:
36 static constexpr auto displayDelayMs = 100;
37 static constexpr auto ringBufferLength =
38 displayDelayMs / compressorMeterUpdatePeriodMs;
39
40 const float mUpperValue;
44 std::vector<std::pair<int /*tick count*/, float>> mLastFiveSeconds;
45 std::array<float, ringBufferLength> mRingBuffer;
46 size_t mRingBufferIndex = 0;
47 int mTimerCount = 0;
48};
static constexpr auto compressorMeterUpdatePeriodMs
std::array< float, ringBufferLength > mRingBuffer
std::vector< std::pair< int, float > > mLastFiveSeconds
~DownwardMeterValueProvider()=default
virtual bool IsInvisible() const =0
virtual float GetCurrentMax() const =0
virtual void Update(float value, bool alsoFiveSecondMax)=0
virtual float GetGlobalMax() const =0
virtual float GetFiveSecMax() const =0
virtual Direction GetDirection() const =0