Ardour  9.0-pre0-582-g084a23a80d
lv2_plugin_ui.h
Go to the documentation of this file.
1 /*
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>
6  *
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.
11  *
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.
16  *
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.
20  */
21 
22 #ifndef __ardour_lv2_plugin_ui_h__
23 #define __ardour_lv2_plugin_ui_h__
24 
25 #ifdef WAF_BUILD
26 #include "gtk2ardour-config.h"
27 #endif
28 
29 #include <list>
30 #include <map>
31 #include <set>
32 #include <vector>
33 
34 #include <gtkmm/widget.h>
35 #include <sigc++/signal.h>
36 
37 #include "ardour_dialog.h"
38 #include "ardour/types.h"
39 #include "plugin_ui.h"
40 
42 
43 #include "lv2_external_ui.h"
44 
45 #ifdef HAVE_LV2_1_18_6
46 #include <lv2/ui/ui.h>
47 #else
48 #include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
49 #endif
50 
51 namespace ARDOUR {
52  class LV2Plugin;
53 }
54 
55 class LV2PluginUI : public PlugUIBase, public Gtk::VBox
56 {
57 public:
58  LV2PluginUI (std::shared_ptr<ARDOUR::PlugInsertBase>,
59  std::shared_ptr<ARDOUR::LV2Plugin>);
61 
64  bool resizable ();
65 
68 
69  bool is_external () const;
70  bool is_external_visible () const;
71 
73  void grab_focus ();
74 
75 private:
76 
77  void control_changed (uint32_t);
78 
79  typedef std::shared_ptr<ARDOUR::AutomationControl> ControllableRef;
80 
81  std::shared_ptr<ARDOUR::PlugInsertBase> _pib;
82  std::shared_ptr<ARDOUR::LV2Plugin> _lv2;
83  std::vector<uint32_t> _output_ports;
84  sigc::connection _screen_update_connection;
85  sigc::connection _message_update_connection;
90  std::vector<ControllableRef> _controllables;
92  LV2_Feature _external_ui_feature;
94 #ifdef HAVE_LV2_1_17_2
95  LV2UI_Request_Value _lv2ui_request_value;
96  LV2_Feature _lv2ui_request_feature;
97 #endif
99  LV2_Feature _parent_feature;
100  void* _inst;
101 
102  typedef std::set<uint32_t> Updates;
104 
105  static void on_external_ui_closed(void* controller);
106 
107  static void write_from_ui(void* controller,
108  uint32_t port_index,
109  uint32_t buffer_size,
110  uint32_t format,
111  const void* buffer);
112 
113  static void write_to_ui(void* controller,
114  uint32_t port_index,
115  uint32_t buffer_size,
116  uint32_t format,
117  const void* buffer);
118 
119  static uint32_t port_index(void* controller, const char* symbol);
120 
121  static void touch(void* controller,
122  uint32_t port_index,
123  bool grabbed);
124 
125 #ifdef HAVE_LV2_1_17_2
126  static LV2UI_Request_Value_Status
127  request_value(void* handle,
128  LV2_URID key,
129  LV2_URID type,
130  const LV2_Feature* const* features);
131 #endif
132 
133  void set_path_property (int,
136  std::set<uint32_t> active_parameter_requests;
137 
139 
140  void lv2ui_instantiate(const std::string& title);
141  void lv2ui_free();
142 
143  void parameter_update(uint32_t, float);
148  bool is_update_wanted(uint32_t index);
149 
150  virtual bool on_window_show(const std::string& title);
151  virtual void on_window_hide();
152 };
153 
154 #endif /* __ardour_lv2_plugin_ui_h__ */
std::shared_ptr< ARDOUR::AutomationControl > ControllableRef
Definition: lv2_plugin_ui.h:79
LV2_Feature _external_kxui_feature
Definition: lv2_plugin_ui.h:93
std::shared_ptr< ARDOUR::LV2Plugin > _lv2
Definition: lv2_plugin_ui.h:82
bool is_external() const
static void write_to_ui(void *controller, uint32_t port_index, uint32_t buffer_size, uint32_t format, const void *buffer)
void grab_focus()
virtual void on_window_hide()
float * _values_last_sent_to_ui
Definition: lv2_plugin_ui.h:89
void set_path_property(int, const ARDOUR::ParameterDescriptor &, Gtk::FileChooserDialog *)
bool resizable()
bool start_updating(GdkEventAny *)
Updates _updates
static uint32_t port_index(void *controller, const char *symbol)
gint get_preferred_width()
static void write_from_ui(void *controller, uint32_t port_index, uint32_t buffer_size, uint32_t format, const void *buffer)
static void on_external_ui_closed(void *controller)
LV2PluginUI(std::shared_ptr< ARDOUR::PlugInsertBase >, std::shared_ptr< ARDOUR::LV2Plugin >)
bool is_external_visible() const
void parameter_update(uint32_t, float)
bool stop_updating(GdkEventAny *)
void control_changed(uint32_t)
int package(Gtk::Window &)
Gtk::HBox _ardour_buttons_box
Definition: lv2_plugin_ui.h:88
void update_timeout()
struct lv2_external_ui_host _external_ui_host
Definition: lv2_plugin_ui.h:91
static void touch(void *controller, uint32_t port_index, bool grabbed)
Gtk::Widget * _gui_widget
Definition: lv2_plugin_ui.h:86
void lv2ui_instantiate(const std::string &title)
void queue_port_update()
std::set< uint32_t > active_parameter_requests
sigc::connection _message_update_connection
Definition: lv2_plugin_ui.h:85
std::vector< uint32_t > _output_ports
Definition: lv2_plugin_ui.h:83
bool configure_handler(GdkEventConfigure *)
LV2_Feature _parent_feature
Definition: lv2_plugin_ui.h:99
bool is_update_wanted(uint32_t index)
virtual bool on_window_show(const std::string &title)
gint get_preferred_height()
void output_update()
void save_plugin_setting()
std::set< uint32_t > Updates
struct lv2_external_ui * _external_ui_ptr
Definition: lv2_plugin_ui.h:98
std::vector< ControllableRef > _controllables
Definition: lv2_plugin_ui.h:90
sigc::connection _screen_update_connection
Definition: lv2_plugin_ui.h:84
std::shared_ptr< ARDOUR::PlugInsertBase > _pib
Definition: lv2_plugin_ui.h:81
void lv2ui_free()
LV2_Feature _external_ui_feature
Definition: lv2_plugin_ui.h:92