Audacity 3.2.0
VSTEditor.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 VSTEditor.h
6
7 Dominic Mazzoni
8
9 Paul Licameli split from VSTEffect.h
10
11**********************************************************************/
12
13#ifndef __AUDACITY_VST_EDITOR__
14#define __AUDACITY_VST_EDITOR__
15
16#include "VSTWrapper.h"
17#include "../EffectEditor.h"
18
19#include <wx/dialog.h>
20#include <wx/event.h>
21#include <wx/weakref.h>
22
23class VSTInstance;
24class wxSlider;
25class wxStaticText;
26class NumericTextCtrl;
27class VSTControl;
28
29class VSTTimer;
30
31class VSTEditor final
32 : public wxEvtHandler
33 , public EffectEditor
34 , public VSTUIWrapper
35{
36public:
37
38 VSTEditor(VSTInstance& instance, EffectType type, bool gui,
39 const EffectUIServices& services,
41 wxWindow* pParent,
42 int numParams
43 );
44
45 ~VSTEditor() override;
46
47 VSTInstance& GetInstance() const;
48
49 bool ValidateUI() override;
50 bool UpdateUI() override;
51
52 void OnClose() override;
53
54 void BuildPlain(EffectSettingsAccess& access, EffectType effectType, double projectRate);
55 void BuildFancy(EffectInstance& instance);
56
57 void OnTimer();
58
59 std::unique_ptr<VSTTimer> mTimer;
60
61 void RefreshParameters(int skip = -1) const;
62
63 void Automate(int index, float value) override;
64
65 void OnSlider(wxCommandEvent& evt);
66
67 int ShowDialog(bool nonModal);
68
69 bool IsGraphicalUI() override;
70
71 void Flush() override;
72
73protected:
74 void SizeWindow(int w, int h) override;
75
76private:
77 void NotifyParameterChanged(int index, float value);
78 void OnIdle(wxIdleEvent &evt);
79
82 const bool mGui;
83
86 void NeedEditIdle(bool state);
87 void NeedIdle() override;
88 void Idle() override;
89
90 void OnSizeWindow(wxCommandEvent& evt);
91
92 int mTimerGuard{ 0 };
93
94 bool mWantsEditIdle{ false };
95 bool mWantsIdle{ false };
96
97 // Remembers last slider movements until idle time
98 std::vector<std::pair<int, double>> mLastMovements{};
99
105
106 wxWindow* mParent;
107 wxWeakRef<wxDialog> mDialog;
108
110
111 // Mapping from parameter ID to string
112 std::vector<wxString> mParamNames;
113
114 int mNumParams{ 0 };
115};
116
117#endif
EffectType
static Settings & settings()
Definition: TrackInfo.cpp:51
Performs effect computation.
void BuildPlain(EffectSettingsAccess &access, EffectType effectType, double projectRate)
Definition: VSTEditor.cpp:285
VSTControl * mControl
Definition: VSTEditor.h:109
wxWindow * mParent
Definition: VSTEditor.h:106
ArrayOf< wxStaticText * > mLabels
Definition: VSTEditor.h:103
void NeedIdle() override
Definition: VSTEditor.cpp:136
bool IsGraphicalUI() override
Definition: VSTEditor.cpp:101
bool FetchSettingsFromInstance(EffectSettings &settings)
Definition: VSTEditor.cpp:567
void BuildFancy(EffectInstance &instance)
Definition: VSTEditor.cpp:242
void NotifyParameterChanged(int index, float value)
Definition: VSTEditor.cpp:153
bool mWantsEditIdle
Definition: VSTEditor.h:94
void OnSizeWindow(wxCommandEvent &evt)
Definition: VSTEditor.cpp:468
std::unique_ptr< VSTTimer > mTimer
Definition: VSTEditor.h:59
bool mWantsIdle
Definition: VSTEditor.h:95
void Flush() override
Definition: VSTEditor.cpp:106
std::vector< wxString > mParamNames
Definition: VSTEditor.h:112
bool StoreSettingsToInstance(const EffectSettings &settings)
Definition: VSTEditor.cpp:572
void Automate(int index, float value) override
Definition: VSTEditor.cpp:559
void OnSlider(wxCommandEvent &evt)
Definition: VSTEditor.cpp:490
void NeedEditIdle(bool state)
Definition: VSTEditor.cpp:147
ArrayOf< wxStaticText * > mDisplays
Definition: VSTEditor.h:102
const bool mGui
Definition: VSTEditor.h:82
int mTimerGuard
Definition: VSTEditor.h:92
wxWeakRef< wxDialog > mDialog
Definition: VSTEditor.h:107
void SizeWindow(int w, int h) override
Definition: VSTEditor.cpp:210
int mNumParams
Definition: VSTEditor.h:114
void OnClose() override
Definition: VSTEditor.cpp:592
bool ValidateUI() override
Get settings data from the panel; may make error dialogs and return false.
Definition: VSTEditor.cpp:577
ArrayOf< wxStaticText * > mNames
Definition: VSTEditor.h:100
const EffectType mType
Definition: VSTEditor.h:81
void RefreshParameters(int skip=-1) const
Definition: VSTEditor.cpp:417
void Idle() override
Definition: VSTEditor.cpp:142
int ShowDialog(bool nonModal)
Definition: VSTEditor.cpp:88
void OnIdle(wxIdleEvent &evt)
Definition: VSTEditor.cpp:177
std::vector< std::pair< int, double > > mLastMovements
Definition: VSTEditor.h:98
VSTInstance & GetInstance() const
Definition: VSTEditor.cpp:554
~VSTEditor() override
Definition: VSTEditor.cpp:510
NumericTextCtrl * mDuration
Definition: VSTEditor.h:104
bool UpdateUI() override
Update appearance of the panel for changes in settings.
Definition: VSTEditor.cpp:502
VSTEditor(VSTInstance &instance, EffectType type, bool gui, const EffectUIServices &services, EffectSettingsAccess &access, wxWindow *pParent, int numParams)
Definition: VSTEditor.cpp:516
void OnTimer()
Definition: VSTEditor.cpp:111
VSTInstance & mInstance
Definition: VSTEditor.h:80
ArrayOf< wxSlider * > mSliders
Definition: VSTEditor.h:101
Externalized state of a plug-in.