Audacity 3.2.0
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
TrackArtist Class Referencefinal

This class handles the actual rendering of WaveTracks (both waveforms and spectra), NoteTracks, LabelTracks and TimeTracks. More...

#include <TrackArtist.h>

Inheritance diagram for TrackArtist:
[legend]
Collaboration diagram for TrackArtist:
[legend]

Public Types

enum  : unsigned {
  PassTracks , PassMargins , PassBorders , PassControls ,
  PassZooming , PassBackground , PassFocus , PassSnapping ,
  NPasses
}
 

Public Member Functions

 TrackArtist (TrackPanel *parent_)
 
 ~TrackArtist ()
 
void SetColours (int iColorIndex)
 
void UpdatePrefs () override
 

Static Public Member Functions

static TrackArtistGet (TrackPanelDrawingContext &)
 

Public Attributes

TrackPanelparent
 
float mdBrange
 
int mSampleDisplay
 
wxBrush blankBrush
 
wxBrush unselectedBrush
 
wxBrush selectedBrush
 
wxBrush sampleBrush
 
wxBrush selsampleBrush
 
wxBrush dragsampleBrush
 
wxBrush muteSampleBrush
 
wxBrush blankSelectedBrush
 
wxBrush envelopeBackgroundBrush
 
wxBrush clipAffordanceBackgroundBrush
 
wxBrush clipAffordanceBackgroundSelBrush
 
wxPen blankPen
 
wxPen unselectedPen
 
wxPen selectedPen
 
wxPen samplePen
 
wxPen rmsPen
 
wxPen muteRmsPen
 
wxPen selsamplePen
 
wxPen muteSamplePen
 
wxPen odProgressNotYetPen
 
wxPen odProgressDonePen
 
wxPen clippedPen
 
wxPen muteClippedPen
 
wxPen blankSelectedPen
 
wxPen beatSepearatorPen [2]
 
wxPen barSepearatorPen [2]
 
wxBrush beatStrongBrush [2]
 
wxBrush beatWeakBrush [2]
 
wxBrush beatStrongSelBrush [2]
 
wxBrush beatWeakSelBrush [2]
 
const SelectedRegionpSelectedRegion {}
 
ZoomInfopZoomInfo {}
 
const PendingTrackspPendingTracks {}
 
bool drawEnvelope { false }
 
bool bigPoints { false }
 
bool drawSliders { false }
 
bool onBrushTool { false }
 
bool hasSolo { false }
 

Additional Inherited Members

- Private Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 
virtual void UpdateSelectedPrefs (int id)
 
- Static Private Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 

Detailed Description

This class handles the actual rendering of WaveTracks (both waveforms and spectra), NoteTracks, LabelTracks and TimeTracks.

It's actually a little harder than it looks, because for waveforms at least it needs to cache the samples that are currently on-screen.

How Audacity Redisplay Works
Roger Dannenberg

Oct 2010
In my opinion, the bitmap should contain only the waveform, note, and label images along with gray selection highlights. The track info (sliders, buttons, title, etc.), track selection highlight, cursor, and indicator should be drawn in the normal way, and clipping regions should be used to avoid excessive copying of bitmaps (say, when sliders move), or excessive redrawing of track info widgets (say, when scrolling occurs). This is a fairly tricky code change since it requires careful specification of what and where redraw should take place when any state changes. One surprising finding is that NoteTrack display is slow compared to WaveTrack display. Each note takes some time to gather attributes and select colors, and while audio draws two amplitudes per horizontal pixels, large MIDI scores can have more notes than horizontal pixels. This can make slider changes very sluggish, but this can also be a problem with many audio tracks.

Definition at line 40 of file TrackArtist.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : unsigned
Enumerator
PassTracks 
PassMargins 
PassBorders 
PassControls 
PassZooming 
PassBackground 
PassFocus 
PassSnapping 
NPasses 

Definition at line 44 of file TrackArtist.h.

Constructor & Destructor Documentation

◆ TrackArtist()

TrackArtist::TrackArtist ( TrackPanel parent_)

Definition at line 66 of file TrackArtist.cpp.

67 : parent( parent_ )
68{
70 mSampleDisplay = 1;// Stem plots by default.
71
72 SetColours(0);
73
75}
IntSetting DecibelScaleCutoff
Negation of this value is the lowest dB level that should be shown in dB scales.
Definition: Decibels.cpp:12
const T & GetDefault() const
Definition: Prefs.h:199
float mdBrange
Definition: TrackArtist.h:68
TrackPanel * parent
Definition: TrackArtist.h:65
void SetColours(int iColorIndex)
Definition: TrackArtist.cpp:86
int mSampleDisplay
Definition: TrackArtist.h:69
void UpdatePrefs() override

References DecibelScaleCutoff, Setting< T >::GetDefault(), mdBrange, mSampleDisplay, SetColours(), and UpdatePrefs().

Here is the call graph for this function:

◆ ~TrackArtist()

TrackArtist::~TrackArtist ( )

Definition at line 77 of file TrackArtist.cpp.

78{
79}

Member Function Documentation

◆ Get()

TrackArtist * TrackArtist::Get ( TrackPanelDrawingContext context)
static

Definition at line 81 of file TrackArtist.cpp.

82{
83 return static_cast< TrackArtist* >( context.pUserData );
84}
This class handles the actual rendering of WaveTracks (both waveforms and spectra),...
Definition: TrackArtist.h:40

References TrackPanelDrawingContext::pUserData.

Referenced by SpectrumView::DoDraw(), WaveformView::DoDraw(), LabelTrackView::Draw(), anonymous_namespace{TrackPanel.cpp}::LabeledChannelGroup::Draw(), TrackPanelResizerCell::Draw(), NoteTrackAffordanceControls::Draw(), NoteTrackView::Draw(), NoteTrackVRulerControls::Draw(), HighlitClipButtonHandle::Draw(), SpectrumView::Draw(), WaveformView::Draw(), WaveTrackAffordanceControls::Draw(), TimeTrackView::Draw(), TrackArt::DrawBackgroundWithSelection(), WaveChannelSubView::DrawBoldBoundaries(), anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), TrackArt::DrawCursor(), anonymous_namespace{TimeTrackView.cpp}::DrawHorzRulerAndCurve(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), anonymous_namespace{NoteTrackView.cpp}::DrawNoteBackground(), anonymous_namespace{NoteTrackView.cpp}::DrawNoteTrack(), EnvelopeEditor::DrawPoints(), anonymous_namespace{TimeTrackView.cpp}::DrawTimeTrack(), anonymous_namespace{WaveformView.cpp}::DrawWaveform(), anonymous_namespace{WaveformView.cpp}::DrawWaveformBackground(), anonymous_namespace{WaveTrackControls.cpp}::PanSliderDrawFunction(), anonymous_namespace{NoteTrackControls.cpp}::VelocitySliderDrawFunction(), and anonymous_namespace{WaveTrackControls.cpp}::VolumeSliderDrawFunction().

Here is the caller graph for this function:

◆ SetColours()

void TrackArtist::SetColours ( int  iColorIndex)

Definition at line 86 of file TrackArtist.cpp.

87{
94 theTheme.SetBrushColour( blankSelectedBrush, clrBlankSelected);
95 theTheme.SetBrushColour( envelopeBackgroundBrush, clrEnvelopeBackground);
98
99 theTheme.SetPenColour( blankPen, clrBlank);
100 theTheme.SetPenColour( unselectedPen, clrUnselected);
101 theTheme.SetPenColour( selectedPen, clrSelected);
102 theTheme.SetPenColour( muteSamplePen, clrMuteSample);
103 theTheme.SetPenColour( odProgressDonePen, clrProgressDone);
104 theTheme.SetPenColour( odProgressNotYetPen, clrProgressNotYet);
105 theTheme.SetPenColour( clippedPen, clrClipped);
106 theTheme.SetPenColour( muteClippedPen, clrMuteClipped);
107 theTheme.SetPenColour( blankSelectedPen,clrBlankSelected);
108
109 theTheme.SetPenColour( selsamplePen, clrSelSample);
110 theTheme.SetPenColour( muteRmsPen, clrMuteRms);
111
112 theTheme.SetPenColour( beatSepearatorPen[0], clrBeatSeparatorPen );
113 theTheme.SetPenColour( beatSepearatorPen[1], clrBeatSeparatorPen );
114 theTheme.SetPenColour( barSepearatorPen[0], clrBarSeparatorPen );
115 theTheme.SetPenColour( barSepearatorPen[1], clrBarSeparatorPen );
116 theTheme.SetBrushColour( beatStrongBrush[0], clrBeatFillStrongBrush );
117 theTheme.SetBrushColour( beatStrongBrush[1], clrBeatFillStrongBrush );
118 theTheme.SetBrushColour( beatWeakBrush[0], clrBeatFillWeakBrush );
119 theTheme.SetBrushColour( beatWeakBrush[1], clrBeatFillWeakBrush );
120 theTheme.SetBrushColour( beatStrongSelBrush[0], clrBeatFillStrongSelBrush );
121 theTheme.SetBrushColour( beatStrongSelBrush[1], clrBeatFillStrongSelBrush );
122 theTheme.SetBrushColour( beatWeakSelBrush[0], clrBeatFillWeakSelBrush );
123 theTheme.SetBrushColour( beatWeakSelBrush[1], clrBeatFillWeakSelBrush );
124
133
134 switch( iColorIndex %4 )
135 {
136 default:
137 case 0:
138 theTheme.SetPenColour( samplePen, clrSample);
139 theTheme.SetPenColour( rmsPen, clrRms);
140 break;
141 case 1: // RED
142 theTheme.SetPenColour( samplePen, clrSample2);
143 theTheme.SetPenColour( rmsPen, clrRms2);
144 break;
145 case 2: // GREEN
146 theTheme.SetPenColour( samplePen, clrSample3);
147 theTheme.SetPenColour( rmsPen, clrRms3);
148 break;
149 case 3: //BLACK
150 theTheme.SetPenColour( samplePen, clrSample4);
151 theTheme.SetPenColour( rmsPen, clrRms4);
152 break;
153
154 }
155}
THEME_API Theme theTheme
Definition: Theme.cpp:82
void SetBrushColour(wxBrush &Brush, int iIndex)
void SetPenColour(wxPen &Pen, int iIndex)
wxBrush blankBrush
Definition: TrackArtist.h:71
wxBrush envelopeBackgroundBrush
Definition: TrackArtist.h:79
wxBrush beatWeakSelBrush[2]
Definition: TrackArtist.h:101
wxPen odProgressDonePen
Definition: TrackArtist.h:91
wxPen rmsPen
Definition: TrackArtist.h:86
wxPen unselectedPen
Definition: TrackArtist.h:83
wxPen beatSepearatorPen[2]
Definition: TrackArtist.h:96
wxPen muteSamplePen
Definition: TrackArtist.h:89
wxBrush sampleBrush
Definition: TrackArtist.h:74
wxPen barSepearatorPen[2]
Definition: TrackArtist.h:97
wxPen muteClippedPen
Definition: TrackArtist.h:93
wxBrush selectedBrush
Definition: TrackArtist.h:73
wxBrush beatStrongBrush[2]
Definition: TrackArtist.h:98
wxPen selectedPen
Definition: TrackArtist.h:84
wxPen samplePen
Definition: TrackArtist.h:85
wxPen odProgressNotYetPen
Definition: TrackArtist.h:90
wxBrush beatWeakBrush[2]
Definition: TrackArtist.h:99
wxPen clippedPen
Definition: TrackArtist.h:92
wxBrush selsampleBrush
Definition: TrackArtist.h:75
wxPen blankPen
Definition: TrackArtist.h:82
wxPen muteRmsPen
Definition: TrackArtist.h:87
wxBrush beatStrongSelBrush[2]
Definition: TrackArtist.h:100
wxBrush clipAffordanceBackgroundSelBrush
Definition: TrackArtist.h:81
wxBrush dragsampleBrush
Definition: TrackArtist.h:76
wxPen selsamplePen
Definition: TrackArtist.h:88
wxBrush clipAffordanceBackgroundBrush
Definition: TrackArtist.h:80
wxBrush unselectedBrush
Definition: TrackArtist.h:72
wxBrush blankSelectedBrush
Definition: TrackArtist.h:78
wxPen blankSelectedPen
Definition: TrackArtist.h:94
void ChangeLightness(wxBrush &brush, int ialpha)
Definition: TrackArtist.cpp:60

References barSepearatorPen, beatSepearatorPen, beatStrongBrush, beatStrongSelBrush, beatWeakBrush, beatWeakSelBrush, blankBrush, blankPen, blankSelectedBrush, blankSelectedPen, anonymous_namespace{TrackArtist.cpp}::ChangeLightness(), clipAffordanceBackgroundBrush, clipAffordanceBackgroundSelBrush, clippedPen, dragsampleBrush, envelopeBackgroundBrush, muteClippedPen, muteRmsPen, muteSamplePen, odProgressDonePen, odProgressNotYetPen, rmsPen, sampleBrush, samplePen, selectedBrush, selectedPen, selsampleBrush, selsamplePen, ThemeBase::SetBrushColour(), ThemeBase::SetPenColour(), theTheme, unselectedBrush, and unselectedPen.

Referenced by TrackArtist(), and UpdatePrefs().

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

◆ UpdatePrefs()

void TrackArtist::UpdatePrefs ( )
overridevirtual

Implements PrefsListener.

Definition at line 157 of file TrackArtist.cpp.

158{
161
162 SetColours(0);
163}
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:207
static WaveChannelViewConstants::SampleDisplay SampleViewChoice()

References DecibelScaleCutoff, mdBrange, mSampleDisplay, Setting< T >::Read(), TracksPrefs::SampleViewChoice(), and SetColours().

Referenced by TrackArtist().

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

Member Data Documentation

◆ barSepearatorPen

wxPen TrackArtist::barSepearatorPen[2]

Definition at line 97 of file TrackArtist.h.

Referenced by SetColours().

◆ beatSepearatorPen

wxPen TrackArtist::beatSepearatorPen[2]

Definition at line 96 of file TrackArtist.h.

Referenced by SetColours().

◆ beatStrongBrush

wxBrush TrackArtist::beatStrongBrush[2]

Definition at line 98 of file TrackArtist.h.

Referenced by SetColours().

◆ beatStrongSelBrush

wxBrush TrackArtist::beatStrongSelBrush[2]

Definition at line 100 of file TrackArtist.h.

Referenced by SetColours().

◆ beatWeakBrush

wxBrush TrackArtist::beatWeakBrush[2]

Definition at line 99 of file TrackArtist.h.

Referenced by SetColours().

◆ beatWeakSelBrush

wxBrush TrackArtist::beatWeakSelBrush[2]

Definition at line 101 of file TrackArtist.h.

Referenced by SetColours().

◆ bigPoints

bool TrackArtist::bigPoints { false }

Definition at line 119 of file TrackArtist.h.

◆ blankBrush

wxBrush TrackArtist::blankBrush

Definition at line 71 of file TrackArtist.h.

Referenced by SetColours().

◆ blankPen

wxPen TrackArtist::blankPen

Definition at line 82 of file TrackArtist.h.

Referenced by SetColours().

◆ blankSelectedBrush

wxBrush TrackArtist::blankSelectedBrush

Definition at line 78 of file TrackArtist.h.

Referenced by SetColours().

◆ blankSelectedPen

wxPen TrackArtist::blankSelectedPen

Definition at line 94 of file TrackArtist.h.

Referenced by SetColours().

◆ clipAffordanceBackgroundBrush

wxBrush TrackArtist::clipAffordanceBackgroundBrush

Definition at line 80 of file TrackArtist.h.

Referenced by SetColours().

◆ clipAffordanceBackgroundSelBrush

wxBrush TrackArtist::clipAffordanceBackgroundSelBrush

Definition at line 81 of file TrackArtist.h.

Referenced by SetColours().

◆ clippedPen

wxPen TrackArtist::clippedPen

Definition at line 92 of file TrackArtist.h.

Referenced by SetColours().

◆ dragsampleBrush

wxBrush TrackArtist::dragsampleBrush

Definition at line 76 of file TrackArtist.h.

Referenced by SetColours().

◆ drawEnvelope

bool TrackArtist::drawEnvelope { false }

Definition at line 118 of file TrackArtist.h.

◆ drawSliders

bool TrackArtist::drawSliders { false }

Definition at line 120 of file TrackArtist.h.

◆ envelopeBackgroundBrush

wxBrush TrackArtist::envelopeBackgroundBrush

Definition at line 79 of file TrackArtist.h.

Referenced by SetColours().

◆ hasSolo

bool TrackArtist::hasSolo { false }

Definition at line 122 of file TrackArtist.h.

◆ mdBrange

float TrackArtist::mdBrange

Definition at line 68 of file TrackArtist.h.

Referenced by TrackArtist(), and UpdatePrefs().

◆ mSampleDisplay

int TrackArtist::mSampleDisplay

Definition at line 69 of file TrackArtist.h.

Referenced by TrackArtist(), and UpdatePrefs().

◆ muteClippedPen

wxPen TrackArtist::muteClippedPen

Definition at line 93 of file TrackArtist.h.

Referenced by SetColours().

◆ muteRmsPen

wxPen TrackArtist::muteRmsPen

Definition at line 87 of file TrackArtist.h.

Referenced by SetColours().

◆ muteSampleBrush

wxBrush TrackArtist::muteSampleBrush

Definition at line 77 of file TrackArtist.h.

◆ muteSamplePen

wxPen TrackArtist::muteSamplePen

Definition at line 89 of file TrackArtist.h.

Referenced by SetColours().

◆ odProgressDonePen

wxPen TrackArtist::odProgressDonePen

Definition at line 91 of file TrackArtist.h.

Referenced by SetColours().

◆ odProgressNotYetPen

wxPen TrackArtist::odProgressNotYetPen

Definition at line 90 of file TrackArtist.h.

Referenced by SetColours().

◆ onBrushTool

bool TrackArtist::onBrushTool { false }

Definition at line 121 of file TrackArtist.h.

◆ parent

TrackPanel* TrackArtist::parent

Definition at line 65 of file TrackArtist.h.

◆ pPendingTracks

const PendingTracks* TrackArtist::pPendingTracks {}

Definition at line 116 of file TrackArtist.h.

◆ pSelectedRegion

const SelectedRegion* TrackArtist::pSelectedRegion {}

Definition at line 114 of file TrackArtist.h.

◆ pZoomInfo

ZoomInfo* TrackArtist::pZoomInfo {}

Definition at line 115 of file TrackArtist.h.

Referenced by EqualizationPanel::OnPaint().

◆ rmsPen

wxPen TrackArtist::rmsPen

Definition at line 86 of file TrackArtist.h.

Referenced by SetColours().

◆ sampleBrush

wxBrush TrackArtist::sampleBrush

Definition at line 74 of file TrackArtist.h.

Referenced by SetColours().

◆ samplePen

wxPen TrackArtist::samplePen

Definition at line 85 of file TrackArtist.h.

Referenced by SetColours().

◆ selectedBrush

wxBrush TrackArtist::selectedBrush

Definition at line 73 of file TrackArtist.h.

Referenced by SetColours().

◆ selectedPen

wxPen TrackArtist::selectedPen

Definition at line 84 of file TrackArtist.h.

Referenced by SetColours().

◆ selsampleBrush

wxBrush TrackArtist::selsampleBrush

Definition at line 75 of file TrackArtist.h.

Referenced by SetColours().

◆ selsamplePen

wxPen TrackArtist::selsamplePen

Definition at line 88 of file TrackArtist.h.

Referenced by SetColours().

◆ unselectedBrush

wxBrush TrackArtist::unselectedBrush

Definition at line 72 of file TrackArtist.h.

Referenced by SetColours().

◆ unselectedPen

wxPen TrackArtist::unselectedPen

Definition at line 83 of file TrackArtist.h.

Referenced by SetColours().


The documentation for this class was generated from the following files: