Audacity 3.2.0
MeterPanelBase.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5MeterPanelBase.h
6
7Paul Licameli split from MeterPanel.h
8
9**********************************************************************/
10
11#ifndef __AUDACITY_METER_PANEL_BASE__
12#define __AUDACITY_METER_PANEL_BASE__
13
14#include <utility>
15#include "wxPanelWrapper.h"
16
17class Meter;
18
20
25class AUDACITY_DLL_API MeterPanelBase /* not final */
26 : public wxPanelWrapper
27{
28public:
30 ~MeterPanelBase() override;
31
32 template< typename ...Args >
33 MeterPanelBase( Args &&...args )
34 : wxPanelWrapper( std::forward<Args>(args)... )
35 { Init(); }
36
37 std::shared_ptr<Meter> GetMeter() const;
38
39 virtual void Clear() = 0;
40 virtual void Reset(double sampleRate, bool resetClipping) = 0;
41 virtual void UpdateDisplay(unsigned numChannels,
42 int numFrames, const float *sampleData) = 0;
43 virtual bool IsMeterDisabled() const = 0;
44 virtual float GetMaxPeak() const = 0;
45 virtual bool IsClipping() const = 0;
46 virtual int GetDBRange() const = 0;
47
48private:
49 static bool s_AcceptsFocus;
50 struct Resetter { void operator () (bool *p) const { if(p) *p = false; } };
51 using TempAllowFocus = std::unique_ptr<bool, Resetter>;
52
53 bool AcceptsFocus() const override { return s_AcceptsFocus; }
54 bool AcceptsFocusFromKeyboard() const override { return true; }
55
56public:
57 static TempAllowFocus TemporarilyAllowFocus();
58
59private:
60 void Init();
61
62 struct Forwarder;
63 std::shared_ptr<Forwarder> mForwarder;
64};
65
66#endif
AudioIO uses this to send sample buffers for real-time display updates.
Definition: Meter.h:16
Inherits wxPanel and has a Meter; exposes shared_ptr to the Meter.
virtual bool IsClipping() const =0
virtual bool IsMeterDisabled() const =0
std::shared_ptr< Forwarder > mForwarder
virtual int GetDBRange() const =0
virtual void UpdateDisplay(unsigned numChannels, int numFrames, const float *sampleData)=0
bool AcceptsFocusFromKeyboard() const override
virtual void Clear()=0
MeterPanelBase(Args &&...args)
~MeterPanelBase() override
virtual float GetMaxPeak() const =0
static bool s_AcceptsFocus
bool AcceptsFocus() const override
std::unique_ptr< bool, Resetter > TempAllowFocus
virtual void Reset(double sampleRate, bool resetClipping)=0
STL namespace.