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 153 of file Compressor.h.

Constructor & Destructor Documentation

◆ EffectCompressorPanel()

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

Definition at line 631 of file Compressor.cpp.

635: wxPanelWrapper(parent, winid),
638 ratio(ratio)
639{
640}

Member Function Documentation

◆ OnPaint()

void EffectCompressorPanel::OnPaint ( wxPaintEvent &  evt)
private

Definition at line 642 of file Compressor.cpp.

643{
644 wxPaintDC dc(this);
645
646 int width, height;
647 GetSize(&width, &height);
648
649 double rangeDB = 60;
650
651 // Ruler
652 int w = 0;
653 int h = 0;
654
656 vRuler.SetBounds(0, 0, width, height);
657 vRuler.SetOrientation(wxVERTICAL);
658 vRuler.SetRange(0, -rangeDB);
659 vRuler.SetUnits(XO("dB"));
660 vRuler.GetMaxSize(&w, NULL);
661
663 hRuler.SetBounds(0, 0, width, height);
664 hRuler.SetOrientation(wxHORIZONTAL);
665 hRuler.SetRange(-rangeDB, 0);
666 hRuler.SetUnits(XO("dB"));
667 hRuler.SetFlip(true);
668 hRuler.GetMaxSize(NULL, &h);
669
670 vRuler.SetBounds(0, 0, w, height - h);
671 hRuler.SetBounds(w, height - h, width, height);
672
673 vRuler.SetTickColour( theTheme.Colour( clrGraphLabels ));
674 hRuler.SetTickColour( theTheme.Colour( clrGraphLabels ));
675
676#if defined(__WXMSW__)
677 dc.Clear();
678#endif
679
680 wxRect border;
681 border.x = w;
682 border.y = 0;
683 border.width = width - w;
684 border.height = height - h + 1;
685
686 dc.SetBrush(*wxWHITE_BRUSH);
687 dc.SetPen(*wxBLACK_PEN);
688 dc.DrawRectangle(border);
689
690 wxRect envRect = border;
691 envRect.Deflate( 2, 2 );
692
693 int kneeX = lrint((rangeDB+threshold)*envRect.width/rangeDB);
694 int kneeY = lrint((rangeDB+threshold/ratio)*envRect.height/rangeDB);
695
696 int finalY = envRect.height;
697 int startY = lrint((threshold*(1.0/ratio-1.0))*envRect.height/rangeDB);
698
699 // Yellow line for threshold
700/* dc.SetPen(wxPen(wxColour(220, 220, 0), 1, wxSOLID));
701 AColor::Line(dc,
702 envRect.x,
703 envRect.y + envRect.height - kneeY,
704 envRect.x + envRect.width - 1,
705 envRect.y + envRect.height - kneeY);*/
706
707 // Was: Nice dark red line for the compression diagram
708// dc.SetPen(wxPen(wxColour(180, 40, 40), 3, wxSOLID));
709
710 // Nice blue line for compressor, same color as used in the waveform envelope.
711 dc.SetPen( AColor::WideEnvelopePen) ;
712
713 AColor::Line(dc,
714 envRect.x,
715 envRect.y + envRect.height - startY,
716 envRect.x + kneeX - 1,
717 envRect.y + envRect.height - kneeY);
718
719 AColor::Line(dc,
720 envRect.x + kneeX,
721 envRect.y + envRect.height - kneeY,
722 envRect.x + envRect.width - 1,
723 envRect.y + envRect.height - finalY);
724
725 // Paint border again
726 dc.SetBrush(*wxTRANSPARENT_BRUSH);
727 dc.SetPen(*wxBLACK_PEN);
728 dc.DrawRectangle(border);
729
730 vRuler.Draw(dc);
731 hRuler.Draw(dc);
732}
XO("Cut/Copy/Paste")
THEME_API Theme theTheme
Definition: Theme.cpp:82
static wxPen WideEnvelopePen
Definition: AColor.h:116
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:187
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 EffectCompressorPanel::OnSize ( wxSizeEvent &  evt)
private

Definition at line 734 of file Compressor.cpp.

735{
736 Refresh(false);
737}

Member Data Documentation

◆ noiseFloor

double& EffectCompressorPanel::noiseFloor
private

Definition at line 167 of file Compressor.h.

◆ ratio

double& EffectCompressorPanel::ratio
private

Definition at line 168 of file Compressor.h.

Referenced by OnPaint().

◆ threshold

double& EffectCompressorPanel::threshold
private

Definition at line 166 of file Compressor.h.

Referenced by OnPaint().


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