16#ifndef __AUDACITY_METER_PANEL__
17#define __AUDACITY_METER_PANEL__
103 ,
public NonInterferingBase
121 wxWindow* parent, wxWindowID
id,
123 const wxPoint& pos = wxDefaultPosition,
124 const wxSize&
size = wxDefaultSize,
125 Style style = HorizontalStereo,
126 float fDecayRate = 60.0f);
128 void SetFocusFromKbd()
override;
130 void Clear()
override;
134 void SetStyle(Style newStyle);
166 int numFrames,
const float *sampleData)
override;
183 float GetPeakHold()
const;
185 bool IsMonitoring()
const;
186 bool IsActive()
const;
190 void StartMonitoring();
191 void StopMonitoring();
196 void RestoreState(
const State &state);
197 void SetMixer(wxCommandEvent& event);
199 int GetDBRange()
const override {
return mDB ? mDBRange : -1; }
202 void Increase(
float steps);
203 void Decrease(
float steps);
204 void UpdateSliderControl();
206 void ShowMenu(
const wxPoint & pos);
218 void OnErase(wxEraseEvent &evt);
219 void OnPaint(wxPaintEvent &evt);
220 void OnSize(wxSizeEvent &evt);
221 void OnMouse(wxMouseEvent &evt);
222 void OnKeyDown(wxKeyEvent &evt);
223 void OnCharHook(wxKeyEvent &evt);
224 void OnContext(wxContextMenuEvent &evt);
225 void OnSetFocus(wxFocusEvent &evt);
226 void OnKillFocus(wxFocusEvent &evt);
231 void OnMeterUpdate(wxTimerEvent &evt);
232 void OnTipTimeout(wxTimerEvent& evt);
234 void HandleLayout(wxDC &dc);
235 void SetActiveStyle(Style style);
236 void SetBarAndClip(
int iBar,
bool vert);
237 void DrawMeterBar(wxDC &dc,
MeterBar *meterBar);
238 void ResetBar(
MeterBar *bar,
bool resetClipping);
239 void RepaintBarsNow();
240 wxFont GetFont()
const;
245 void OnMonitor(wxCommandEvent &evt);
248 wxString Key(
const wxString &
key)
const;
278 long mMeterRefreshRate{};
279 long mMeterDisabled{};
311 bool mEnabled{
true };
316 friend class MeterAx;
318 DECLARE_EVENT_TABLE()
const TranslatableString name
static void OnSize(wxSizeEvent &evt)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Inherits wxPanel and has a Meter; exposes shared_ptr to the Meter.
virtual bool IsClipping() const =0
virtual bool IsMeterDisabled() const =0
virtual void UpdateDisplay(unsigned numChannels, int numFrames, const float *sampleData)=0
virtual float GetMaxPeak() const =0
virtual void Reset(double sampleRate, bool resetClipping)=0
MeterPanel is a panel that paints the meter used for monitoring or playback.
Observer::Subscription mAudioCaptureSubscription
wxBrush mDisabledBkgndBrush
std::unique_ptr< LWSlider > mSlider
AudacityProject * mProject
Style GetDesiredStyle() const
Observer::Subscription mAudioIOStatusSubscription
std::unique_ptr< wxBitmap > mBitmap
int mNumPeakSamplesToClip
@ HorizontalStereoCompact
int GetDBRange() const override
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.
Queue of MeterUpdateMsg used to feed the MeterPanel.
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)
A move-only handle representing a connection to a Publisher.
A listener notified of changes in preferences.
virtual void UpdateSelectedPrefs(int id)
virtual void UpdatePrefs()=0
Holds a msgid for the translation catalog; may also bind format arguments.
constexpr auto sampleRate
A struct used by MeterPanel to hold the position of one bar.