Audacity 3.2.0
AudioUnitEditor.h
Go to the documentation of this file.
1/*!********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file AudioUnitEditor.h
6
7 Dominic Mazzoni
8 Leland Lucius
9
10 Paul Licameli split from AudioUnitEffect.cpp
11
12**********************************************************************/
13
14#ifndef __AUDACITY_AUDIO_UNIT_EDITOR__
15#define __AUDACITY_AUDIO_UNIT_EDITOR__
16
17#include <AudioToolbox/AudioUnitUtilities.h>
18#include <unordered_map>
19#include "AudioUnitUtils.h"
20#include "../EffectEditor.h"
21
22class AUControl;
23
25class EffectSettings;
26class EffectInstance;
27class ShuttleGui;
28
29class AudioUnitEditor : public wxEvtHandler, public EffectEditor {
30 struct CreateToken{};
31public:
32 static std::unique_ptr<EffectEditor> Create(
33 const EffectUIServices &effect, ShuttleGui &S,
34 const wxString &uiType,
35 EffectInstance &instance, EffectSettingsAccess &access);
36
38 const EffectUIServices &effect, EffectSettingsAccess &access,
39 AudioUnitInstance &instance, AUControl *pControl, bool isGraphical);
40
41 ~AudioUnitEditor() override;
42
43 bool UpdateUI() override;
44 bool ValidateUI() override;
45 bool IsGraphicalUI() override;
46
47private:
48 static void EventListenerCallback(void *inCallbackRefCon,
49 void *inObject, const AudioUnitEvent *inEvent,
50 UInt64 inEventHostTime, AudioUnitParameterValue inParameterValue);
51 void EventListener(const AudioUnitEvent *inEvent,
52 AudioUnitParameterValue inParameterValue);
53 void OnIdle(wxIdleEvent &evt);
56
57 void Notify();
58
61
63
64 // The lifetime guarantee is assumed to be provided by the instance.
65 // See contract of PopulateUI
69 std::vector<
70 std::pair<AudioUnitParameterID, AudioUnitParameterValue>> mToUpdate;
71 const bool mIsGraphical;
72
73 // The map of parameter IDs to their current values
74 std::unordered_map<AudioUnitParameterID, AudioUnitParameterValue>
76};
77#endif
std::unique_ptr< T, AudioUnitCleaner< T, fn > > AudioUnitCleanup
RAII for cleaning up AU plugin state.
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:51
static std::unique_ptr< EffectEditor > Create(const EffectUIServices &effect, ShuttleGui &S, const wxString &uiType, EffectInstance &instance, EffectSettingsAccess &access)
void OnIdle(wxIdleEvent &evt)
AUControl *const mpControl
AudioUnitInstance & mInstance
std::unordered_map< AudioUnitParameterID, AudioUnitParameterValue > mParameterValues
bool IsGraphicalUI() override
static void EventListenerCallback(void *inCallbackRefCon, void *inObject, const AudioUnitEvent *inEvent, UInt64 inEventHostTime, AudioUnitParameterValue inParameterValue)
bool ValidateUI() override
Get settings data from the panel; may make error dialogs and return false.
bool UpdateUI() override
Update appearance of the panel for changes in settings.
const bool mIsGraphical
AudioUnitEditor(CreateToken, const EffectUIServices &effect, EffectSettingsAccess &access, AudioUnitInstance &instance, AUControl *pControl, bool isGraphical)
bool FetchSettingsFromInstance(EffectSettings &settings)
AudioUnitCleanup< AUEventListenerRef, AUListenerDispose > EventListenerPtr
const EventListenerPtr mEventListenerRef
EventListenerPtr MakeListener()
std::vector< std::pair< AudioUnitParameterID, AudioUnitParameterValue > > mToUpdate
void EventListener(const AudioUnitEvent *inEvent, AudioUnitParameterValue inParameterValue)
~AudioUnitEditor() override
bool StoreSettingsToInstance(const EffectSettings &settings)
Performs effect computation.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Externalized state of a plug-in.