Audacity 3.2.0
LV2UIFeaturesList.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file LV2UIFeaturesList.h
6
7 Paul Licameli split from LV2Effect.h
8
9 Audacity(R) is copyright (c) 1999-2013 Audacity Team.
10 License: GPL v2 or later. See License.txt.
11
12*********************************************************************/
13
14#ifndef __AUDACITY_LV2_UI_FEATURES_LIST__
15#define __AUDACITY_LV2_UI_FEATURES_LIST__
16
17#if USE_LV2
18
19#include "LV2FeaturesList.h"
20#include "lv2_external_ui.h"
21#include <suil/suil.h>
22#include "lv2/data-access/data-access.h"
23
25class wxWindow;
26
29 struct UIHandler {
30 virtual ~UIHandler();
31 virtual int ui_resize(int width, int height) = 0;
32 virtual void ui_closed() = 0;
33 virtual void suil_port_write(uint32_t port_index, uint32_t buffer_size,
34 uint32_t protocol, const void *buffer) = 0;
35 virtual uint32_t suil_port_index(const char *port_symbol) = 0;
36 };
37
39 const LV2WrapperFeaturesList &baseFeatures, UIHandler *pHandler,
40 const LilvNode *node,
41 LilvInstance *pInstance = nullptr, wxWindow *pParent = nullptr);
42
43private:
45 bool InitializeFeatures(const LilvNode *node,
46 LilvInstance *pInstance, wxWindow *pParent);
47
48public:
49 // publicize
51
53
57 static int ui_resize(LV2UI_Feature_Handle handle, int width, int height);
58 static void ui_closed(LV2UI_Controller controller);
59 static uint32_t suil_port_index(
60 SuilController controller, const char *port_symbol);
61 static void suil_port_write(SuilController controller,
62 uint32_t port_index, uint32_t buffer_size, uint32_t protocol,
63 const void *buffer);
65
66 // These objects contain C-style virtual function tables that we fill in
67 const LV2UI_Resize mUIResizeFeature{
69 // Not const, filled in when making a dialog
70 LV2_Extension_Data_Feature mExtensionDataFeature{};
71
72 const LilvNodePtr mHumanId{ lilv_plugin_get_name(&mPlug) };
74 // The void* bound to the argument of ui_closed will be the same
75 // given to suil_instance_new
76 LV2UIFeaturesList::ui_closed, lilv_node_as_string(mHumanId.get()) };
77
78 const bool mOk;
79};
80
81#endif
82#endif
Lilv_ptr< LilvNode, lilv_node_free > LilvNodePtr
Definition: LV2Utils.h:33
Extends one (immutable) feature list (whose lifetime contains this one's)
std::vector< LV2_Feature > mFeatures
const LilvPlugin & mPlug
Abstraction of host services that a plug-ins native UI needs.
virtual uint32_t suil_port_index(const char *port_symbol)=0
virtual void ui_closed()=0
virtual int ui_resize(int width, int height)=0
virtual void suil_port_write(uint32_t port_index, uint32_t buffer_size, uint32_t protocol, const void *buffer)=0
static uint32_t suil_port_index(SuilController controller, const char *port_symbol)
bool InitializeFeatures(const LilvNode *node, LilvInstance *pInstance, wxWindow *pParent)
const LV2UI_Resize mUIResizeFeature
UIHandler *const mpHandler
static int ui_resize(LV2UI_Feature_Handle handle, int width, int height)
static void suil_port_write(SuilController controller, uint32_t port_index, uint32_t buffer_size, uint32_t protocol, const void *buffer)
const LV2_External_UI_Host mExternalUIHost
const LilvNodePtr mHumanId
static void ui_closed(LV2UI_Controller controller)
LV2UIFeaturesList(const LV2WrapperFeaturesList &baseFeatures, UIHandler *pHandler, const LilvNode *node, LilvInstance *pInstance=nullptr, wxWindow *pParent=nullptr)
LV2_Extension_Data_Feature mExtensionDataFeature