1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 14:02:57 +02:00

Separate an abstract base class from MeterPanel...

... to break its cycle with AudioIO
This commit is contained in:
Paul Licameli
2019-06-04 00:20:42 -04:00
parent 51051ee933
commit 17c04d1749
7 changed files with 47 additions and 27 deletions

View File

@@ -292,7 +292,7 @@ MeterPanel::MeterPanel(AudacityProject *project,
const wxSize& size /*= wxDefaultSize*/,
Style style /*= HorizontalStereo*/,
float fDecayRate /*= 60.0f*/)
: wxPanelWrapper(parent, id, pos, size, wxTAB_TRAVERSAL | wxNO_BORDER | wxWANTS_CHARS),
: MeterPanelBase(parent, id, pos, size, wxTAB_TRAVERSAL | wxNO_BORDER | wxWANTS_CHARS),
mProject(project),
mQueue(1024),
mWidth(size.x),
@@ -2151,6 +2151,10 @@ MeterAx::~MeterAx()
{
}
MeterPanelBase::~MeterPanelBase()
{
}
// Performs the default action. childId is 0 (the action for this object)
// or > 0 (the action for a child).
// Return wxACC_NOT_SUPPORTED if there is no default action for this

View File

@@ -87,11 +87,27 @@ class MeterUpdateQueue
class MeterAx;
class MeterPanelBase /* not final */
: public wxPanelWrapper
{
public:
using wxPanelWrapper::wxPanelWrapper;
~MeterPanelBase() override;
virtual void Clear() = 0;
virtual void Reset(double sampleRate, bool resetClipping) = 0;
virtual void UpdateDisplay(unsigned numChannels,
int numFrames, float *sampleData) = 0;
virtual bool IsMeterDisabled() const = 0;
virtual float GetMaxPeak() const = 0;
private:
};
/********************************************************************//**
\brief MeterPanel is a panel that paints the meter used for monitoring
or playback.
************************************************************************/
class MeterPanel final : public wxPanelWrapper, private PrefsListener
class MeterPanel final : public MeterPanelBase, private PrefsListener
{
DECLARE_DYNAMIC_CLASS(MeterPanel)
@@ -121,7 +137,7 @@ class MeterPanel final : public wxPanelWrapper, private PrefsListener
void SetFocusFromKbd() override;
void Clear();
void Clear() override;
Style GetStyle() const { return mStyle; }
Style GetDesiredStyle() const { return mDesiredStyle; }
@@ -132,7 +148,7 @@ class MeterPanel final : public wxPanelWrapper, private PrefsListener
* This method is thread-safe! Feel free to call from a
* different thread (like from an audio I/O callback).
*/
void Reset(double sampleRate, bool resetClipping);
void Reset(double sampleRate, bool resetClipping) override;
/** \brief Update the meters with a block of audio data
*
@@ -157,7 +173,7 @@ class MeterPanel final : public wxPanelWrapper, private PrefsListener
* The second overload is for ease of use in MixerBoard.
*/
void UpdateDisplay(unsigned numChannels,
int numFrames, float *sampleData);
int numFrames, float *sampleData) override;
// Vaughan, 2010-11-29: This not currently used. See comments in MixerTrackCluster::UpdateMeter().
//void UpdateDisplay(int numChannels, int numFrames,
@@ -171,9 +187,9 @@ class MeterPanel final : public wxPanelWrapper, private PrefsListener
* This method is thread-safe! Feel free to call from a
* different thread (like from an audio I/O callback).
*/
bool IsMeterDisabled() const;
bool IsMeterDisabled() const override;
float GetMaxPeak() const;
float GetMaxPeak() const override;
bool IsClipping() const;