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 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 96 of file TrackArt.cpp.

97{
98 if (value == 0)
99 return 0;
100
101 double sign = (value >= 0 ? 1 : -1);
102 return DB_TO_LINEAR((fabs(value) * dBRange) - dBRange) * sign;
103}
#define DB_TO_LINEAR(x)
Definition: MemoryX.h:543

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

Todo:
Should this function move int GuiWaveTrack where it can then use the zoomMin, zoomMax and height values without having to have them passed in to it??

Definition at line 49 of file TrackArt.cpp.

52{
53 if (dB) {
54 if (height == 0) {
55 return 0;
56 }
57
58 float sign = (value >= 0 ? 1 : -1);
59
60 if (value != 0.) {
61 float db = LINEAR_TO_DB(fabs(value));
62 value = (db + dBr) / dBr;
63 if (!outer) {
64 value -= 0.5;
65 }
66 if (value < 0.0) {
67 value = 0.0;
68 }
69 value *= sign;
70 }
71 }
72 else {
73 if (!outer) {
74 if (value >= 0.0) {
75 value -= 0.5;
76 }
77 else {
78 value += 0.5;
79 }
80 }
81 }
82
83 if (clip) {
84 if (value < min) {
85 value = min;
86 }
87 if (value > max) {
88 value = max;
89 }
90 }
91
92 value = (max - value) / (max - min);
93 return (int) (value * (height - 1) + 0.5);
94}
static const wxPoint2DDouble outer[]
Definition: ASlider.cpp:397
int min(int a, int b)
#define LINEAR_TO_DB(x)
Definition: MemoryX.h:544

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 105 of file TrackArt.cpp.

107{
108 wxASSERT(height > 0);
109 // Map 0 to max and height - 1 (not height) to min
110 float v =
111 height == 1 ? (zoomMin + zoomMax) / 2 :
112 zoomMax - (yy / (float)(height - 1)) * (zoomMax - zoomMin);
113 if (offset) {
114 if (v > 0.0)
115 v += .5;
116 else
117 v -= .5;
118 }
119
120 if (dB)
121 v = FromDB(v, dBRange);
122
123 return v;
124}
float FromDB(float value, double dBRange)
Definition: TrackArt.cpp:96

References FromDB().

Referenced by SampleHandle::FindSampleEditingLevel().

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