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
25
28 struct UIHandler {
29 virtual ~UIHandler();
30 virtual int ui_resize(int width, int height) = 0;
31 virtual void ui_closed() = 0;
32 virtual void suil_port_write(uint32_t port_index, uint32_t buffer_size,
33 uint32_t protocol, const void *buffer) = 0;
34 virtual uint32_t suil_port_index(const char *port_symbol) = 0;
35 };
36
38 const LV2WrapperFeaturesList &baseFeatures, UIHandler *pHandler,
39 const LilvNode *node,
40 LilvInstance *pInstance = nullptr, wxWindow *pParent = nullptr);
41
42private:
44 bool InitializeFeatures(const LilvNode *node,
45 LilvInstance *pInstance, wxWindow *pParent);
46
47public:
48 // publicize
50
52
56 static int ui_resize(LV2UI_Feature_Handle handle, int width, int height);
57 static void ui_closed(LV2UI_Controller controller);
58 static uint32_t suil_port_index(
59 SuilController controller, const char *port_symbol);
60 static void suil_port_write(SuilController controller,
61 uint32_t port_index, uint32_t buffer_size, uint32_t protocol,
62 const void *buffer);
64
65 // These objects contain C-style virtual function tables that we fill in
66 const LV2UI_Resize mUIResizeFeature{
68 // Not const, filled in when making a dialog
69 LV2_Extension_Data_Feature mExtensionDataFeature{};
70
71 const LilvNodePtr mHumanId{ lilv_plugin_get_name(&mPlug) };
73 // The void* bound to the argument of ui_closed will be the same
74 // given to suil_instance_new
75 LV2UIFeaturesList::ui_closed, lilv_node_as_string(mHumanId.get()) };
76
77 const bool mOk;
78};
79
80#endif
81#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