Audacity 3.2.0
LV2UIFeaturesList.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file LV2UIFeaturesList.cpp
6
7 Paul Licameli split from LV2Effect.cpp
8
9 Audacity(R) is copyright (c) 1999-2008 Audacity Team.
10 License: GPL v2 or later. See License.txt.
11
12**********************************************************************/
13
14#include "LV2UIFeaturesList.h"
16#include "lv2/instance-access/instance-access.h"
17#include <wx/window.h>
18
20 const LV2WrapperFeaturesList &baseFeatures, UIHandler *pHandler,
21 const LilvNode *node, LilvInstance *pInstance, wxWindow *pParent
22) : ExtendedLV2FeaturesList{ WithBase, baseFeatures }
23 , mpHandler{ pHandler }
24 , mOk{ InitializeFeatures(node, pInstance, pParent) }
25{
26}
27
28bool LV2UIFeaturesList::InitializeFeatures(const LilvNode *node,
29 LilvInstance *pInstance, wxWindow *pParent)
30{
31 AddFeature(LV2_UI__resize, &mUIResizeFeature);
32 mExtensionDataFeature = { pInstance
33 ? lilv_instance_get_descriptor(pInstance)->extension_data
34 : nullptr
35 };
36 AddFeature(LV2_DATA_ACCESS_URI, &mExtensionDataFeature);
39 AddFeature(LV2_INSTANCE_ACCESS_URI,
40 pInstance ? lilv_instance_get_handle(pInstance) : nullptr);
41 AddFeature(LV2_UI__parent, pParent ? pParent->GetHandle() : nullptr);
42 return ValidateFeatures(node);
43}
44
45int LV2UIFeaturesList::ui_resize(LV2UI_Feature_Handle handle,
46 int width, int height)
47{
48 return static_cast<UIHandler*>(handle)->ui_resize(width, height);
49}
50
51void LV2UIFeaturesList::ui_closed(LV2UI_Controller controller)
52{
53 return static_cast<UIHandler*>(controller)->ui_closed();
54}
55
57 SuilController controller, const char *port_symbol)
58{
59 return static_cast<UIHandler *>(controller)->suil_port_index(port_symbol);
60}
61
62void LV2UIFeaturesList::suil_port_write(SuilController controller,
63 uint32_t port_index, uint32_t buffer_size, uint32_t protocol,
64 const void *buffer)
65{
66 return static_cast<UIHandler *>(controller)
67 ->suil_port_write(port_index, buffer_size, protocol, buffer);
68}
69
71
73 [](const LilvPlugin &plug, LV2InstanceFeaturesList &instanceFeatures){
74 return LV2UIFeaturesList{ LV2WrapperFeaturesList{ instanceFeatures },
75 nullptr, lilv_plugin_get_uri(&plug)
76 }.mOk;
77 }
78};
constexpr WithBase_t WithBase
static LV2InstanceFeaturesList::ValidatePlugin::Scope scope
Extends one (immutable) feature list (whose lifetime contains this one's)
void AddFeature(const char *uri, const void *data)
typename GlobalVariable< ValidatePlugin, const std::function< std::remove_pointer_t< decltype(DefaultFunction)> >, Default, Options... >::Scope Scope
bool ValidateFeatures(const LilvNode *subject)
#define LV2_EXTERNAL_UI_DEPRECATED_URI
#define LV2_EXTERNAL_UI__Host
Abstraction of host services that a plug-ins native UI needs.
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
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
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