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);
374 mPen = wxPen(
theTheme.
Colour( clrMeterInputPen ), 1, wxPENSTYLE_SOLID);
375 mBrush = wxBrush(
theTheme.
Colour( clrMeterInputBrush ), wxBRUSHSTYLE_SOLID);
376 mRMSBrush = wxBrush(
theTheme.
Colour( clrMeterInputRMSBrush ), wxBRUSHSTYLE_SOLID);
377 mClipBrush = wxBrush(
theTheme.
Colour( clrMeterInputClipBrush ), wxBRUSHSTYLE_SOLID);
382 mPen = wxPen(
theTheme.
Colour( clrMeterOutputPen ), 1, wxPENSTYLE_SOLID);
383 mBrush = wxBrush(
theTheme.
Colour( clrMeterOutputBrush ), wxBRUSHSTYLE_SOLID);
384 mRMSBrush = wxBrush(
theTheme.
Colour( clrMeterOutputRMSBrush ), wxBRUSHSTYLE_SOLID);
385 mClipBrush = wxBrush(
theTheme.
Colour( clrMeterOutputClipBrush ), wxBRUSHSTYLE_SOLID);
397 Reset(44100.0,
true);
419 if (
style ==
wxT(
"AutomaticStereo"))
423 else if (
style ==
wxT(
"HorizontalStereo"))
427 else if (
style ==
wxT(
"VerticalStereo"))
453 static int value = wxNewId();
477 float playbackVolume;
485 gAudioIO->GetMixer(&inputSource, &inputVolume, &playbackVolume);
487 const auto volume =
mIsInput ? inputVolume : playbackVolume;
502#if defined(__WXMAC__)
503 auto paintDC = std::make_unique<wxPaintDC>(
this);
505 std::unique_ptr<wxDC> paintDC{ wxAutoBufferedPaintDCFactory(
this) };
507 wxDC & destDC = *paintDC;
514 mBitmap = std::make_unique<wxBitmap>();
530 dc.SetPen(*wxTRANSPARENT_PEN);
539 dc.SetTextForeground( clrText );
540 dc.SetTextBackground( clrBoxFill );
546 wxColor green(117, 215, 112);
547 wxColor yellow(255, 255, 0);
548 wxColor red(255, 0, 0);
553 if (GetBackgroundColour().GetLuminance() < 0.25)
555 green = wxColor(117-100, 215-100, 112-100);
556 yellow = wxColor(255-100, 255-100, 0);
557 red = wxColor(255-100, 0, 0);
559 else if (GetBackgroundColour().GetLuminance() < 0.50)
561 green = wxColor(117-50, 215-50, 112-50);
562 yellow = wxColor(255-50, 255-50, 0);
563 red = wxColor(255-50, 0, 0);
567 for (
unsigned int i = 0; i <
mNumBars; i++)
579 wxRect r =
mBar[i].
r;
588 gradw = (double) r.GetWidth() /
mDBRange * 6.0;
589 gradh = (double) r.GetHeight() /
mDBRange * 6.0;
593 gradw = (double) r.GetWidth() / 100 * 25;
594 gradh = (double) r.GetHeight() / 100 * 25;
601 dc.GradientFillLinear(r, red, yellow, wxSOUTH);
604 r.SetTop(r.GetBottom());
605 dc.GradientFillLinear(r, yellow, green, wxSOUTH);
608 r.SetTop(r.GetBottom());
609 r.SetBottom(
mBar[i].r.GetBottom());
610 dc.SetPen(*wxTRANSPARENT_PEN);
617 r.SetWidth(r.GetWidth() - (int) (gradw + gradw + 0.5));
618 dc.SetPen(*wxTRANSPARENT_PEN);
623 r.SetLeft(r.GetRight() + 1);
624 r.SetWidth(floor(gradw));
625 dc.GradientFillLinear(r, green, yellow);
628 r.SetLeft(r.GetRight() + 1);
629 r.SetRight(
mBar[i].r.GetRight());
630 dc.GradientFillLinear(r, yellow, red);
632#ifdef EXPERIMENTAL_METER_LED_STYLE
635 wxRect r =
mBar[i].
r;
637 BackgroundPen.SetColour( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE) );
638 dc.SetPen( BackgroundPen );
640 for(i=0;i<r.width;i++)
648 int j = abs( (i%7)-4);
650 AColor::Line( dc, i+r.x, r.y+r.height-j, i+r.x, r.y+r.height );
658 dc.SetTextForeground( clrText );
663 dc.SelectObject(wxNullBitmap);
667 destDC.DrawBitmap(*
mBitmap, 0, 0);
670 for (
unsigned int i = 0; i <
mNumBars; i++)
675 destDC.SetTextForeground( clrText );
686 destDC.SetBackgroundMode( wxSOLID );
687 destDC.SetTextBackground( clrBoxFill );
697 ::wxGetMousePosition()));
701 mSlider->OnPaint(destDC, highlighted);
706 auto r = GetClientRect();
721 if ((evt.GetEventType() == wxEVT_MOTION || evt.Entering() || evt.Leaving())) {
729 if (evt.Entering()) {
732 else if(evt.Leaving())
747 switch(evt.GetKeyCode())
753 case WXK_NUMPAD_ENTER:
754 case WXK_WINDOWS_MENU:
757 ShowMenu(GetClientRect().GetBottomLeft());
771 ShowMenu(GetClientRect().GetBottomLeft());
781 switch (evt.GetKeyCode())
785 Navigate(wxNavigationKeyEvent::IsBackward);
787 Navigate(wxNavigationKeyEvent::IsForward);
835 gAudioIO->GetMixer(&inputSource, &inputVolume, &outputVolume);
842 gAudioIO->SetMixer(inputSource, inputVolume, outputVolume);
844#if wxUSE_ACCESSIBILITY
845 GetAccessible()->NotifyEvent( wxACC_EVENT_OBJECT_VALUECHANGE,
860 auto changed =
mSlider->ShowDialog();
942static float ToDB(
float v,
float range)
953 unsigned numChannels,
int numFrames,
const float *sampleData)
955 auto sptr = sampleData;
959 memset(&msg, 0,
sizeof(msg));
962 for(
int i=0; i<numFrames; i++) {
963 for(
unsigned int j=0; j<num; j++) {
965 msg.
rms[j] += sptr[j]*sptr[j];
983 for(
unsigned int j=0; j<
mNumBars; j++)
1038#ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
1039 double maxPeak = 0.0;
1040 bool discarded =
false;
1060 for(
unsigned int j=0; j<
mNumBars; j++) {
1086 float smooth = pow(0.9, (
double)msg.
numFrames/1024.0);
1095 if (
mBar[j].peak >
mBar[j].peakPeakHold )
1106#ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
1107 if (
mT > gAudioIO->AILAGetLastDecisionTime()) {
1109 maxPeak = msg.
peak[j] > maxPeak ? msg.
peak[j] : maxPeak;
1110 wxPrintf(
"%f@%f ", msg.
peak[j],
mT);
1114 wxPrintf(
"%f@%f discarded\n", msg.
peak[j],
mT);
1120 if (numChanges > 0) {
1121 #ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
1122 if (gAudioIO->AILAIsActive() &&
mIsInput && !discarded) {
1123 gAudioIO->AILAProcess(maxPeak);
1142 for(
unsigned int j=0; j<
mNumBars; j++)
1143 maxPeak =
mBar[j].peak > maxPeak ?
mBar[j].peak : maxPeak;
1150 auto peakHold = .0f;
1151 for (
unsigned int i = 0; i <
mNumBars; i++)
1152 peakHold = std::max(peakHold,
mBar[i].peakPeakHold);
1159#if defined __WXMSW__
1163 return wxFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1194 if (
mBar[c].clipping)
1247 mBar[iBar].
r.x += 1;
1248 mBar[iBar].
r.width -= 1;
1249 mBar[iBar].
r.y += 1;
1250 mBar[iBar].
r.height -= 1;
1272 mBar[iBar].
b.width -= 4;
1273 mBar[iBar].
r.width -= 4;
1333 wxPrintf(
wxT(
"Style not handled yet!\n"));
1340 height -= top +
gap;
1343 barw = (width -
gap) / 2;
1352 mBar[0].
b = wxRect(left, top, barw, barh);
1365 mBar[1].
r.GetBottom());
1370 lside = ltxtWidth +
gap;
1387 width -=
gap + rside +
gap + left;
1390 height -= top +
gap;
1396 barw = (width -
gap) / 2;
1405 mBar[0].
b = wxRect(left, top, barw, barh);
1418 mBar[1].
r.GetBottom());
1426 height -= top +
gap + ltxtHeight +
gap;
1432 barw = (width / 2) -
gap;
1441 mBar[0].
b = wxRect(left, top, barw, barh);
1458 mBar[1].
r.GetBottom());
1471 height -= rtxtHeight +
gap;
1474 mLeftTextPos = wxPoint(left, (height / 4) - ltxtHeight / 2);
1475 mRightTextPos = wxPoint(left, (height * 3 / 4) - rtxtHeight / 2);
1478 left +=
intmax(ltxtWidth, rtxtWidth);
1494 barh = (height -
gap) / 2;
1500 mBar[0].
b = wxRect(left, top, barw, barh);
1511 mBar[1].
r.GetBottom() + 1,
1512 mBar[1].
r.GetRight(),
1519 mLeftTextPos = wxPoint(left, (height / 4) - (ltxtHeight / 2));
1520 mRightTextPos = wxPoint(left, (height * 3 / 4) - (ltxtHeight / 2));
1523 left +=
intmax(ltxtWidth, rtxtWidth);
1539 barh = (height -
gap) / 2;
1545 mBar[0].
b = wxRect(left, top, barw, barh);
1561 mBar[1].
r.GetRight(),
1575 for (
unsigned int i = 0; i <
mNumBars; i++)
1590 wxCoord x = bar->
r.GetLeft();
1591 wxCoord y = bar->
r.GetTop();
1592 wxCoord w = bar->
r.GetWidth();
1593 wxCoord h = bar->
r.GetHeight();
1598 dc.SetPen(*wxTRANSPARENT_PEN);
1612 ht = (int)(bar->
peak * (h - 1) + 0.5);
1618 dc.DrawRectangle(x, y, w, h - ht);
1626 dc.Blit(x, y + h - ht - 1, w, ht + 1, &srcDC, x, y + h - ht - 1);
1632 ht = (int)(bar->
peakHold * (h - 1) + 0.5);
1635 dc.Blit(x, y + h - ht - 1, w, 2, &srcDC, x, y + h - ht - 1);
1644 AColor::Line(dc, x, y + h - ht - 1, x + w - 1, y + h - ht - 1);
1647 AColor::Line(dc, x, y + h - ht, x + w - 1, y + h - ht);
1655 wd = (int)(bar->
peak * (w - 1) + 0.5);
1661 dc.DrawRectangle(x + wd, y, w - wd, h);
1670 dc.Blit(x, y, wd + 1, h, &srcDC, x, y);
1676 wd = (int)(bar->
peakHold * (w - 1) + 0.5);
1679 dc.Blit(x + wd - 1, y, 2, h, &srcDC, x + wd, y);
1691 AColor::Line(dc, x + wd - 1, y, x + wd - 1, y + h - 1);
1697 srcDC.SelectObject(wxNullBitmap);
1705 ht = (int)(bar->
peak * (h - 1) + 0.5);
1711 dc.DrawRectangle(x, y, w, h - ht);
1716 dc.SetPen(*wxTRANSPARENT_PEN);
1720 dc.DrawRectangle(x, y + h - ht - 1, w, ht + 1);
1726 ht = (int)(bar->
peakHold * (h - 1) + 0.5);
1729 AColor::Line(dc, x, y + h - ht - 1, x + w - 1, y + h - ht - 1);
1732 AColor::Line(dc, x, y + h - ht, x + w - 1, y + h - ht);
1739 ht = (int)(bar->
rms * (h - 1) + 0.5);
1742 dc.SetPen(*wxTRANSPARENT_PEN);
1746 dc.DrawRectangle(x, y + h - ht - 1, w, ht + 1);
1755 AColor::Line(dc, x, y + h - ht - 1, x + w - 1, y + h - ht - 1);
1758 AColor::Line(dc, x, y + h - ht, x + w - 1, y + h - ht);
1766 wd = (int)(bar->
peak * (w - 1) + 0.5);
1772 dc.DrawRectangle(x + wd, y, w - wd, h);
1777 dc.SetPen(*wxTRANSPARENT_PEN);
1781 dc.DrawRectangle(x, y, wd + 1, h);
1787 wd = (int)(bar->
peakHold * (w - 1) + 0.5);
1793 AColor::Line(dc, x + wd - 1, y, x + wd - 1, y + h - 1);
1799 wd = (int)(bar->
rms * (w - 1) + 0.5);
1803 dc.SetPen(*wxTRANSPARENT_PEN);
1807 dc.DrawRectangle(x, y, wd + 1, h);
1819 AColor::Line(dc, x + wd - 1, y, x + wd - 1, y + h - 1);
1838 dc.SetPen(*wxTRANSPARENT_PEN);
1839 wxRect r(bar->
rClip.GetX() + 1,
1840 bar->
rClip.GetY() + 1,
1841 bar->
rClip.GetWidth() - 1,
1842 bar->
rClip.GetHeight() - 1);
1843 dc.DrawRectangle(r);
1857 if (gAudioIO->IsMonitoring()){
1858 gAudioIO->StopStream();
1861 if (start && !gAudioIO->IsBusy()){
1875 if (gAudioIO->IsMonitoring()){
1876 gAudioIO->StopStream();
1897 if (IsShownOnScreen())
1919 return {
true, mMonitoring, mActive };
1946 mi = menu.Append(
OnMonitorID,
_(
"Disable Silent Monitoring"));
1948 mi = menu.Append(
OnMonitorID,
_(
"Enable Silent Monitoring"));
1976 wxRadioButton *gradient;
1979 wxRadioButton *linear;
1980 wxRadioButton *automatic;
1981 wxRadioButton *horizontal;
1982 wxRadioButton *vertical;
1985 auto title =
mIsInput ?
XO(
"Recording Meter Options") :
XO(
"Playback Meter Options");
1993 S.StartVerticalLay();
1995 S.StartStatic(
XO(
"Refresh Rate"), 0);
1998"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."));
1999 S.StartHorizontalLay();
2001 rate =
S.Name(
XO(
"Meter refresh rate per second [1-100]"))
2002 .Validator<IntegerValidator<long>>(
2005 .AddTextBox(
XXO(
"Meter refresh rate per second [1-100]: "),
2006 wxString::Format(
wxT(
"%d"), meterRefreshRate),
2009 S.EndHorizontalLay();
2013 S.StartHorizontalLay();
2015 S.StartStatic(
XO(
"Meter Style"), 0);
2017 S.StartVerticalLay();
2019 gradient =
S.AddRadioButton(
XXO(
"Gradient"),
true,
mGradient);
2020 rms =
S.AddRadioButtonToGroup(
XXO(
"RMS"),
false,
mGradient);
2026 S.StartStatic(
XO(
"Meter Type"), 0);
2028 S.StartVerticalLay();
2030 db =
S.AddRadioButton(
XXO(
"dB"),
true,
mDB);
2031 linear =
S.AddRadioButtonToGroup(
XXO(
"Linear"),
false,
mDB);
2037 S.StartStatic(
XO(
"Orientation"), 1);
2039 S.StartVerticalLay();
2041 automatic =
S.AddRadioButton(
2043 horizontal =
S.AddRadioButtonToGroup(
2045 vertical =
S.AddRadioButtonToGroup(
2052 S.EndHorizontalLay();
2053 S.AddStandardButtons();
2059 dlg.CenterOnParent();
2061 if (dlg.ShowModal() == wxID_OK)
2064 wxT(
"AutomaticStereo") ,
2065 wxT(
"HorizontalStereo") ,
2066 wxT(
"VerticalStereo") ,
2070 s = automatic->GetValue() ? 0 : s;
2071 s = horizontal->GetValue() ? 1 : s;
2072 s = vertical->GetValue() ? 2 : s;
2092 return wxT(
"/Meter/Mixerboard/") +
key;
2097 return wxT(
"/Meter/Input/") +
key;
2100 return wxT(
"/Meter/Output/") +
key;
2113#if wxUSE_ACCESSIBILITY
2115MeterAx::MeterAx(wxWindow *window):
2128wxAccStatus MeterAx::DoDefaultAction(
int WXUNUSED(childId))
2140wxAccStatus MeterAx::GetChild(
int childId, wxAccessible** child)
2142 if (childId == wxACC_SELF)
2150wxAccStatus MeterAx::GetChildCount(
int* childCount)
2163wxAccStatus MeterAx::GetDefaultAction(
int WXUNUSED(childId), wxString* actionName)
2165 *actionName =
_(
"Press");
2170wxAccStatus MeterAx::GetDescription(
int WXUNUSED(childId), wxString *description)
2172 description->clear();
2173 return wxACC_NOT_SUPPORTED;
2180wxAccStatus MeterAx::GetFocus(
int* childId, wxAccessible** child)
2188wxAccStatus MeterAx::GetHelpText(
int WXUNUSED(childId), wxString *helpText)
2191 return wxACC_NOT_SUPPORTED;
2196wxAccStatus MeterAx::GetKeyboardShortcut(
int WXUNUSED(childId), wxString *shortcut)
2204wxAccStatus MeterAx::GetLocation(wxRect & rect,
int WXUNUSED(elementId))
2208 rect = m->GetClientRect();
2209 rect.SetPosition(m->ClientToScreen(rect.GetPosition()));
2215wxAccStatus MeterAx::GetRole(
int WXUNUSED(childId), wxAccRole* role)
2217 *role = wxROLE_SYSTEM_SLIDER;
2230wxAccStatus MeterAx::GetSelections(wxVariant * WXUNUSED(selections))
2232 return wxACC_NOT_IMPLEMENTED;
2236wxAccStatus MeterAx::GetState(
int WXUNUSED(childId),
long* state)
2240 *state = wxACC_STATE_SYSTEM_FOCUSABLE;
2248wxAccStatus MeterAx::GetValue(
int WXUNUSED(childId), wxString* strValue)
2252 *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.