Audacity 3.2.0
Namespaces | Functions | Variables
TrackArt.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  TrackArt
 

Functions

AUDACITY_DLL_API wxRect TrackArt::DrawClipAffordance (wxDC &dc, const wxRect &affordanceRect, bool highlight=false, bool selected=false)
 
AUDACITY_DLL_API bool TrackArt::DrawClipTitle (wxDC &dc, const wxRect &titleRect, const wxString &title)
 
AUDACITY_DLL_API bool TrackArt::DrawAudioClipTitle (wxDC &dc, const wxRect &titleRect, const wxString &title, double clipStretchRatio)
 
AUDACITY_DLL_API void TrackArt::DrawClipEdges (wxDC &dc, const wxRect &clipRect, bool selected=false)
 
AUDACITY_DLL_API void TrackArt::DrawClipFolded (wxDC &dc, const wxRect &rect)
 
AUDACITY_DLL_API void TrackArt::DrawSyncLockTiles (TrackPanelDrawingContext &context, const wxRect &rect)
 
AUDACITY_DLL_API void TrackArt::DrawBackgroundWithSelection (TrackPanelDrawingContext &context, const wxRect &rect, const Track *track, const wxBrush &selBrush, const wxBrush &unselBrush, bool useSelection=true)
 
AUDACITY_DLL_API void TrackArt::DrawCursor (TrackPanelDrawingContext &context, const wxRect &rect, const Track *track)
 
AUDACITY_DLL_API void TrackArt::DrawNegativeOffsetTrackArrows (TrackPanelDrawingContext &context, const wxRect &rect)
 
AUDACITY_DLL_API wxString TrackArt::TruncateText (wxDC &dc, const wxString &text, const int maxWidth)
 
AUDACITY_DLL_API int GetWaveYPos (float value, float min, float max, int height, bool dB, bool outer, float dBr, bool clip)
 
float FromDB (float value, double dBRange)
 
AUDACITY_DLL_API float ValueOfPixel (int yy, int height, bool offset, bool dB, double dBRange, float zoomMin, float zoomMax)
 

Variables

static constexpr int TrackArt::ClipFrameRadius { 6 }
 

Function Documentation

◆ FromDB()

float FromDB ( float  value,
double  dBRange 
)

Definition at line 106 of file TrackArt.cpp.

107{
108 if (value == 0)
109 return 0;
110
111 double sign = (value >= 0 ? 1 : -1);
112 return DB_TO_LINEAR((fabs(value) * dBRange) - dBRange) * sign;
113}
#define DB_TO_LINEAR(x)
Definition: MemoryX.h:561

References DB_TO_LINEAR.

Referenced by ValueOfPixel().

Here is the caller graph for this function:

◆ GetWaveYPos()

AUDACITY_DLL_API int GetWaveYPos ( float  value,
float  min,
float  max,
int  height,
bool  dB,
bool  outer,
float  dBr,
bool  clip 
)

Takes a value between min and max and returns a value between height and 0

Definition at line 59 of file TrackArt.cpp.

62{
63 if (dB) {
64 if (height == 0) {
65 return 0;
66 }
67
68 float sign = (value >= 0 ? 1 : -1);
69
70 if (value != 0.) {
71 float db = LINEAR_TO_DB(fabs(value));
72 value = (db + dBr) / dBr;
73 if (!outer) {
74 value -= 0.5;
75 }
76 if (value < 0.0) {
77 value = 0.0;
78 }
79 value *= sign;
80 }
81 }
82 else {
83 if (!outer) {
84 if (value >= 0.0) {
85 value -= 0.5;
86 }
87 else {
88 value += 0.5;
89 }
90 }
91 }
92
93 if (clip) {
94 if (value < min) {
95 value = min;
96 }
97 if (value > max) {
98 value = max;
99 }
100 }
101
102 value = (max - value) / (max - min);
103 return (int) (value * (height - 1) + 0.5);
104}
static const wxPoint2DDouble outer[]
Definition: ASlider.cpp:397
int min(int a, int b)
#define LINEAR_TO_DB(x)
Definition: MemoryX.h:562

References LINEAR_TO_DB, min(), and outer.

Referenced by anonymous_namespace{WaveformView.cpp}::DrawEnvelope(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), anonymous_namespace{WaveformView.cpp}::DrawMinMaxRMS(), EnvelopeEditor::DrawPoints(), anonymous_namespace{WaveformView.cpp}::DrawWaveformBackground(), EnvelopeEditor::HandleMouseButtonDown(), EnvelopeHandle::HitEnvelope(), and SampleHandle::HitTest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ValueOfPixel()

AUDACITY_DLL_API float ValueOfPixel ( int  yy,
int  height,
bool  offset,
bool  dB,
double  dBRange,
float  zoomMin,
float  zoomMax 
)

Definition at line 115 of file TrackArt.cpp.

117{
118 wxASSERT(height > 0);
119 // Map 0 to max and height - 1 (not height) to min
120 float v =
121 height == 1 ? (zoomMin + zoomMax) / 2 :
122 zoomMax - (yy / (float)(height - 1)) * (zoomMax - zoomMin);
123 if (offset) {
124 if (v > 0.0)
125 v += .5;
126 else
127 v -= .5;
128 }
129
130 if (dB)
131 v = FromDB(v, dBRange);
132
133 return v;
134}
float FromDB(float value, double dBRange)
Definition: TrackArt.cpp:106

References FromDB().

Referenced by SampleHandle::FindSampleEditingLevel().

Here is the call graph for this function:
Here is the caller graph for this function: