Audacity 3.2.0
WaveformScale.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5WaveformScale.h
6
7Paul Licameli
8
9**********************************************************************/
10
11#ifndef __AUDACITY_WAVEFORM_SETTINGS__
12#define __AUDACITY_WAVEFORM_SETTINGS__
13
14#include "ClientData.h" // to inherit
15#include "Prefs.h"
16
17class wxRect;
18
19class WaveChannel;
20class WaveTrack;
21
22class AUDACITY_DLL_API WaveformScale
23 : public ClientData::Cloneable<>
24{
25public:
27 static WaveformScale &Get(const WaveTrack &track);
28
32 static WaveformScale &Get(const WaveChannel &channel);
33
34 ~WaveformScale() override;
35 PointerType Clone() const override;
36
37 int ZeroLevelYCoordinate(wxRect rect) const;
38
39 void GetDisplayBounds(float &min, float &max) const
40 { min = mDisplayMin; max = mDisplayMax; }
41
42 void SetDisplayBounds(float min, float max)
43 { mDisplayMin = min; mDisplayMax = max; }
44
45 float GetLastScaleType() const { return mLastScaleType; }
46 void SetLastScaleType(int type) { mLastScaleType = type; }
47
48 int GetLastDBRange() const { return mLastdBRange; }
49 void SetLastDBRange(int range) { mLastdBRange = range; }
50
51private:
52 float mDisplayMin = -1.0f, mDisplayMax = 1.0f;
53 int mLastScaleType = -1;
54 int mLastdBRange = -1;
55};
56
57#endif
Utility ClientData::Site to register hooks into a host class that attach client data.
int min(int a, int b)
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
void SetLastDBRange(int range)
Definition: WaveformScale.h:49
void GetDisplayBounds(float &min, float &max) const
Definition: WaveformScale.h:39
int GetLastDBRange() const
Definition: WaveformScale.h:48
void SetDisplayBounds(float min, float max)
Definition: WaveformScale.h:42
void SetLastScaleType(int type)
Definition: WaveformScale.h:46
~WaveformScale() override
float GetLastScaleType() const
Definition: WaveformScale.h:45
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:202
A convenient base class defining abstract virtual Clone() for a given kind of pointer.
Definition: ClientData.h:50
virtual PointerType Clone() const =0
Owner< Base > PointerType
Definition: ClientData.h:54