Clear out any command line session name on closing a session so that the same session...
[ardour.git] / gtk2_ardour / lv2_plugin_ui.h
1 /*
2     Copyright (C) 2008 Paul Davis
3     Author: Dave Robillard
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 */
20
21 #ifndef __ardour_lv2_plugin_ui_h__
22 #define __ardour_lv2_plugin_ui_h__
23
24 #ifdef WAF_BUILD
25 #include "gtk2ardour-config.h"
26 #endif
27
28 #include <vector>
29 #include <map>
30 #include <list>
31
32 #include <sigc++/signal.h>
33 #include <gtkmm/widget.h>
34
35 #include <ardour_dialog.h>
36 #include "ardour/types.h"
37 #include "plugin_ui.h"
38
39 #ifdef HAVE_SLV2
40
41 namespace ARDOUR {
42         class PluginInsert;
43         class LV2Plugin;
44 }
45
46 class LV2PluginUI : public PlugUIBase, public Gtk::VBox
47 {
48   public:
49         LV2PluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::LV2Plugin>);
50         ~LV2PluginUI ();
51
52         gint get_preferred_height ();
53         gint get_preferred_width ();
54         bool start_updating(GdkEventAny*);
55         bool stop_updating(GdkEventAny*);
56
57         int package (Gtk::Window&);
58
59   private:
60         boost::shared_ptr<ARDOUR::LV2Plugin> _lv2;
61         std::vector<int> _output_ports;
62         sigc::connection _screen_update_connection;
63         
64         Gtk::Widget*   _gui_widget;
65         SLV2UIInstance _inst;
66         float*         _values;
67         
68         static void lv2_ui_write(
69                         LV2UI_Controller controller,
70                         uint32_t         port_index,
71                         uint32_t         buffer_size,
72                         uint32_t         format,
73                         const void*      buffer);
74         
75         void parameter_changed(uint32_t, float);
76         void parameter_update(uint32_t, float);
77         bool configure_handler (GdkEventConfigure*);
78         void save_plugin_setting ();
79         void output_update();
80         bool is_update_wanted(uint32_t index);
81 };
82
83 #endif // HAVE_SLV2
84
85 #endif /* __ardour_lv2_plugin_ui_h__ */
86