libxputty 0.1
Loading...
Searching...
No Matches
lv2_plugin.h
Go to the documentation of this file.
1/*
2 * 0BSD
3 *
4 * BSD Zero Clause License
5 *
6 * Copyright (c) 2019 Hermann Meyer
7 *
8 * Permission to use, copy, modify, and/or distribute this software for any
9 * purpose with or without fee is hereby granted.
10
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 *
19 */
20
21
22#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
23#include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
24
25// xwidgets.h includes xputty.h and all defined widgets from Xputty
26#include "xwidgets.h"
27
28#pragma once
29
30#ifndef LV2_PLUGIN_H_
31#define LV2_PLUGIN_H_
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37// struct to define the knob pattern colors
38typedef struct {
39 double p1f[4];
40 double p2f[4];
41 double p3f[4];
42 double p4f[4];
43 double p5f[4];
44 double p1k[4];
45 double p2k[4];
46 double p3k[4];
47 double p4k[4];
48 double p5k[4];
50
51
52// main window struct
53typedef struct {
57 Widget_t *widget[CONTROLS];
62
64 LV2UI_Write_Function write_function;
65 LV2UI_Resize* resize;
66} X11_UI;
67
68// controller value changed, forward value to host when needed
69void plugin_value_changed(X11_UI *ui, Widget_t *w, PortIndex index);
70
71// set the plugin initial window size
72void plugin_set_window_size(int *w,int *h,const char * plugin_uri);
73
74// set the plugin name
75const char* plugin_set_name();
76
77// create all needed controller
78void plugin_create_controller_widgets(X11_UI *ui, const char * plugin_uri);
79
80// add a knob to the main window
81Widget_t* add_my_knob(Widget_t *w, PortIndex index, const char * label,
82 X11_UI* ui, int x, int y, int width, int height);
83
84// add a image knob to the main window
85Widget_t* add_my_image_knob(Widget_t *w, PortIndex index, const char * label,
86 X11_UI* ui, int x, int y, int width, int height);
87
88// add a image knob with value to the main window
89Widget_t* add_my_value_knob(Widget_t *w, PortIndex index, const char * label,
90 X11_UI* ui, int x, int y, int width, int height);
91// add a image toggle button to the main window
92Widget_t* add_my_switch_image(Widget_t *w, PortIndex index, const char * label,
93 X11_UI* ui, int x, int y, int width, int height);
94
95// add a combobox to the main window
96Widget_t* add_my_combobox(Widget_t *w, PortIndex index, const char * label, const char** items,
97 size_t len, int active, X11_UI* ui, int x, int y, int width, int height);
98
99// free used mem on exit
100void plugin_cleanup(X11_UI *ui);
101
102// controller value changed message from host
103void plugin_port_event(LV2UI_Handle handle, uint32_t port_index,
104 uint32_t buffer_size, uint32_t format,
105 const void * buffer);
106#ifdef __cplusplus
107}
108#endif
109
110#endif //LV2_PLUGIN_H_
Widget_t * add_my_knob(Widget_t *w, PortIndex index, const char *label, X11_UI *ui, int x, int y, int width, int height)
void plugin_create_controller_widgets(X11_UI *ui, const char *plugin_uri)
const char * plugin_set_name()
Widget_t * add_my_switch_image(Widget_t *w, PortIndex index, const char *label, X11_UI *ui, int x, int y, int width, int height)
Widget_t * add_my_image_knob(Widget_t *w, PortIndex index, const char *label, X11_UI *ui, int x, int y, int width, int height)
void plugin_value_changed(X11_UI *ui, Widget_t *w, PortIndex index)
void plugin_cleanup(X11_UI *ui)
Widget_t * add_my_value_knob(Widget_t *w, PortIndex index, const char *label, X11_UI *ui, int x, int y, int width, int height)
void plugin_set_window_size(int *w, int *h, const char *plugin_uri)
void plugin_port_event(LV2UI_Handle handle, uint32_t port_index, uint32_t buffer_size, uint32_t format, const void *buffer)
Widget_t * add_my_combobox(Widget_t *w, PortIndex index, const char *label, const char **items, size_t len, int active, X11_UI *ui, int x, int y, int width, int height)
Widget_t - struct to hold the basic Widget_t info.
Definition xwidget.h:457
Xputty main
Definition lv2_plugin.h:55
void * private_ptr
Definition lv2_plugin.h:59
int need_resize
Definition lv2_plugin.h:61
Widget_t * win
Definition lv2_plugin.h:56
KnobColors * kp
Definition lv2_plugin.h:58
void * parentXwindow
Definition lv2_plugin.h:54
int block_event
Definition lv2_plugin.h:60
void * controller
Definition lv2_plugin.h:63
LV2UI_Write_Function write_function
Definition lv2_plugin.h:64
LV2UI_Resize * resize
Definition lv2_plugin.h:65
Xputty - the main struct. It should be declared before any other call to a Xputty function....
Definition xputty.h:228
xwidgets.h include some predefined widgets for libxputty, include this to use them if you would only ...