Audacity  2.3.1
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 652 of file Compressor.cpp.

656 : wxPanelWrapper(parent, winid),
659  ratio(ratio)
660 {
661 }

Member Function Documentation

void EffectCompressorPanel::OnPaint ( wxPaintEvent &  evt)
private

Definition at line 663 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.

664 {
665  wxPaintDC dc(this);
666 
667  int width, height;
668  GetSize(&width, &height);
669 
670  double rangeDB = 60;
671 
672  // Ruler
673  int w = 0;
674  int h = 0;
675 
676  Ruler vRuler;
677  vRuler.SetBounds(0, 0, width, height);
678  vRuler.SetOrientation(wxVERTICAL);
679  vRuler.SetRange(0, -rangeDB);
681  vRuler.SetUnits(_("dB"));
682  vRuler.GetMaxSize(&w, NULL);
683 
684  Ruler hRuler;
685  hRuler.SetBounds(0, 0, width, height);
686  hRuler.SetOrientation(wxHORIZONTAL);
687  hRuler.SetRange(-rangeDB, 0);
689  hRuler.SetUnits(_("dB"));
690  hRuler.SetFlip(true);
691  hRuler.GetMaxSize(NULL, &h);
692 
693  vRuler.SetBounds(0, 0, w, height - h);
694  hRuler.SetBounds(w, height - h, width, height);
695 
696  vRuler.SetTickColour( theTheme.Colour( clrGraphLabels ));
697  hRuler.SetTickColour( theTheme.Colour( clrGraphLabels ));
698 
699 #if defined(__WXMSW__)
700  dc.Clear();
701 #endif
702 
703  wxRect border;
704  border.x = w;
705  border.y = 0;
706  border.width = width - w;
707  border.height = height - h + 1;
708 
709  dc.SetBrush(*wxWHITE_BRUSH);
710  dc.SetPen(*wxBLACK_PEN);
711  dc.DrawRectangle(border);
712 
713  wxRect envRect = border;
714  envRect.Deflate( 2, 2 );
715 
716  int kneeX = lrint((rangeDB+threshold)*envRect.width/rangeDB);
717  int kneeY = lrint((rangeDB+threshold/ratio)*envRect.height/rangeDB);
718 
719  int finalY = envRect.height;
720  int startY = lrint((threshold*(1.0/ratio-1.0))*envRect.height/rangeDB);
721 
722  // Yellow line for threshold
723 /* dc.SetPen(wxPen(wxColour(220, 220, 0), 1, wxSOLID));
724  AColor::Line(dc,
725  envRect.x,
726  envRect.y + envRect.height - kneeY,
727  envRect.x + envRect.width - 1,
728  envRect.y + envRect.height - kneeY);*/
729 
730  // Was: Nice dark red line for the compression diagram
731 // dc.SetPen(wxPen(wxColour(180, 40, 40), 3, wxSOLID));
732 
733  // Nice blue line for compressor, same color as used in the waveform envelope.
734  dc.SetPen( AColor::WideEnvelopePen) ;
735 
736  AColor::Line(dc,
737  envRect.x,
738  envRect.y + envRect.height - startY,
739  envRect.x + kneeX - 1,
740  envRect.y + envRect.height - kneeY);
741 
742  AColor::Line(dc,
743  envRect.x + kneeX,
744  envRect.y + envRect.height - kneeY,
745  envRect.x + envRect.width - 1,
746  envRect.y + envRect.height - finalY);
747 
748  // Paint border again
749  dc.SetBrush(*wxTRANSPARENT_BRUSH);
750  dc.SetPen(*wxBLACK_PEN);
751  dc.DrawRectangle(border);
752 
753  vRuler.Draw(dc);
754  hRuler.Draw(dc);
755 }
void Draw(wxDC &dc)
Definition: Ruler.cpp:1285
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
void SetBounds(int left, int top, int right, int bottom)
Definition: Ruler.cpp:314
void GetMaxSize(wxCoord *width, wxCoord *height)
Definition: Ruler.cpp:1511
void SetOrientation(int orient)
Definition: Ruler.cpp:178
#define lrint(dbl)
Definition: float_cast.h:136
void SetFlip(bool flip)
Definition: Ruler.cpp:243
void SetUnits(const wxString &units)
Definition: Ruler.cpp:166
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:144
void SetRange(double min, double max)
Definition: Ruler.cpp:192
Used to display a Ruler.
Definition: Ruler.h:30
void SetTickColour(const wxColour &colour)
Definition: Ruler.h:149
static wxPen WideEnvelopePen
Definition: AColor.h:123
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1225
void EffectCompressorPanel::OnSize ( wxSizeEvent &  evt)
private

Definition at line 757 of file Compressor.cpp.

758 {
759  Refresh(false);
760 }

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: