45#include <wx/wxcrtvararg.h>
47#include <wx/dcbuffer.h>
50#include <wx/settings.h>
51#include <wx/textdlg.h>
53#include <wx/radiobut.h>
54#include <wx/tooltip.h>
60#include "../widgets/BasicMenu.h"
67#include "../ProjectWindows.h"
72#include "../widgets/LinearUpdater.h"
73#include "../widgets/LinearDBFormat.h"
74#include "../widgets/RealFormat.h"
77#include "../widgets/valnum.h"
79#if wxUSE_ACCESSIBILITY
85 MeterAx(wxWindow * window);
93 wxAccStatus DoDefaultAction(
int childId)
override;
97 wxAccStatus GetChild(
int childId, wxAccessible** child)
override;
100 wxAccStatus GetChildCount(
int* childCount)
override;
108 wxAccStatus GetDefaultAction(
int childId, wxString *actionName)
override;
111 wxAccStatus GetDescription(
int childId, wxString *description)
override;
117 wxAccStatus GetFocus(
int *childId, wxAccessible **child)
override;
120 wxAccStatus GetHelpText(
int childId, wxString *helpText)
override;
124 wxAccStatus GetKeyboardShortcut(
int childId, wxString *shortcut)
override;
128 wxAccStatus GetLocation(wxRect& rect,
int elementId)
override;
131 wxAccStatus GetRole(
int childId, wxAccRole *role)
override;
141 wxAccStatus GetSelections(wxVariant *selections)
override;
144 wxAccStatus GetState(
int childId,
long* state)
override;
148 wxAccStatus GetValue(
int childId, wxString* strValue)
override;
162output = wxString::Format(
wxT(
"Meter update msg: %i channels, %i samples\n"), \
166 output += wxString::Format(
wxT(
"%f peak, %f rms "),
peak[i],
rms[i]);
168 output += wxString::Format(
wxT(
"clipped "));
170 output += wxString::Format(
wxT(
"no clip "));
213 auto start =
mStart.load(std::memory_order_acquire);
214 auto end =
mEnd.load(std::memory_order_relaxed);
236 auto start =
mStart.load(std::memory_order_relaxed);
237 auto end =
mEnd.load(std::memory_order_acquire);
253#include "../../images/SpeakerMenu.xpm"
254#include "../../images/MicMenu.xpm"
261 wxT(
"AutomaticStereo"),
262 wxT(
"HorizontalStereo"),
263 wxT(
"VerticalStereo")
293 wxWindow* parent, wxWindowID
id,
299:
MeterPanelBase(parent,
id, pos,
size, wxTAB_TRAVERSAL | wxNO_BORDER | wxWANTS_CHARS),
305 mDesiredStyle(
style),
310 mDecayRate(fDecayRate),
312 mNumPeakSamplesToClip(3),
313 mPeakHoldDuration(3),
324 SetName(
XO(
"Meter") );
326 wxUnusedVar(SpeakerMenu_xpm);
327 wxUnusedVar(MicMenu_xpm);
330 mStyle = mDesiredStyle;
334#if wxUSE_ACCESSIBILITY
335 SetAccessible(
safenew MeterAx(
this));
339 mRuler.SetFonts(GetFont(), GetFont(), GetFont());
341 mRuler.SetLabelEdges(
true);
346 mSlider = std::make_unique<LWSlider>(
this,
XO(
""),
355 mSlider->SetScroll(0.1f, 2.0f);
358 UpdateSliderControl();
362 mBkgndBrush = wxBrush(backgroundColour, wxBRUSHSTYLE_SOLID);
363 SetBackgroundColour( backgroundColour );
365 mPeakPeakPen = wxPen(
theTheme.
Colour( clrMeterPeak), 1, wxPENSTYLE_SOLID);
366 mDisabledPen = wxPen(
theTheme.
Colour( clrMeterDisabledPen), 1, wxPENSTYLE_SOLID);
375 mPen = wxPen(
theTheme.
Colour( clrMeterInputPen ), 1, wxPENSTYLE_SOLID);
376 mBrush = wxBrush(
theTheme.
Colour( clrMeterInputBrush ), wxBRUSHSTYLE_SOLID);
377 mRMSBrush = wxBrush(
theTheme.
Colour( clrMeterInputRMSBrush ), wxBRUSHSTYLE_SOLID);
378 mClipBrush = wxBrush(
theTheme.
Colour( clrMeterInputClipBrush ), wxBRUSHSTYLE_SOLID);
383 mPen = wxPen(
theTheme.
Colour( clrMeterOutputPen ), 1, wxPENSTYLE_SOLID);
384 mBrush = wxBrush(
theTheme.
Colour( clrMeterOutputBrush ), wxBRUSHSTYLE_SOLID);
385 mRMSBrush = wxBrush(
theTheme.
Colour( clrMeterOutputRMSBrush ), wxBRUSHSTYLE_SOLID);
386 mClipBrush = wxBrush(
theTheme.
Colour( clrMeterOutputClipBrush ), wxBRUSHSTYLE_SOLID);
394 mDisabledBkgndBrush = mBkgndBrush;
402 Reset(44100.0,
true);
424 if (
style ==
wxT(
"AutomaticStereo"))
428 else if (
style ==
wxT(
"HorizontalStereo"))
432 else if (
style ==
wxT(
"VerticalStereo"))
458 static int value = wxNewId();
482 float playbackVolume;
490 gAudioIO->GetMixer(&inputSource, &inputVolume, &playbackVolume);
492 const auto volume =
mIsInput ? inputVolume : playbackVolume;
507#if defined(__WXMAC__)
508 auto paintDC = std::make_unique<wxPaintDC>(
this);
510 std::unique_ptr<wxDC> paintDC{ wxAutoBufferedPaintDCFactory(
this) };
512 wxDC & destDC = *paintDC;
519 mBitmap = std::make_unique<wxBitmap>();
535 dc.SetPen(*wxTRANSPARENT_PEN);
544 dc.SetTextForeground( clrText );
545 dc.SetTextBackground( clrBoxFill );
551 wxColor green(117, 215, 112);
552 wxColor yellow(255, 255, 0);
553 wxColor red(255, 0, 0);
558 if (GetBackgroundColour().GetLuminance() < 0.25)
560 green = wxColor(117-100, 215-100, 112-100);
561 yellow = wxColor(255-100, 255-100, 0);
562 red = wxColor(255-100, 0, 0);
564 else if (GetBackgroundColour().GetLuminance() < 0.50)
566 green = wxColor(117-50, 215-50, 112-50);
567 yellow = wxColor(255-50, 255-50, 0);
568 red = wxColor(255-50, 0, 0);
572 for (
unsigned int i = 0; i <
mNumBars; i++)
584 wxRect r =
mBar[i].
r;
593 gradw = (double) r.GetWidth() /
mDBRange * 6.0;
594 gradh = (double) r.GetHeight() /
mDBRange * 6.0;
598 gradw = (double) r.GetWidth() / 100 * 25;
599 gradh = (double) r.GetHeight() / 100 * 25;
606 dc.GradientFillLinear(r, red, yellow, wxSOUTH);
609 r.SetTop(r.GetBottom());
610 dc.GradientFillLinear(r, yellow, green, wxSOUTH);
613 r.SetTop(r.GetBottom());
614 r.SetBottom(
mBar[i].r.GetBottom());
615 dc.SetPen(*wxTRANSPARENT_PEN);
622 r.SetWidth(r.GetWidth() - (int) (gradw + gradw + 0.5));
623 dc.SetPen(*wxTRANSPARENT_PEN);
628 r.SetLeft(r.GetRight() + 1);
629 r.SetWidth(floor(gradw));
630 dc.GradientFillLinear(r, green, yellow);
633 r.SetLeft(r.GetRight() + 1);
634 r.SetRight(
mBar[i].r.GetRight());
635 dc.GradientFillLinear(r, yellow, red);
637#ifdef EXPERIMENTAL_METER_LED_STYLE
640 wxRect r =
mBar[i].
r;
642 BackgroundPen.SetColour( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE) );
643 dc.SetPen( BackgroundPen );
645 for(i=0;i<r.width;i++)
653 int j = abs( (i%7)-4);
655 AColor::Line( dc, i+r.x, r.y+r.height-j, i+r.x, r.y+r.height );
663 dc.SetTextForeground( clrText );
668 dc.SelectObject(wxNullBitmap);
672 destDC.DrawBitmap(*
mBitmap, 0, 0);
675 for (
unsigned int i = 0; i <
mNumBars; i++)
680 destDC.SetTextForeground( clrText );
691 destDC.SetBackgroundMode( wxSOLID );
692 destDC.SetTextBackground( clrBoxFill );
702 ::wxGetMousePosition()));
706 mSlider->OnPaint(destDC, highlighted);
711 auto r = GetClientRect();
726 if ((evt.GetEventType() == wxEVT_MOTION || evt.Entering() || evt.Leaving())) {
734 if (evt.Entering()) {
737 else if(evt.Leaving())
752 switch(evt.GetKeyCode())
758 case WXK_NUMPAD_ENTER:
759 case WXK_WINDOWS_MENU:
762 ShowMenu(GetClientRect().GetBottomLeft());
776 ShowMenu(GetClientRect().GetBottomLeft());
786 switch (evt.GetKeyCode())
790 Navigate(wxNavigationKeyEvent::IsBackward);
792 Navigate(wxNavigationKeyEvent::IsForward);
840 gAudioIO->GetMixer(&inputSource, &inputVolume, &outputVolume);
847 gAudioIO->SetMixer(inputSource, inputVolume, outputVolume);
849#if wxUSE_ACCESSIBILITY
850 GetAccessible()->NotifyEvent( wxACC_EVENT_OBJECT_VALUECHANGE,
865 auto changed =
mSlider->ShowDialog();
947static float ToDB(
float v,
float range)
958 unsigned numChannels,
int numFrames,
const float *sampleData)
960 auto sptr = sampleData;
964 memset(&msg, 0,
sizeof(msg));
967 for(
int i=0; i<numFrames; i++) {
968 for(
unsigned int j=0; j<num; j++) {
970 msg.
rms[j] += sptr[j]*sptr[j];
988 for(
unsigned int j=0; j<
mNumBars; j++)
1043#ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
1044 double maxPeak = 0.0;
1045 bool discarded =
false;
1065 for(
unsigned int j=0; j<
mNumBars; j++) {
1091 float smooth = pow(0.9, (
double)msg.
numFrames/1024.0);
1100 if (
mBar[j].peak >
mBar[j].peakPeakHold )
1111#ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
1112 if (
mT > gAudioIO->AILAGetLastDecisionTime()) {
1114 maxPeak = msg.
peak[j] > maxPeak ? msg.
peak[j] : maxPeak;
1115 wxPrintf(
"%f@%f ", msg.
peak[j],
mT);
1119 wxPrintf(
"%f@%f discarded\n", msg.
peak[j],
mT);
1125 if (numChanges > 0) {
1126 #ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
1127 if (gAudioIO->AILAIsActive() &&
mIsInput && !discarded) {
1128 gAudioIO->AILAProcess(maxPeak);
1147 for(
unsigned int j=0; j<
mNumBars; j++)
1148 maxPeak =
mBar[j].peak > maxPeak ?
mBar[j].peak : maxPeak;
1155 auto peakHold = .0f;
1156 for (
unsigned int i = 0; i <
mNumBars; i++)
1157 peakHold = std::max(peakHold,
mBar[i].peakPeakHold);
1164#if defined __WXMSW__
1168 return wxFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1199 if (
mBar[c].clipping)
1252 mBar[iBar].
r.x += 1;
1253 mBar[iBar].
r.width -= 1;
1254 mBar[iBar].
r.y += 1;
1255 mBar[iBar].
r.height -= 1;
1277 mBar[iBar].
b.width -= 4;
1278 mBar[iBar].
r.width -= 4;
1338 wxPrintf(
wxT(
"Style not handled yet!\n"));
1345 height -= top +
gap;
1348 barw = (width -
gap) / 2;
1357 mBar[0].
b = wxRect(left, top, barw, barh);
1370 mBar[1].
r.GetBottom());
1375 lside = ltxtWidth +
gap;
1392 width -=
gap + rside +
gap + left;
1395 height -= top +
gap;
1401 barw = (width -
gap) / 2;
1410 mBar[0].
b = wxRect(left, top, barw, barh);
1423 mBar[1].
r.GetBottom());
1431 height -= top +
gap + ltxtHeight +
gap;
1437 barw = (width / 2) -
gap;
1446 mBar[0].
b = wxRect(left, top, barw, barh);
1463 mBar[1].
r.GetBottom());
1476 height -= rtxtHeight +
gap;
1479 mLeftTextPos = wxPoint(left, (height / 4) - ltxtHeight / 2);
1480 mRightTextPos = wxPoint(left, (height * 3 / 4) - rtxtHeight / 2);
1483 left +=
intmax(ltxtWidth, rtxtWidth);
1499 barh = (height -
gap) / 2;
1505 mBar[0].
b = wxRect(left, top, barw, barh);
1516 mBar[1].
r.GetBottom() + 1,
1517 mBar[1].
r.GetRight(),
1524 mLeftTextPos = wxPoint(left, (height / 4) - (ltxtHeight / 2));
1525 mRightTextPos = wxPoint(left, (height * 3 / 4) - (ltxtHeight / 2));
1528 left +=
intmax(ltxtWidth, rtxtWidth);
1544 barh = (height -
gap) / 2;
1550 mBar[0].
b = wxRect(left, top, barw, barh);
1566 mBar[1].
r.GetRight(),
1580 for (
unsigned int i = 0; i <
mNumBars; i++)
1595 wxCoord x = bar->
r.GetLeft();
1596 wxCoord y = bar->
r.GetTop();
1597 wxCoord w = bar->
r.GetWidth();
1598 wxCoord h = bar->
r.GetHeight();
1603 dc.SetPen(*wxTRANSPARENT_PEN);
1617 ht = (int)(bar->
peak * (h - 1) + 0.5);
1623 dc.DrawRectangle(x, y, w, h - ht);
1631 dc.Blit(x, y + h - ht - 1, w, ht + 1, &srcDC, x, y + h - ht - 1);
1637 ht = (int)(bar->
peakHold * (h - 1) + 0.5);
1640 dc.Blit(x, y + h - ht - 1, w, 2, &srcDC, x, y + h - ht - 1);
1649 AColor::Line(dc, x, y + h - ht - 1, x + w - 1, y + h - ht - 1);
1652 AColor::Line(dc, x, y + h - ht, x + w - 1, y + h - ht);
1660 wd = (int)(bar->
peak * (w - 1) + 0.5);
1666 dc.DrawRectangle(x + wd, y, w - wd, h);
1675 dc.Blit(x, y, wd + 1, h, &srcDC, x, y);
1681 wd = (int)(bar->
peakHold * (w - 1) + 0.5);
1684 dc.Blit(x + wd - 1, y, 2, h, &srcDC, x + wd, y);
1696 AColor::Line(dc, x + wd - 1, y, x + wd - 1, y + h - 1);
1702 srcDC.SelectObject(wxNullBitmap);
1710 ht = (int)(bar->
peak * (h - 1) + 0.5);
1716 dc.DrawRectangle(x, y, w, h - ht);
1721 dc.SetPen(*wxTRANSPARENT_PEN);
1725 dc.DrawRectangle(x, y + h - ht - 1, w, ht + 1);
1731 ht = (int)(bar->
peakHold * (h - 1) + 0.5);
1734 AColor::Line(dc, x, y + h - ht - 1, x + w - 1, y + h - ht - 1);
1737 AColor::Line(dc, x, y + h - ht, x + w - 1, y + h - ht);
1744 ht = (int)(bar->
rms * (h - 1) + 0.5);
1747 dc.SetPen(*wxTRANSPARENT_PEN);
1751 dc.DrawRectangle(x, y + h - ht - 1, w, ht + 1);
1760 AColor::Line(dc, x, y + h - ht - 1, x + w - 1, y + h - ht - 1);
1763 AColor::Line(dc, x, y + h - ht, x + w - 1, y + h - ht);
1771 wd = (int)(bar->
peak * (w - 1) + 0.5);
1777 dc.DrawRectangle(x + wd, y, w - wd, h);
1782 dc.SetPen(*wxTRANSPARENT_PEN);
1786 dc.DrawRectangle(x, y, wd + 1, h);
1792 wd = (int)(bar->
peakHold * (w - 1) + 0.5);
1798 AColor::Line(dc, x + wd - 1, y, x + wd - 1, y + h - 1);
1804 wd = (int)(bar->
rms * (w - 1) + 0.5);
1808 dc.SetPen(*wxTRANSPARENT_PEN);
1812 dc.DrawRectangle(x, y, wd + 1, h);
1824 AColor::Line(dc, x + wd - 1, y, x + wd - 1, y + h - 1);
1843 dc.SetPen(*wxTRANSPARENT_PEN);
1844 wxRect r(bar->
rClip.GetX() + 1,
1845 bar->
rClip.GetY() + 1,
1846 bar->
rClip.GetWidth() - 1,
1847 bar->
rClip.GetHeight() - 1);
1848 dc.DrawRectangle(r);
1862 if (gAudioIO->IsMonitoring()){
1863 gAudioIO->StopStream();
1866 if (start && !gAudioIO->IsBusy()){
1880 if (gAudioIO->IsMonitoring()){
1881 gAudioIO->StopStream();
1902 if (IsShownOnScreen())
1924 return {
true, mMonitoring, mActive };
1951 mi = menu.Append(
OnMonitorID,
_(
"Disable Silent Monitoring"));
1953 mi = menu.Append(
OnMonitorID,
_(
"Enable Silent Monitoring"));
1981 wxRadioButton *gradient;
1984 wxRadioButton *linear;
1985 wxRadioButton *automatic;
1986 wxRadioButton *horizontal;
1987 wxRadioButton *vertical;
1990 auto title =
mIsInput ?
XO(
"Recording Meter Options") :
XO(
"Playback Meter Options");
1998 S.StartVerticalLay();
2000 S.StartStatic(
XO(
"Refresh Rate"), 0);
2003"Higher refresh rates make the meter show more frequent\nchanges. A rate of 30 per second or less should prevent\nthe meter affecting audio quality on slower machines."));
2004 S.StartHorizontalLay();
2006 rate =
S.Name(
XO(
"Meter refresh rate per second [1-100]"))
2007 .Validator<IntegerValidator<long>>(
2010 .AddTextBox(
XXO(
"Meter refresh rate per second [1-100]: "),
2011 wxString::Format(
wxT(
"%d"), meterRefreshRate),
2014 S.EndHorizontalLay();
2018 S.StartHorizontalLay();
2020 S.StartStatic(
XO(
"Meter Style"), 0);
2022 S.StartVerticalLay();
2024 gradient =
S.AddRadioButton(
XXO(
"Gradient"),
true,
mGradient);
2025 rms =
S.AddRadioButtonToGroup(
XXO(
"RMS"),
false,
mGradient);
2031 S.StartStatic(
XO(
"Meter Type"), 0);
2033 S.StartVerticalLay();
2035 db =
S.AddRadioButton(
XXO(
"dB"),
true,
mDB);
2036 linear =
S.AddRadioButtonToGroup(
XXO(
"Linear"),
false,
mDB);
2042 S.StartStatic(
XO(
"Orientation"), 1);
2044 S.StartVerticalLay();
2046 automatic =
S.AddRadioButton(
2048 horizontal =
S.AddRadioButtonToGroup(
2050 vertical =
S.AddRadioButtonToGroup(
2057 S.EndHorizontalLay();
2058 S.AddStandardButtons();
2064 dlg.CenterOnParent();
2066 if (dlg.ShowModal() == wxID_OK)
2069 wxT(
"AutomaticStereo") ,
2070 wxT(
"HorizontalStereo") ,
2071 wxT(
"VerticalStereo") ,
2075 s = automatic->GetValue() ? 0 : s;
2076 s = horizontal->GetValue() ? 1 : s;
2077 s = vertical->GetValue() ? 2 : s;
2097 return wxT(
"/Meter/Mixerboard/") +
key;
2102 return wxT(
"/Meter/Input/") +
key;
2105 return wxT(
"/Meter/Output/") +
key;
2118#if wxUSE_ACCESSIBILITY
2120MeterAx::MeterAx(wxWindow *window):
2133wxAccStatus MeterAx::DoDefaultAction(
int WXUNUSED(childId))
2145wxAccStatus MeterAx::GetChild(
int childId, wxAccessible** child)
2147 if (childId == wxACC_SELF)
2155wxAccStatus MeterAx::GetChildCount(
int* childCount)
2168wxAccStatus MeterAx::GetDefaultAction(
int WXUNUSED(childId), wxString* actionName)
2170 *actionName =
_(
"Press");
2175wxAccStatus MeterAx::GetDescription(
int WXUNUSED(childId), wxString *description)
2177 description->clear();
2178 return wxACC_NOT_SUPPORTED;
2185wxAccStatus MeterAx::GetFocus(
int* childId, wxAccessible** child)
2193wxAccStatus MeterAx::GetHelpText(
int WXUNUSED(childId), wxString *helpText)
2196 return wxACC_NOT_SUPPORTED;
2201wxAccStatus MeterAx::GetKeyboardShortcut(
int WXUNUSED(childId), wxString *shortcut)
2209wxAccStatus MeterAx::GetLocation(wxRect & rect,
int WXUNUSED(elementId))
2213 rect = m->GetClientRect();
2214 rect.SetPosition(m->ClientToScreen(rect.GetPosition()));
2220wxAccStatus MeterAx::GetRole(
int WXUNUSED(childId), wxAccRole* role)
2222 *role = wxROLE_SYSTEM_SLIDER;
2235wxAccStatus MeterAx::GetSelections(wxVariant * WXUNUSED(selections))
2237 return wxACC_NOT_IMPLEMENTED;
2241wxAccStatus MeterAx::GetState(
int WXUNUSED(childId),
long* state)
2245 *state = wxACC_STATE_SYSTEM_FOCUSABLE;
2253wxAccStatus MeterAx::GetValue(
int WXUNUSED(childId), wxString* strValue)
2257 *strValue = m->
mSlider->GetStringValue();
EVT_MENU(OnSetPlayRegionToSelectionID, AdornedRulerPanel::OnSetPlayRegionToSelection) EVT_COMMAND(OnTogglePinnedStateID
IntSetting DecibelScaleCutoff
Negation of this value is the lowest dB level that should be shown in dB scales.
XXO("&Cut/Copy/Paste Toolbar")
static float ClipZeroToOne(float z)
static int intmax(int a, int b)
static const long MIN_REFRESH_RATE
static const long MAX_REFRESH_RATE
static const wxChar * PrefStyles[]
static float ToDB(float v, float range)
static float floatMax(float a, float b)
static int MeterPrefsID()
audacity::BasicSettings * gPrefs
wxFrame * FindProjectFrame(AudacityProject *project)
Get a pointer to the window associated with a project, or null if the given pointer is null,...
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
static void Bevel(wxDC &dc, bool up, const wxRect &r)
static void DrawFocus(wxDC &dc, wxRect &r)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
void Popup(const BasicUI::WindowPlacement &window, const Point &pos={})
Display the menu at pos, invoke at most one action, then hide it.
static const LinearUpdater & Instance()
Inherits wxPanel and has a Meter; exposes shared_ptr to the Meter.
static TempAllowFocus TemporarilyAllowFocus()
MeterPanel is a panel that paints the meter used for monitoring or playback.
void HandleLayout(wxDC &dc)
void OnCharHook(wxKeyEvent &evt)
void UpdatePrefs() override
void UpdateDisplay(unsigned numChannels, int numFrames, const float *sampleData) override
Update the meters with a block of audio data.
void ResetBar(MeterBar *bar, bool resetClipping)
void OnTipTimeout(wxTimerEvent &evt)
void OnKeyDown(wxKeyEvent &evt)
void Decrease(float steps)
float GetPeakHold() const
void OnErase(wxEraseEvent &evt)
void SetFocusFromKbd() override
void OnContext(wxContextMenuEvent &evt)
void Increase(float steps)
wxBrush mDisabledBkgndBrush
std::unique_ptr< LWSlider > mSlider
wxString Key(const wxString &key) const
AudacityProject * mProject
MeterBar mBar[kMaxMeterBars]
bool IsMonitoring() const
void OnAudioIOStatus(AudioIOEvent)
bool IsClipping() const override
void UpdateSliderControl()
void OnMonitor(wxCommandEvent &evt)
void OnMouse(wxMouseEvent &evt)
void SetBarAndClip(int iBar, bool vert)
std::unique_ptr< wxBitmap > mBitmap
void OnPreferences(wxCommandEvent &evt)
void OnSetFocus(wxFocusEvent &evt)
void SetStyle(Style newStyle)
void ShowMenu(const wxPoint &pos)
int mNumPeakSamplesToClip
void OnPaint(wxPaintEvent &evt)
void UpdateSelectedPrefs(int) override
@ HorizontalStereoCompact
void OnMeterUpdate(wxTimerEvent &evt)
void SetActiveStyle(Style style)
void Reset(double sampleRate, bool resetClipping) override
This method is thread-safe! Feel free to call from a different thread (like from an audio I/O callbac...
void DrawMeterBar(wxDC &dc, MeterBar *meterBar)
void OnAudioCapture(AudioIOEvent)
float GetMaxPeak() const override
void OnSize(wxSizeEvent &evt)
void OnKillFocus(wxFocusEvent &evt)
void SetMixer(wxCommandEvent &event)
void RestoreState(const State &state)
bool IsMeterDisabled() const override
Find out if the level meter is disabled or not.
Message used to update the MeterPanel.
bool clipping[kMaxMeterBars]
float peak[kMaxMeterBars]
int tailPeakCount[kMaxMeterBars]
int headPeakCount[kMaxMeterBars]
wxString toStringIfClipped()
Only print meter updates if clipping may be happening.
wxString toString()
Print out all the values in the meter update message.
bool Put(MeterUpdateMsg &msg)
ArrayOf< MeterUpdateMsg > mBuffer
NonInterfering< std::atomic< size_t > > mEnd
NonInterfering< std::atomic< size_t > > mStart
MeterUpdateQueue(size_t maxLen)
bool Get(MeterUpdateMsg &msg)
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
static void Broadcast(int id=0)
Call this static function to notify all PrefsListener objects.
static AudioIOStartStreamOptions GetDefaultOptions(AudacityProject &project, bool newDefaults=false)
Invoke the global hook, supplying a default argument.
void SetTickColour(const wxColour &colour)
void OfflimitsPixels(int start, int end)
void SetOrientation(int orient)
void SetFormat(const RulerFormat *pFormat)
void Draw(wxDC &dc) const
void GetMaxSize(wxCoord *width, wxCoord *height)
void SetBounds(int left, int top, int right, int bottom)
void SetRange(double min, double max)
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined */
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
wxColour & Colour(int iIndex)
int ColourDistance(wxColour &From, wxColour &To)
Holds a msgid for the translation catalog; may also bind format arguments.
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0
virtual bool Read(const wxString &key, bool *value) const =0
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
void SetName(const TranslatableString &title)
void SetFocus(const WindowPlacement &focus)
Set the window that accepts keyboard input.
std::unique_ptr< WindowPlacement > FindFocus()
Find the window that is accepting keyboard input, if any.
constexpr auto sampleRate
const char * end(const char *str) noexcept
__finl float_x4 __vecc sqrt(const float_x4 &a)
enum AudioIOEvent::Type type
AudacityProject * pProject
A struct used by MeterPanel to hold the position of one bar.