Audacity 3.2.0
Namespaces | Functions | Variables
TrackArt.h File Reference
#include <wx/types.h>
Include dependency graph for TrackArt.h:
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 &clipRect, bool highlight=false, bool selected=false)
 
AUDACITY_DLL_API bool TrackArt::DrawClipTitle (wxDC &dc, const wxRect &affordanceRect, 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 Channel &channel, 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 void TrackArt::DrawSnapLines (wxDC *dc, wxInt64 snap0, wxInt64 snap1)
 
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 113 of file TrackArt.cpp.

114{
115 if (value == 0)
116 return 0;
117
118 double sign = (value >= 0 ? 1 : -1);
119 return DB_TO_LINEAR((fabs(value) * dBRange) - dBRange) * sign;
120}
#define DB_TO_LINEAR(x)
Definition: MemoryX.h:338

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

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

References LINEAR_TO_DB, min(), and outer.

Referenced by anonymous_namespace{WaveformView.cpp}::DrawEnvelope(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), 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 122 of file TrackArt.cpp.

124{
125 wxASSERT(height > 0);
126 // Map 0 to max and height - 1 (not height) to min
127 float v =
128 height == 1 ? (zoomMin + zoomMax) / 2 :
129 zoomMax - (yy / (float)(height - 1)) * (zoomMax - zoomMin);
130 if (offset) {
131 if (v > 0.0)
132 v += .5;
133 else
134 v -= .5;
135 }
136
137 if (dB)
138 v = FromDB(v, dBRange);
139
140 return v;
141}
float FromDB(float value, double dBRange)
Definition: TrackArt.cpp:113

References FromDB().

Referenced by SampleHandle::FindSampleEditingLevel().

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