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

#include <Compressor.h>

Inheritance diagram for EffectCompressorPanel:
wxPanelWrapper wxTabTraversalWrapper< wxPanel >

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 wxString &name=_("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const wxString &name=_("Panel"))
 
- 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 139 of file Compressor.h.

Constructor & Destructor Documentation

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

Definition at line 657 of file Compressor.cpp.

661 : wxPanelWrapper(parent, winid),
664  ratio(ratio)
665 {
666 }

Member Function Documentation

void EffectCompressorPanel::OnPaint ( wxPaintEvent &  evt)
private

Definition at line 668 of file Compressor.cpp.

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, and AColor::WideEnvelopePen.

669 {
670  wxPaintDC dc(this);
671 
672  int width, height;
673  GetSize(&width, &height);
674 
675  double rangeDB = 60;
676 
677  // Ruler
678  int w = 0;
679  int h = 0;
680 
681  Ruler vRuler;
682  vRuler.SetBounds(0, 0, width, height);
683  vRuler.SetOrientation(wxVERTICAL);
684  vRuler.SetRange(0, -rangeDB);
686  vRuler.SetUnits(_("dB"));
687  vRuler.GetMaxSize(&w, NULL);
688 
689  Ruler hRuler;
690  hRuler.SetBounds(0, 0, width, height);
691  hRuler.SetOrientation(wxHORIZONTAL);
692  hRuler.SetRange(-rangeDB, 0);
694  hRuler.SetUnits(_("dB"));
695  hRuler.SetFlip(true);
696  hRuler.GetMaxSize(NULL, &h);
697 
698  vRuler.SetBounds(0, 0, w, height - h);
699  hRuler.SetBounds(w, height - h, width, height);
700 
701  vRuler.SetTickColour( theTheme.Colour( clrGraphLabels ));
702  hRuler.SetTickColour( theTheme.Colour( clrGraphLabels ));
703 
704 #if defined(__WXMSW__)
705  dc.Clear();
706 #endif
707 
708  wxRect border;
709  border.x = w;
710  border.y = 0;
711  border.width = width - w;
712  border.height = height - h + 1;
713 
714  dc.SetBrush(*wxWHITE_BRUSH);
715  dc.SetPen(*wxBLACK_PEN);
716  dc.DrawRectangle(border);
717 
718  wxRect envRect = border;
719  envRect.Deflate( 2, 2 );
720 
721  int kneeX = lrint((rangeDB+threshold)*envRect.width/rangeDB);
722  int kneeY = lrint((rangeDB+threshold/ratio)*envRect.height/rangeDB);
723 
724  int finalY = envRect.height;
725  int startY = lrint((threshold*(1.0/ratio-1.0))*envRect.height/rangeDB);
726 
727  // Yellow line for threshold
728 /* dc.SetPen(wxPen(wxColour(220, 220, 0), 1, wxSOLID));
729  AColor::Line(dc,
730  envRect.x,
731  envRect.y + envRect.height - kneeY,
732  envRect.x + envRect.width - 1,
733  envRect.y + envRect.height - kneeY);*/
734 
735  // Was: Nice dark red line for the compression diagram
736 // dc.SetPen(wxPen(wxColour(180, 40, 40), 3, wxSOLID));
737 
738  // Nice blue line for compressor, same color as used in the waveform envelope.
739  dc.SetPen( AColor::WideEnvelopePen) ;
740 
741  AColor::Line(dc,
742  envRect.x,
743  envRect.y + envRect.height - startY,
744  envRect.x + kneeX - 1,
745  envRect.y + envRect.height - kneeY);
746 
747  AColor::Line(dc,
748  envRect.x + kneeX,
749  envRect.y + envRect.height - kneeY,
750  envRect.x + envRect.width - 1,
751  envRect.y + envRect.height - finalY);
752 
753  // Paint border again
754  dc.SetBrush(*wxTRANSPARENT_BRUSH);
755  dc.SetPen(*wxBLACK_PEN);
756  dc.DrawRectangle(border);
757 
758  vRuler.Draw(dc);
759  hRuler.Draw(dc);
760 }
void Draw(wxDC &dc)
Definition: Ruler.cpp:1324
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
void SetBounds(int left, int top, int right, int bottom)
Definition: Ruler.cpp:359
void GetMaxSize(wxCoord *width, wxCoord *height)
Definition: Ruler.cpp:1550
void SetOrientation(int orient)
Definition: Ruler.cpp:223
#define lrint(dbl)
Definition: float_cast.h:136
void SetFlip(bool flip)
Definition: Ruler.cpp:288
void SetUnits(const wxString &units)
Definition: Ruler.cpp:211
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:122
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void SetFormat(RulerFormat format)
Definition: Ruler.cpp:189
void SetRange(double min, double max)
Definition: Ruler.cpp:237
Used to display a Ruler.
Definition: Ruler.h:32
void SetTickColour(const wxColour &colour)
Definition: Ruler.h:151
static wxPen WideEnvelopePen
Definition: AColor.h:123
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1225
void EffectCompressorPanel::OnSize ( wxSizeEvent &  evt)
private

Definition at line 762 of file Compressor.cpp.

763 {
764  Refresh(false);
765 }

Member Data Documentation

double& EffectCompressorPanel::noiseFloor
private

Definition at line 153 of file Compressor.h.

double& EffectCompressorPanel::ratio
private

Definition at line 154 of file Compressor.h.

Referenced by OnPaint().

double& EffectCompressorPanel::threshold
private

Definition at line 152 of file Compressor.h.

Referenced by OnPaint().


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