2 * Copyright (C) 2008-2012 David Robillard <d@drobilla.net>
3 * Copyright (C) 2008-2015 Paul Davis <paul@linuxaudiosystems.com>
4 * Copyright (C) 2010-2012 Carl Hetherington <carl@carlh.net>
5 * Copyright (C) 2012-2018 Robin Gareus <robin@gareus.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef __ardour_lv2_plugin_ui_h__
23 #define __ardour_lv2_plugin_ui_h__
26 #include "gtk2ardour-config.h"
34 #include <gtkmm/widget.h>
35 #include <sigc++/signal.h>
37 #include "ardour_dialog.h"
38 #include "ardour/types.h"
39 #include "plugin_ui.h"
42 #include "ardour/plugin_insert.h"
44 #include "lv2_external_ui.h"
46 #include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
48 typedef struct _LV2UI_Request_Parameter {
49 LV2UI_Feature_Handle handle;
50 uint32_t (*request)(LV2UI_Feature_Handle handle, LV2_URID key);
51 }LV2UI_Request_Parameter;
59 class LV2PluginUI : public PlugUIBase, public Gtk::VBox
62 LV2PluginUI (boost::shared_ptr<ARDOUR::PluginInsert>,
63 boost::shared_ptr<ARDOUR::LV2Plugin>);
66 gint get_preferred_height ();
67 gint get_preferred_width ();
70 bool start_updating(GdkEventAny*);
71 bool stop_updating(GdkEventAny*);
73 int package (Gtk::Window&);
78 void control_changed (uint32_t);
80 typedef boost::shared_ptr<ARDOUR::AutomationControl> ControllableRef;
82 boost::shared_ptr<ARDOUR::PluginInsert> _pi;
83 boost::shared_ptr<ARDOUR::LV2Plugin> _lv2;
84 std::vector<int> _output_ports;
85 sigc::connection _screen_update_connection;
86 sigc::connection _message_update_connection;
87 Gtk::Widget* _gui_widget;
88 /** a box containing the focus, bypass, delete, save / add preset buttons etc. */
89 Gtk::HBox _ardour_buttons_box;
90 float* _values_last_sent_to_ui;
91 std::vector<ControllableRef> _controllables;
92 struct lv2_external_ui_host _external_ui_host;
93 LV2_Feature _external_ui_feature;
94 LV2_Feature _external_kxui_feature;
95 LV2UI_Request_Parameter _lv2ui_request_paramater;
96 LV2_Feature _lv2ui_request_feature;
97 struct lv2_external_ui* _external_ui_ptr;
98 LV2_Feature _parent_feature;
99 Gtk::Window* _win_ptr;
101 typedef std::set<uint32_t> Updates;
104 static void on_external_ui_closed(void* controller);
106 static void write_from_ui(void* controller,
108 uint32_t buffer_size,
112 static void write_to_ui(void* controller,
114 uint32_t buffer_size,
118 static uint32_t port_index(void* controller, const char* symbol);
120 static void touch(void* controller,
124 static uint32_t request_parameter (void* handle, LV2_URID key);
125 void set_path_property (int,
126 const ARDOUR::ParameterDescriptor&,
127 Gtk::FileChooserDialog*);
128 std::set<uint32_t> active_parameter_requests;
130 void update_timeout();
132 void lv2ui_instantiate(const std::string& title);
135 void parameter_update(uint32_t, float);
136 bool configure_handler (GdkEventConfigure*);
137 void save_plugin_setting ();
138 void output_update();
139 void queue_port_update();
140 bool is_update_wanted(uint32_t index);
142 virtual bool on_window_show(const std::string& title);
143 virtual void on_window_hide();
146 #endif // LV2_SUPPORT
148 #endif /* __ardour_lv2_plugin_ui_h__ */