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 "));
190#include "../../images/SpeakerMenu.xpm"
191#include "../../images/MicMenu.xpm"
198 wxT(
"AutomaticStereo"),
199 wxT(
"HorizontalStereo"),
200 wxT(
"VerticalStereo")
230 wxWindow* parent, wxWindowID
id,
236:
MeterPanelBase(parent,
id, pos,
size, wxTAB_TRAVERSAL | wxNO_BORDER | wxWANTS_CHARS),
242 mDesiredStyle(
style),
247 mDecayRate(fDecayRate),
249 mNumPeakSamplesToClip(3),
250 mPeakHoldDuration(3),
261 SetName(
XO(
"Meter") );
263 wxUnusedVar(SpeakerMenu_xpm);
264 wxUnusedVar(MicMenu_xpm);
267 mStyle = mDesiredStyle;
271#if wxUSE_ACCESSIBILITY
272 SetAccessible(
safenew MeterAx(
this));
276 mRuler.SetFonts(GetFont(), GetFont(), GetFont());
278 mRuler.SetLabelEdges(
true);
283 mSlider = std::make_unique<LWSlider>(
this,
XO(
""),
292 mSlider->SetScroll(0.1f, 2.0f);
295 UpdateSliderControl();
299 mBkgndBrush = wxBrush(backgroundColour, wxBRUSHSTYLE_SOLID);
300 SetBackgroundColour( backgroundColour );
302 mPeakPeakPen = wxPen(
theTheme.
Colour( clrMeterPeak), 1, wxPENSTYLE_SOLID);
311 mPen = wxPen(
theTheme.
Colour( clrMeterInputPen ), 1, wxPENSTYLE_SOLID);
312 mBrush = wxBrush(
theTheme.
Colour( clrMeterInputBrush ), wxBRUSHSTYLE_SOLID);
313 mRMSBrush = wxBrush(
theTheme.
Colour( clrMeterInputRMSBrush ), wxBRUSHSTYLE_SOLID);
314 mClipBrush = wxBrush(
theTheme.
Colour( clrMeterInputClipBrush ), wxBRUSHSTYLE_SOLID);
319 mPen = wxPen(
theTheme.
Colour( clrMeterOutputPen ), 1, wxPENSTYLE_SOLID);
320 mBrush = wxBrush(
theTheme.
Colour( clrMeterOutputBrush ), wxBRUSHSTYLE_SOLID);
321 mRMSBrush = wxBrush(
theTheme.
Colour( clrMeterOutputRMSBrush ), wxBRUSHSTYLE_SOLID);
322 mClipBrush = wxBrush(
theTheme.
Colour( clrMeterOutputClipBrush ), wxBRUSHSTYLE_SOLID);
334 Reset(44100.0,
true);
356 if (
style ==
wxT(
"AutomaticStereo"))
360 else if (
style ==
wxT(
"HorizontalStereo"))
364 else if (
style ==
wxT(
"VerticalStereo"))
390 static int value = wxNewId();
414 float playbackVolume;
422 gAudioIO->GetMixer(&inputSource, &inputVolume, &playbackVolume);
424 const auto volume =
mIsInput ? inputVolume : playbackVolume;
439#if defined(__WXMAC__)
440 auto paintDC = std::make_unique<wxPaintDC>(
this);
442 std::unique_ptr<wxDC> paintDC{ wxAutoBufferedPaintDCFactory(
this) };
444 wxDC & destDC = *paintDC;
451 mBitmap = std::make_unique<wxBitmap>();
460 dc.SetPen(*wxTRANSPARENT_PEN);
468 dc.SetTextForeground( clrText );
469 dc.SetTextBackground( clrBoxFill );
475 wxColor green(117, 215, 112);
476 wxColor yellow(255, 255, 0);
477 wxColor red(255, 0, 0);
482 if (GetBackgroundColour().GetLuminance() < 0.25)
484 green = wxColor(117-100, 215-100, 112-100);
485 yellow = wxColor(255-100, 255-100, 0);
486 red = wxColor(255-100, 0, 0);
488 else if (GetBackgroundColour().GetLuminance() < 0.50)
490 green = wxColor(117-50, 215-50, 112-50);
491 yellow = wxColor(255-50, 255-50, 0);
492 red = wxColor(255-50, 0, 0);
496 for (
unsigned int i = 0; i <
mNumBars; i++)
499 wxRect r =
mBar[i].
r;
508 gradw = (double) r.GetWidth() /
mDBRange * 6.0;
509 gradh = (double) r.GetHeight() /
mDBRange * 6.0;
513 gradw = (double) r.GetWidth() / 100 * 25;
514 gradh = (double) r.GetHeight() / 100 * 25;
521 dc.GradientFillLinear(r, red, yellow, wxSOUTH);
524 r.SetTop(r.GetBottom());
525 dc.GradientFillLinear(r, yellow, green, wxSOUTH);
528 r.SetTop(r.GetBottom());
529 r.SetBottom(
mBar[i].r.GetBottom());
530 dc.SetPen(*wxTRANSPARENT_PEN);
537 r.SetWidth(r.GetWidth() - (int) (gradw + gradw + 0.5));
538 dc.SetPen(*wxTRANSPARENT_PEN);
543 r.SetLeft(r.GetRight() + 1);
544 r.SetWidth(floor(gradw));
545 dc.GradientFillLinear(r, green, yellow);
548 r.SetLeft(r.GetRight() + 1);
549 r.SetRight(
mBar[i].r.GetRight());
550 dc.GradientFillLinear(r, yellow, red);
552#ifdef EXPERIMENTAL_METER_LED_STYLE
555 wxRect r =
mBar[i].
r;
557 BackgroundPen.SetColour( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE) );
558 dc.SetPen( BackgroundPen );
560 for(i=0;i<r.width;i++)
568 int j = abs( (i%7)-4);
570 AColor::Line( dc, i+r.x, r.y+r.height-j, i+r.x, r.y+r.height );
580 dc.SetBrush(*wxTRANSPARENT_BRUSH);
583 dc.DrawRectangle(wxRect(
584 mBar[0].r.GetTopLeft(),
589 for(
unsigned n = 0; n <
mNumBars - 1; ++n)
590 dc.DrawLine(
mBar[n].
b.GetBottomLeft(),
mBar[n].
b.GetBottomRight());
591 if constexpr (
gap > 0)
593 for(
unsigned n = 1; n <
mNumBars; ++n)
594 dc.DrawLine(
mBar[n].
b.GetTopLeft(),
mBar[n].
b.GetTopRight());
598 for(
unsigned n = 0; n <
mNumBars; ++n)
599 dc.DrawRectangle(wxRect(
mBar[n].rClip).Inflate(1));
603 dc.SetTextForeground( clrText );
608 dc.SelectObject(wxNullBitmap);
612 destDC.DrawBitmap(*
mBitmap, 0, 0);
615 for (
unsigned int i = 0; i <
mNumBars; i++)
620 destDC.SetTextForeground( clrText );
631 destDC.SetBackgroundMode( wxSOLID );
632 destDC.SetTextBackground( clrBoxFill );
642 ::wxGetMousePosition()));
646 mSlider->OnPaint(destDC, highlighted);
651 auto r = GetClientRect();
666 if ((evt.GetEventType() == wxEVT_MOTION || evt.Entering() || evt.Leaving())) {
674 if (evt.Entering()) {
677 else if(evt.Leaving())
692 switch(evt.GetKeyCode())
698 case WXK_NUMPAD_ENTER:
699 case WXK_WINDOWS_MENU:
702 ShowMenu(GetClientRect().GetBottomLeft());
716 ShowMenu(GetClientRect().GetBottomLeft());
726 switch (evt.GetKeyCode())
730 Navigate(wxNavigationKeyEvent::IsBackward);
732 Navigate(wxNavigationKeyEvent::IsForward);
780 gAudioIO->GetMixer(&inputSource, &inputVolume, &outputVolume);
787 gAudioIO->SetMixer(inputSource, inputVolume, outputVolume);
789#if wxUSE_ACCESSIBILITY
790 GetAccessible()->NotifyEvent( wxACC_EVENT_OBJECT_VALUECHANGE,
805 auto changed =
mSlider->ShowDialog();
887static float ToDB(
float v,
float range)
898 unsigned numChannels,
int numFrames,
const float *sampleData)
900 auto sptr = sampleData;
904 memset(&msg, 0,
sizeof(msg));
907 for(
int i=0; i<numFrames; i++) {
908 for(
unsigned int j=0; j<num; j++) {
910 msg.
rms[j] += sptr[j]*sptr[j];
928 for(
unsigned int j=0; j<
mNumBars; j++)
983#ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
984 double maxPeak = 0.0;
985 bool discarded =
false;
1005 for(
unsigned int j=0; j<
mNumBars; j++) {
1031 float smooth = pow(0.9, (
double)msg.
numFrames/1024.0);
1040 if (
mBar[j].peak >
mBar[j].peakPeakHold )
1051#ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
1052 if (
mT > gAudioIO->AILAGetLastDecisionTime()) {
1054 maxPeak = msg.
peak[j] > maxPeak ? msg.
peak[j] : maxPeak;
1055 wxPrintf(
"%f@%f ", msg.
peak[j],
mT);
1059 wxPrintf(
"%f@%f discarded\n", msg.
peak[j],
mT);
1065 if (numChanges > 0) {
1066 #ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
1067 if (gAudioIO->AILAIsActive() &&
mIsInput && !discarded) {
1068 gAudioIO->AILAProcess(maxPeak);
1087 for(
unsigned int j=0; j<
mNumBars; j++)
1088 maxPeak =
mBar[j].peak > maxPeak ?
mBar[j].peak : maxPeak;
1095 auto peakHold = .0f;
1096 for (
unsigned int i = 0; i <
mNumBars; i++)
1097 peakHold = std::max(peakHold,
mBar[i].peakPeakHold);
1104#if defined __WXMSW__
1108 return wxFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1139 if (
mBar[c].clipping)
1187 constexpr static auto StrokeWidth = 1;
1189 constexpr static auto ClipIndicatorSize = 3;
1190 constexpr static auto ClipIndicatorPadding = 1;
1201 mBar[iBar].b.x + StrokeWidth,
1202 mBar[iBar].
b.y + StrokeWidth,
1203 mBar[iBar].
b.width - StrokeWidth * 2,
1208 constexpr auto yOffset =
1209 gap + ClipIndicatorPadding + StrokeWidth * 2 + ClipIndicatorSize;
1210 mBar[iBar].
b.y += yOffset;
1211 mBar[iBar].
b.height -= yOffset;
1216 mBar[iBar].b.GetRight() - StrokeWidth - ClipIndicatorSize + 1,
1217 mBar[iBar].
b.GetTop() + StrokeWidth,
1219 mBar[iBar].
b.height - StrokeWidth * 2
1222 mBar[iBar].
b.width -=
1223 gap + ClipIndicatorPadding + StrokeWidth * 2 + ClipIndicatorSize;
1228 mBar[iBar].
r.Deflate(StrokeWidth);
1281 wxPrintf(
wxT(
"Style not handled yet!\n"));
1288 height -= top +
gap;
1291 barw = (width -
gap) / 2;
1300 mBar[0].
b = wxRect(left, top, barw, barh);
1313 mBar[1].
r.GetBottom());
1318 lside = ltxtWidth +
gap;
1335 width -=
gap + rside +
gap + left;
1338 height -= top +
gap;
1344 barw = (width -
gap) / 2;
1353 mBar[0].
b = wxRect(left, top, barw, barh);
1366 mBar[1].
r.GetBottom());
1374 height -= top +
gap + ltxtHeight +
gap;
1380 barw = (width / 2) -
gap;
1389 mBar[0].
b = wxRect(left, top, barw, barh);
1406 mBar[1].
r.GetBottom());
1419 height -= rtxtHeight +
gap;
1422 mLeftTextPos = wxPoint(left, (height / 4) - ltxtHeight / 2);
1423 mRightTextPos = wxPoint(left, (height * 3 / 4) - rtxtHeight / 2);
1426 left +=
intmax(ltxtWidth, rtxtWidth);
1442 barh = (height -
gap) / 2;
1448 mBar[0].
b = wxRect(left, top, barw, barh);
1459 mBar[1].
r.GetBottom() + 1,
1460 mBar[1].
r.GetRight(),
1467 mLeftTextPos = wxPoint(left, (height / 4) - (ltxtHeight / 2));
1468 mRightTextPos = wxPoint(left, (height * 3 / 4) - (ltxtHeight / 2));
1471 left +=
intmax(ltxtWidth, rtxtWidth);
1487 barh = (height -
gap) / 2;
1493 mBar[0].
b = wxRect(left, top, barw, barh);
1509 mBar[1].
r.GetRight(),
1523 for (
unsigned int i = 0; i <
mNumBars; i++)
1538 wxCoord x = bar->
r.GetLeft();
1539 wxCoord y = bar->
r.GetTop();
1540 wxCoord w = bar->
r.GetWidth();
1541 wxCoord h = bar->
r.GetHeight();
1546 dc.SetPen(*wxTRANSPARENT_PEN);
1561 ht = (int)(bar->
peak * (h - 1) + 0.5);
1567 dc.DrawRectangle(x, y, w, h - ht);
1575 dc.Blit(x, y + h - ht - 1, w, ht + 1, &srcDC, x, y + h - ht - 1);
1581 ht = (int)(bar->
peakHold * (h - 1) + 0.5);
1584 dc.Blit(x, y + h - ht - 1, w, 2, &srcDC, x, y + h - ht - 1);
1593 AColor::Line(dc, x, y + h - ht - 1, x + w - 1, y + h - ht - 1);
1596 AColor::Line(dc, x, y + h - ht, x + w - 1, y + h - ht);
1604 wd = (int)(bar->
peak * (w - 1) + 0.5);
1610 dc.DrawRectangle(x + wd, y, w - wd, h);
1619 dc.Blit(x, y, wd + 1, h, &srcDC, x, y);
1625 wd = (int)(bar->
peakHold * (w - 1) + 0.5);
1628 dc.Blit(x + wd - 1, y, 2, h, &srcDC, x + wd, y);
1640 AColor::Line(dc, x + wd - 1, y, x + wd - 1, y + h - 1);
1646 srcDC.SelectObject(wxNullBitmap);
1654 ht = (int)(bar->
peak * (h - 1) + 0.5);
1660 dc.DrawRectangle(x, y, w, h - ht);
1665 dc.SetPen(*wxTRANSPARENT_PEN);
1669 dc.DrawRectangle(x, y + h - ht - 1, w, ht + 1);
1675 ht = (int)(bar->
peakHold * (h - 1) + 0.5);
1678 AColor::Line(dc, x, y + h - ht - 1, x + w - 1, y + h - ht - 1);
1681 AColor::Line(dc, x, y + h - ht, x + w - 1, y + h - ht);
1688 ht = (int)(bar->
rms * (h - 1) + 0.5);
1691 dc.SetPen(*wxTRANSPARENT_PEN);
1695 dc.DrawRectangle(x, y + h - ht - 1, w, ht + 1);
1704 AColor::Line(dc, x, y + h - ht - 1, x + w - 1, y + h - ht - 1);
1707 AColor::Line(dc, x, y + h - ht, x + w - 1, y + h - ht);
1715 wd = (int)(bar->
peak * (w - 1) + 0.5);
1721 dc.DrawRectangle(x + wd, y, w - wd, h);
1726 dc.SetPen(*wxTRANSPARENT_PEN);
1730 dc.DrawRectangle(x, y, wd + 1, h);
1736 wd = (int)(bar->
peakHold * (w - 1) + 0.5);
1742 AColor::Line(dc, x + wd - 1, y, x + wd - 1, y + h - 1);
1748 wd = (int)(bar->
rms * (w - 1) + 0.5);
1752 dc.SetPen(*wxTRANSPARENT_PEN);
1756 dc.DrawRectangle(x, y, wd + 1, h);
1768 AColor::Line(dc, x + wd - 1, y, x + wd - 1, y + h - 1);
1787 dc.SetPen(*wxTRANSPARENT_PEN);
1788 dc.DrawRectangle(bar->
rClip);
1802 if (gAudioIO->IsMonitoring()){
1803 gAudioIO->StopStream();
1806 if (start && !gAudioIO->IsBusy()){
1820 if (gAudioIO->IsMonitoring()){
1821 gAudioIO->StopStream();
1845 if (IsShownOnScreen())
1867 return {
true, mMonitoring, mActive };
1894 mi = menu.Append(
OnMonitorID,
_(
"Disable Silent Monitoring"));
1896 mi = menu.Append(
OnMonitorID,
_(
"Enable Silent Monitoring"));
1924 wxRadioButton *gradient;
1927 wxRadioButton *linear;
1928 wxRadioButton *automatic;
1929 wxRadioButton *horizontal;
1930 wxRadioButton *vertical;
1933 auto title =
mIsInput ?
XO(
"Recording Meter Options") :
XO(
"Playback Meter Options");
1941 S.StartVerticalLay();
1943 S.StartStatic(
XO(
"Refresh Rate"), 0);
1946"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."));
1947 S.StartHorizontalLay();
1949 rate =
S.Name(
XO(
"Meter refresh rate per second [1-100]"))
1950 .Validator<IntegerValidator<long>>(
1953 .AddTextBox(
XXO(
"Meter refresh rate per second [1-100]: "),
1954 wxString::Format(
wxT(
"%d"), meterRefreshRate),
1957 S.EndHorizontalLay();
1961 S.StartHorizontalLay();
1963 S.StartStatic(
XO(
"Meter Style"), 0);
1965 S.StartVerticalLay();
1967 gradient =
S.AddRadioButton(
XXO(
"Gradient"),
true,
mGradient);
1968 rms =
S.AddRadioButtonToGroup(
XXO(
"RMS"),
false,
mGradient);
1974 S.StartStatic(
XO(
"Meter Type"), 0);
1976 S.StartVerticalLay();
1978 db =
S.AddRadioButton(
XXO(
"dB"),
true,
mDB);
1979 linear =
S.AddRadioButtonToGroup(
XXO(
"Linear"),
false,
mDB);
1985 S.StartStatic(
XO(
"Orientation"), 1);
1987 S.StartVerticalLay();
1989 automatic =
S.AddRadioButton(
1991 horizontal =
S.AddRadioButtonToGroup(
1993 vertical =
S.AddRadioButtonToGroup(
2000 S.EndHorizontalLay();
2001 S.AddStandardButtons();
2007 dlg.CenterOnParent();
2009 if (dlg.ShowModal() == wxID_OK)
2012 wxT(
"AutomaticStereo") ,
2013 wxT(
"HorizontalStereo") ,
2014 wxT(
"VerticalStereo") ,
2018 s = automatic->GetValue() ? 0 : s;
2019 s = horizontal->GetValue() ? 1 : s;
2020 s = vertical->GetValue() ? 2 : s;
2040 return wxT(
"/Meter/Mixerboard/") +
key;
2045 return wxT(
"/Meter/Input/") +
key;
2048 return wxT(
"/Meter/Output/") +
key;
2061#if wxUSE_ACCESSIBILITY
2063MeterAx::MeterAx(wxWindow *window):
2076wxAccStatus MeterAx::DoDefaultAction(
int WXUNUSED(childId))
2088wxAccStatus MeterAx::GetChild(
int childId, wxAccessible** child)
2090 if (childId == wxACC_SELF)
2098wxAccStatus MeterAx::GetChildCount(
int* childCount)
2111wxAccStatus MeterAx::GetDefaultAction(
int WXUNUSED(childId), wxString* actionName)
2113 *actionName =
_(
"Press");
2118wxAccStatus MeterAx::GetDescription(
int WXUNUSED(childId), wxString *description)
2120 description->clear();
2121 return wxACC_NOT_SUPPORTED;
2128wxAccStatus MeterAx::GetFocus(
int* childId, wxAccessible** child)
2136wxAccStatus MeterAx::GetHelpText(
int WXUNUSED(childId), wxString *helpText)
2139 return wxACC_NOT_SUPPORTED;
2144wxAccStatus MeterAx::GetKeyboardShortcut(
int WXUNUSED(childId), wxString *shortcut)
2152wxAccStatus MeterAx::GetLocation(wxRect & rect,
int WXUNUSED(elementId))
2156 rect = m->GetClientRect();
2157 rect.SetPosition(m->ClientToScreen(rect.GetPosition()));
2163wxAccStatus MeterAx::GetRole(
int WXUNUSED(childId), wxAccRole* role)
2165 *role = wxROLE_SYSTEM_SLIDER;
2178wxAccStatus MeterAx::GetSelections(wxVariant * WXUNUSED(selections))
2180 return wxACC_NOT_IMPLEMENTED;
2184wxAccStatus MeterAx::GetState(
int WXUNUSED(childId),
long* state)
2188 *state = wxACC_STATE_SYSTEM_FOCUSABLE;
2196wxAccStatus MeterAx::GetValue(
int WXUNUSED(childId), wxString* strValue)
2200 *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 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)
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.
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
__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.