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

#include <Compressor.h>

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

Public Member Functions

 EffectCompressorPanel (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 151 of file Compressor.h.

Constructor & Destructor Documentation

◆ EffectCompressorPanel()

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

Definition at line 624 of file Compressor.cpp.

628: wxPanelWrapper(parent, winid),
631 ratio(ratio)
632{
633}

Member Function Documentation

◆ OnPaint()

void EffectCompressorPanel::OnPaint ( wxPaintEvent &  evt)
private

Definition at line 635 of file Compressor.cpp.

636{
637 wxPaintDC dc(this);
638
639 int width, height;
640 GetSize(&width, &height);
641
642 double rangeDB = 60;
643
644 // Ruler
645 int w = 0;
646 int h = 0;
647
648 Ruler vRuler;
649 vRuler.SetBounds(0, 0, width, height);
650 vRuler.SetOrientation(wxVERTICAL);
651 vRuler.SetRange(0, -rangeDB);
653 vRuler.SetUnits(XO("dB"));
654 vRuler.GetMaxSize(&w, NULL);
655
656 Ruler hRuler;
657 hRuler.SetBounds(0, 0, width, height);
658 hRuler.SetOrientation(wxHORIZONTAL);
659 hRuler.SetRange(-rangeDB, 0);
661 hRuler.SetUnits(XO("dB"));
662 hRuler.SetFlip(true);
663 hRuler.GetMaxSize(NULL, &h);
664
665 vRuler.SetBounds(0, 0, w, height - h);
666 hRuler.SetBounds(w, height - h, width, height);
667
668 vRuler.SetTickColour( theTheme.Colour( clrGraphLabels ));
669 hRuler.SetTickColour( theTheme.Colour( clrGraphLabels ));
670
671#if defined(__WXMSW__)
672 dc.Clear();
673#endif
674
675 wxRect border;
676 border.x = w;
677 border.y = 0;
678 border.width = width - w;
679 border.height = height - h + 1;
680
681 dc.SetBrush(*wxWHITE_BRUSH);
682 dc.SetPen(*wxBLACK_PEN);
683 dc.DrawRectangle(border);
684
685 wxRect envRect = border;
686 envRect.Deflate( 2, 2 );
687
688 int kneeX = lrint((rangeDB+threshold)*envRect.width/rangeDB);
689 int kneeY = lrint((rangeDB+threshold/ratio)*envRect.height/rangeDB);
690
691 int finalY = envRect.height;
692 int startY = lrint((threshold*(1.0/ratio-1.0))*envRect.height/rangeDB);
693
694 // Yellow line for threshold
695/* dc.SetPen(wxPen(wxColour(220, 220, 0), 1, wxSOLID));
696 AColor::Line(dc,
697 envRect.x,
698 envRect.y + envRect.height - kneeY,
699 envRect.x + envRect.width - 1,
700 envRect.y + envRect.height - kneeY);*/
701
702 // Was: Nice dark red line for the compression diagram
703// dc.SetPen(wxPen(wxColour(180, 40, 40), 3, wxSOLID));
704
705 // Nice blue line for compressor, same color as used in the waveform envelope.
706 dc.SetPen( AColor::WideEnvelopePen) ;
707
708 AColor::Line(dc,
709 envRect.x,
710 envRect.y + envRect.height - startY,
711 envRect.x + kneeX - 1,
712 envRect.y + envRect.height - kneeY);
713
714 AColor::Line(dc,
715 envRect.x + kneeX,
716 envRect.y + envRect.height - kneeY,
717 envRect.x + envRect.width - 1,
718 envRect.y + envRect.height - finalY);
719
720 // Paint border again
721 dc.SetBrush(*wxTRANSPARENT_BRUSH);
722 dc.SetPen(*wxBLACK_PEN);
723 dc.DrawRectangle(border);
724
725 vRuler.Draw(dc);
726 hRuler.Draw(dc);
727}
#define XO(s)
Definition: Internat.h:31
THEME_API Theme theTheme
Definition: Theme.cpp:82
static wxPen WideEnvelopePen
Definition: AColor.h:111
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:187
Used to display a Ruler.
Definition: Ruler.h:26
void SetTickColour(const wxColour &colour)
Definition: Ruler.h:148
void SetFlip(bool flip)
Definition: Ruler.cpp:239
void SetOrientation(int orient)
Definition: Ruler.cpp:174
void Draw(wxDC &dc) const
Definition: Ruler.cpp:1428
void GetMaxSize(wxCoord *width, wxCoord *height)
Definition: Ruler.cpp:1603
void SetBounds(int left, int top, int right, int bottom)
Definition: Ruler.cpp:332
void SetUnits(const TranslatableString &units)
Definition: Ruler.cpp:153
void SetRange(double min, double max)
Definition: Ruler.cpp:188
void SetFormat(RulerFormat format)
Definition: Ruler.cpp:131
@ LinearDBFormat
Definition: Ruler.h:34
wxColour & Colour(int iIndex)
#define lrint(dbl)
Definition: float_cast.h:169

References ThemeBase::Colour(), Ruler::Draw(), Ruler::GetMaxSize(), AColor::Line(), Ruler::LinearDBFormat, lrint, ratio, Ruler::SetBounds(), Ruler::SetFlip(), Ruler::SetFormat(), Ruler::SetOrientation(), Ruler::SetRange(), Ruler::SetTickColour(), Ruler::SetUnits(), theTheme, threshold, AColor::WideEnvelopePen, and XO.

Here is the call graph for this function:

◆ OnSize()

void EffectCompressorPanel::OnSize ( wxSizeEvent &  evt)
private

Definition at line 729 of file Compressor.cpp.

730{
731 Refresh(false);
732}

Member Data Documentation

◆ noiseFloor

double& EffectCompressorPanel::noiseFloor
private

Definition at line 165 of file Compressor.h.

◆ ratio

double& EffectCompressorPanel::ratio
private

Definition at line 166 of file Compressor.h.

Referenced by OnPaint().

◆ threshold

double& EffectCompressorPanel::threshold
private

Definition at line 164 of file Compressor.h.

Referenced by OnPaint().


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