summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client/PluginUI.cpp21
-rw-r--r--src/client/PluginUI.hpp15
-rw-r--r--src/gui/NodeModule.cpp16
3 files changed, 35 insertions, 17 deletions
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index 5d21ea7e..9cdfa1b3 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -154,7 +154,7 @@ PluginUI::create(Ingen::Shared::World* world,
plugin, ui, lv2_ui_write, ret.get(), ret->_features->array());
if (inst) {
- ret->set_instance(inst);
+ ret->_instance = inst;
} else {
error << "Failed to instantiate Plugin UI" << endl;
ret = SharedPtr<PluginUI>();
@@ -165,6 +165,25 @@ PluginUI::create(Ingen::Shared::World* world,
return ret;
}
+LV2UI_Widget
+PluginUI::get_widget()
+{
+ return (LV2UI_Widget*)slv2_ui_instance_get_widget(_instance);
+}
+
+void
+PluginUI::port_event(uint32_t port_index,
+ uint32_t buffer_size,
+ uint32_t format,
+ const void* buffer)
+{
+ const LV2UI_Descriptor* ui_desc = slv2_ui_instance_get_descriptor(_instance);
+ LV2UI_Handle ui = slv2_ui_instance_get_handle(_instance);
+
+ if (ui_desc->port_event) {
+ ui_desc->port_event(ui, port_index, buffer_size, 0, buffer);
+ }
+}
} // namespace Client
} // namespace Ingen
diff --git a/src/client/PluginUI.hpp b/src/client/PluginUI.hpp
index 312e69d5..bf60dcfa 100644
--- a/src/client/PluginUI.hpp
+++ b/src/client/PluginUI.hpp
@@ -43,16 +43,21 @@ public:
SharedPtr<NodeModel> node,
SLV2Plugin plugin);
- Ingen::Shared::World* world() const { return _world; }
- SharedPtr<NodeModel> node() const { return _node; }
- SLV2UIInstance instance() const { return _instance; }
+ LV2UI_Widget get_widget();
+
+ void port_event(uint32_t port_index,
+ uint32_t buffer_size,
+ uint32_t format,
+ const void* buffer);
+
+
+ Ingen::Shared::World* world() const { return _world; }
+ SharedPtr<NodeModel> node() const { return _node; }
private:
PluginUI(Ingen::Shared::World* world,
SharedPtr<NodeModel> node);
- void set_instance(SLV2UIInstance instance) { _instance = instance; }
-
Ingen::Shared::World* _world;
SharedPtr<NodeModel> _node;
SLV2UIInstance _instance;
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index 52f14772..7e75d501 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -154,20 +154,15 @@ NodeModule::value_changed(uint32_t index, const Atom& value)
if (!_plugin_ui)
return;
- float float_val = 0.0f;
- SLV2UIInstance inst = _plugin_ui->instance();
- const LV2UI_Descriptor* ui_desc = slv2_ui_instance_get_descriptor(inst);
- LV2UI_Handle ui = slv2_ui_instance_get_handle(inst);
+ float float_val = 0.0f;
switch (value.type()) {
case Atom::FLOAT:
float_val = value.get_float();
- if (ui_desc->port_event)
- ui_desc->port_event(ui, index, 4, 0, &float_val);
+ _plugin_ui->port_event(index, 4, 0, &float_val);
break;
case Atom::STRING:
- if (ui_desc->port_event)
- ui_desc->port_event(ui, index, strlen(value.get_string()), 0, value.get_string());
+ _plugin_ui->port_event(index, strlen(value.get_string()), 0, value.get_string());
break;
default:
break;
@@ -201,9 +196,8 @@ NodeModule::embed_gui(bool embed)
}
if (_plugin_ui) {
- GtkWidget* c_widget = (GtkWidget*)slv2_ui_instance_get_widget(_plugin_ui->instance());
+ GtkWidget* c_widget = (GtkWidget*)_plugin_ui->get_widget();
_gui_widget = Glib::wrap(c_widget);
- assert(_gui_widget);
Gtk::Container* container = new Gtk::EventBox();
container->set_name("ingen_embedded_node_gui_container");
@@ -308,7 +302,7 @@ NodeModule::popup_gui()
_plugin_ui = plugin->ui(App::instance().world(), _node);
if (_plugin_ui) {
- GtkWidget* c_widget = (GtkWidget*)slv2_ui_instance_get_widget(_plugin_ui->instance());
+ GtkWidget* c_widget = (GtkWidget*)_plugin_ui->get_widget();
_gui_widget = Glib::wrap(c_widget);
_gui_window = new Gtk::Window();