1 /* GSequencer - Advanced GTK Sequencer
2  * Copyright (C) 2005-2019 Joël Krähemann
3  *
4  * This file is part of GSequencer.
5  *
6  * GSequencer is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * GSequencer is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with GSequencer.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef __AGS_LV2UI_PLUGIN_H__
21 #define __AGS_LV2UI_PLUGIN_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 
26 #include <ags/libags.h>
27 
28 #include <ags/plugin/ags_base_plugin.h>
29 
30 #include <lv2.h>
31 #include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
32 
33 G_BEGIN_DECLS
34 
35 #define AGS_TYPE_LV2UI_PLUGIN                (ags_lv2ui_plugin_get_type())
36 #define AGS_LV2UI_PLUGIN(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_LV2UI_PLUGIN, AgsLv2uiPlugin))
37 #define AGS_LV2UI_PLUGIN_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_LV2UI_PLUGIN, AgsLv2uiPluginClass))
38 #define AGS_IS_LV2UI_PLUGIN(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AGS_TYPE_LV2UI_PLUGIN))
39 #define AGS_IS_LV2UI_PLUGIN_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE ((class), AGS_TYPE_LV2UI_PLUGIN))
40 #define AGS_LV2UI_PLUGIN_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), AGS_TYPE_LV2UI_PLUGIN, AgsLv2uiPluginClass))
41 
42 #define AGS_LV2UI_PLUGIN_DESCRIPTOR(ptr) ((LV2UI_Descriptor *)(ptr))
43 
44 typedef struct _AgsLv2uiPlugin AgsLv2uiPlugin;
45 typedef struct _AgsLv2uiPluginClass AgsLv2uiPluginClass;
46 
47 /**
48  * AgsLv2uiPluginFlags:
49  * @AGS_LV2UI_PLUGIN_IS_SYNTHESIZER: is synthesizer
50  * @AGS_LV2UI_PLUGIN_GTK2: has Gtk+-2.0 UI
51  * @AGS_LV2UI_PLUGIN_GTK3: has Gtk3 UI
52  * @AGS_LV2UI_PLUGIN_QT4: has Qt4 UI
53  * @AGS_LV2UI_PLUGIN_QT5: has Qt5 UI
54  *
55  * Enum values to control the behavior or indicate internal state of #AgsLv2uiPlugin by
56  * enable/disable as flags.
57  */
58 typedef enum{
59   AGS_LV2UI_PLUGIN_IS_SYNTHESIZER  = 1,
60   AGS_LV2UI_PLUGIN_GTK2            = 1 <<  1,
61   AGS_LV2UI_PLUGIN_GTK3            = 1 <<  2,
62   AGS_LV2UI_PLUGIN_QT4             = 1 <<  3,
63   AGS_LV2UI_PLUGIN_QT5             = 1 <<  4,
64 }AgsLv2uiPluginFlags;
65 
66 struct _AgsLv2uiPlugin
67 {
68   AgsBasePlugin base_plugin;
69 
70   guint flags;
71 
72   gchar *gui_uri;
73 
74   AgsTurtle *manifest;
75   AgsTurtle *gui_turtle;
76 
77   GObject *lv2_plugin;
78 
79   LV2_Feature **feature;
80 };
81 
82 struct _AgsLv2uiPluginClass
83 {
84   AgsBasePluginClass base_plugin;
85 };
86 
87 GType ags_lv2ui_plugin_get_type(void);
88 GType ags_lv2ui_plugin_flags_get_type();
89 
90 gboolean ags_lv2ui_plugin_test_flags(AgsLv2uiPlugin *lv2ui_plugin, guint flags);
91 void ags_lv2ui_plugin_set_flags(AgsLv2uiPlugin *lv2ui_plugin, guint flags);
92 void ags_lv2ui_plugin_unset_flags(AgsLv2uiPlugin *lv2ui_plugin, guint flags);
93 
94 GList* ags_lv2ui_plugin_find_gui_uri(GList *lv2ui_plugin,
95 				     gchar *gui_uri);
96 
97 AgsLv2uiPlugin* ags_lv2ui_plugin_new(AgsTurtle *gui_turtle,
98 				     gchar *filename,
99 				     gchar *effect,
100 				     gchar *gui_uri,
101 				     guint effect_index);
102 
103 G_END_DECLS
104 
105 #endif /*__AGS_LV2UI_PLUGIN_H__*/
106