Audacity 3.2.0
Classes | Namespaces | Enumerations | Functions | Variables
TrackArt.cpp File Reference
#include "TrackArt.h"
#include "AColor.h"
#include "AllThemeResources.h"
#include "SelectedRegion.h"
#include "SyncLock.h"
#include "Theme.h"
#include "TimeAndPitchInterface.h"
#include "Track.h"
#include "TrackArtist.h"
#include "TrackPanelDrawingContext.h"
#include "ZoomInfo.h"
#include "TimeDisplayMode.h"
#include "ProjectTimeRuler.h"
#include "ProjectTimeSignature.h"
#include "widgets/BeatsFormat.h"
#include <wx/app.h>
#include <wx/dc.h>
#include <cassert>
#include <cstdint>
#include <cmath>
#include <utility>
Include dependency graph for TrackArt.cpp:

Go to the source code of this file.

Classes

struct  anonymous_namespace{TrackArt.cpp}::ClipTitle
 
struct  anonymous_namespace{TrackArt.cpp}::BeatsGridlinePainter
 

Namespaces

namespace  anonymous_namespace{TrackArt.cpp}
 

Enumerations

enum class  anonymous_namespace{TrackArt.cpp}::HAlign { anonymous_namespace{TrackArt.cpp}::left , anonymous_namespace{TrackArt.cpp}::right }
 

Functions

wxRect anonymous_namespace{TrackArt.cpp}::GetAffordanceTitleRect (const wxRect &rect)
 
int GetWaveYPos (float value, float min, float max, int height, bool dB, bool outer, float dBr, bool clip)
 
float FromDB (float value, double dBRange)
 
float ValueOfPixel (int yy, int height, bool offset, bool dB, double dBRange, float zoomMin, float zoomMax)
 
wxString anonymous_namespace{TrackArt.cpp}::GetPlaybackSpeedFullText (double clipStretchRatio)
 
std::optional< ClipTitle > anonymous_namespace{TrackArt.cpp}::DoDrawAudioTitle (wxDC &dc, const wxRect &titleRect, const wxString &title)
 

Variables

static constexpr int ClipSelectionStrokeSize { 1 }
 
constexpr double anonymous_namespace{TrackArt.cpp}::minSubdivisionWidth = 12.0
 

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()

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()

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:

Variable Documentation

◆ ClipSelectionStrokeSize

constexpr int ClipSelectionStrokeSize { 1 }
staticconstexpr