1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
/* a-comp UI -- test/example
*
* Copyright (C) 2016 Robin Gareus <robin@gareus.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define ACOMP_URI "urn:ardour:a-comp"
#include <stdlib.h>
#include <gtkmm.h>
#include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
using namespace Gtk;
typedef struct {
LV2UI_Write_Function write;
LV2UI_Controller controller;
Box* box;
Label* label;
} ACompUI;
/******************************************************************************
* GUI
*/
static void* setup_ui (ACompUI* ui) {
ui->box = manage (new HBox);
ui->label = manage (new Label ("Hello World"));
ui->box->pack_start (*ui->label, false, false, 4);
return ui->box->gobj ();
}
/******************************************************************************
* LV2 callbacks
*/
static LV2UI_Handle
instantiate (const LV2UI_Descriptor* descriptor,
const char* plugin_uri,
const char* bundle_path,
LV2UI_Write_Function write_function,
LV2UI_Controller controller,
LV2UI_Widget* widget,
const LV2_Feature* const* features)
{
ACompUI* ui = (ACompUI*)calloc (1, sizeof (ACompUI));
ui->write = write_function;
ui->controller = controller;
ui->box = NULL;
*widget = setup_ui (ui);
return ui;
}
static void
cleanup (LV2UI_Handle handle)
{
ACompUI* ui = (ACompUI*)handle;
free (ui);
}
static void
port_event (LV2UI_Handle handle,
uint32_t port_index,
uint32_t buffer_size,
uint32_t format,
const void* buffer)
{
ACompUI* ui = (ACompUI*)handle;
}
/******************************************************************************
* LV2 setup
*/
static const void*
extension_data (const char* uri)
{
return NULL;
}
static const LV2UI_Descriptor descriptor = {
ACOMP_URI "#ui",
instantiate,
cleanup,
port_event,
extension_data
};
LV2_SYMBOL_EXPORT
const LV2UI_Descriptor*
lv2ui_descriptor (uint32_t index)
{
switch (index) {
case 0:
return &descriptor;
default:
return NULL;
}
}
|