Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
EffectLegacyCompressorPanel Class Referencefinal

#include <LegacyCompressor.h>

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

Public Member Functions

 EffectLegacyCompressorPanel (wxWindow *parent, wxWindowID winid, double &threshold, double &noiseFloor, double &ratio)
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Private Member Functions

void OnPaint (wxPaintEvent &evt)
 
void OnSize (wxSizeEvent &evt)
 

Private Attributes

double & threshold
 
double & noiseFloor
 
double & ratio
 

Detailed Description

Definition at line 69 of file LegacyCompressor.h.

Constructor & Destructor Documentation

◆ EffectLegacyCompressorPanel()

EffectLegacyCompressorPanel::EffectLegacyCompressorPanel ( wxWindow *  parent,
wxWindowID  winid,
double &  threshold,
double &  noiseFloor,
double &  ratio 
)

Definition at line 292 of file LegacyCompressor.cpp.

Member Function Documentation

◆ OnPaint()

void EffectLegacyCompressorPanel::OnPaint ( wxPaintEvent &  evt)
private

Definition at line 302 of file LegacyCompressor.cpp.

303{
304 wxPaintDC dc(this);
305
306 int width, height;
307 GetSize(&width, &height);
308
309 double rangeDB = 60;
310
311 // Ruler
312 int w = 0;
313 int h = 0;
314
316 vRuler.SetBounds(0, 0, width, height);
317 vRuler.SetOrientation(wxVERTICAL);
318 vRuler.SetRange(0, -rangeDB);
319 vRuler.SetUnits(XO("dB"));
320 vRuler.GetMaxSize(&w, NULL);
321
323 hRuler.SetBounds(0, 0, width, height);
324 hRuler.SetOrientation(wxHORIZONTAL);
325 hRuler.SetRange(-rangeDB, 0);
326 hRuler.SetUnits(XO("dB"));
327 hRuler.SetFlip(true);
328 hRuler.GetMaxSize(NULL, &h);
329
330 vRuler.SetBounds(0, 0, w, height - h);
331 hRuler.SetBounds(w, height - h, width, height);
332
333 vRuler.SetTickColour( theTheme.Colour( clrGraphLabels ));
334 hRuler.SetTickColour( theTheme.Colour( clrGraphLabels ));
335
336#if defined(__WXMSW__)
337 dc.Clear();
338#endif
339
340 wxRect border;
341 border.x = w;
342 border.y = 0;
343 border.width = width - w;
344 border.height = height - h + 1;
345
346 dc.SetBrush(*wxWHITE_BRUSH);
347 dc.SetPen(*wxBLACK_PEN);
348 dc.DrawRectangle(border);
349
350 wxRect envRect = border;
351 envRect.Deflate( 2, 2 );
352
353 int kneeX = lrint((rangeDB+threshold)*envRect.width/rangeDB);
354 int kneeY = lrint((rangeDB+threshold/ratio)*envRect.height/rangeDB);
355
356 int finalY = envRect.height;
357 int startY = lrint((threshold*(1.0/ratio-1.0))*envRect.height/rangeDB);
358
359 // Yellow line for threshold
360/* dc.SetPen(wxPen(wxColour(220, 220, 0), 1, wxSOLID));
361 AColor::Line(dc,
362 envRect.x,
363 envRect.y + envRect.height - kneeY,
364 envRect.x + envRect.width - 1,
365 envRect.y + envRect.height - kneeY);*/
366
367 // Was: Nice dark red line for the compression diagram
368// dc.SetPen(wxPen(wxColour(180, 40, 40), 3, wxSOLID));
369
370 // Nice blue line for compressor, same color as used in the waveform envelope.
371 dc.SetPen( AColor::WideEnvelopePen) ;
372
373 AColor::Line(dc,
374 envRect.x,
375 envRect.y + envRect.height - startY,
376 envRect.x + kneeX - 1,
377 envRect.y + envRect.height - kneeY);
378
379 AColor::Line(dc,
380 envRect.x + kneeX,
381 envRect.y + envRect.height - kneeY,
382 envRect.x + envRect.width - 1,
383 envRect.y + envRect.height - finalY);
384
385 // Paint border again
386 dc.SetBrush(*wxTRANSPARENT_BRUSH);
387 dc.SetPen(*wxBLACK_PEN);
388 dc.DrawRectangle(border);
389
390 vRuler.Draw(dc);
391 hRuler.Draw(dc);
392}
XO("Cut/Copy/Paste")
THEME_API Theme theTheme
Definition: Theme.cpp:82
static wxPen WideEnvelopePen
Definition: AColor.h:117
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:194
static const LinearDBFormat & Instance()
static const LinearUpdater & Instance()
Used to display a Ruler.
Definition: Ruler.h:34
wxColour & Colour(int iIndex)
#define lrint(dbl)
Definition: float_cast.h:169

References ThemeBase::Colour(), LinearDBFormat::Instance(), LinearUpdater::Instance(), AColor::Line(), lrint, ratio, theTheme, threshold, AColor::WideEnvelopePen, and XO().

Here is the call graph for this function:

◆ OnSize()

void EffectLegacyCompressorPanel::OnSize ( wxSizeEvent &  evt)
private

Definition at line 394 of file LegacyCompressor.cpp.

395{
396 Refresh(false);
397}

Member Data Documentation

◆ noiseFloor

double& EffectLegacyCompressorPanel::noiseFloor
private

Definition at line 82 of file LegacyCompressor.h.

◆ ratio

double& EffectLegacyCompressorPanel::ratio
private

Definition at line 83 of file LegacyCompressor.h.

Referenced by OnPaint().

◆ threshold

double& EffectLegacyCompressorPanel::threshold
private

Definition at line 81 of file LegacyCompressor.h.

Referenced by OnPaint().


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