From 4bd53e016b8bb912e48d77e756720516d876d5c2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 22 Sep 2007 19:43:11 +0000 Subject: LV2 UI extension updates. LV2 GUI support in ingen. git-svn-id: http://svn.drobilla.net/lad/ingen@763 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/OSCClientReceiver.cpp | 2 +- src/libs/client/PluginModel.cpp | 88 +++++++++++++++++++++++++++-------- src/libs/client/PluginModel.hpp | 2 +- 3 files changed, 71 insertions(+), 21 deletions(-) (limited to 'src/libs/client') diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp index d6ce3f81..63bf5b69 100644 --- a/src/libs/client/OSCClientReceiver.cpp +++ b/src/libs/client/OSCClientReceiver.cpp @@ -39,7 +39,7 @@ OSCClientReceiver::OSCClientReceiver(int listen_port) // _receiving_node_num_ports(0), // _num_received_ports(0) { - start(true); + start(false); } diff --git a/src/libs/client/PluginModel.cpp b/src/libs/client/PluginModel.cpp index 10c767ff..442cbb43 100644 --- a/src/libs/client/PluginModel.cpp +++ b/src/libs/client/PluginModel.cpp @@ -52,34 +52,84 @@ PluginModel::default_node_name(SharedPtr parent) return name; } -#ifdef HAVE_SLV2 -void* -PluginModel::gui() + +void +lv2_ui_write(LV2UI_Controller controller, + uint32_t port, + uint32_t buffer_size, + const void* buffer) { - assert(_type == LV2); + cerr << "********* LV2 UI WRITE" << endl; +} + + +void +lv2_ui_command(LV2UI_Controller controller, + uint32_t argc, + const char* const* argv) +{ + cerr << "********* LV2 UI COMMAND" << endl; +} + - Glib::Mutex::Lock(_rdf_world->mutex()); +void +lv2_ui_program_change(LV2UI_Controller controller, + unsigned char program) +{ + cerr << "********* LV2 UI PROGRAM CHANGE" << endl; +} + - SLV2Values gui = slv2_plugin_get_guis(_slv2_plugin); - if (slv2_values_size(gui) > 0) { - printf("\tGUI:\n"); - for (unsigned i=0; i < slv2_values_size(gui); ++i) { - printf("\t\t%s\n", slv2_value_as_uri(slv2_values_get_at(gui, i))); - - SLV2Value binary = slv2_plugin_get_gui_library_uri(_slv2_plugin, slv2_values_get_at(gui, i)); - - printf("\t\t\tType: %s\n", slv2_gui_type_get_uri(slv2_value_as_gui_type( - slv2_values_get_at(gui, i)))); +void +lv2_ui_program_save(LV2UI_Controller controller, + unsigned char program, + const char* name) +{ + cerr << "********* LV2 UI PROGRAM SAVE" << endl; +} + +#ifdef HAVE_SLV2 +SLV2UIInstance +PluginModel::ui() +{ + if (_type != LV2) + return NULL; + + Glib::Mutex::Lock(_rdf_world->mutex()); + + SLV2UIInstance ret = NULL; + + SLV2Values ui = slv2_plugin_get_uis(_slv2_plugin); + if (slv2_values_size(ui) > 0) { + printf("\tUIs:\n"); + for (unsigned i=0; i < slv2_values_size(ui); ++i) { + printf("\t\t%s\n", slv2_value_as_uri(slv2_values_get_at(ui, i))); + + SLV2Value binary = slv2_plugin_get_ui_library_uri(_slv2_plugin, slv2_values_get_at(ui, i)); + + printf("\t\t\tType: %s\n", slv2_ui_type_get_uri(slv2_value_as_ui_type( + slv2_values_get_at(ui, i)))); + if (binary) - printf("\t\t\tBinary: %s\n", slv2_value_as_uri(binary)); - + printf("\t\t\tBinary: %s\n", slv2_value_as_uri(binary)); + slv2_value_free(binary); } + + if (slv2_values_size(ui) > 1) + printf("WARNING: Multiple UIs found, using the first..."); + + ret = slv2_plugin_ui_instantiate(_slv2_plugin, + slv2_values_get_at(ui, 0), + lv2_ui_write, lv2_ui_command, + lv2_ui_program_change, lv2_ui_program_save, + NULL, NULL); } - slv2_values_free(gui); - return NULL; + slv2_values_free(ui); + + return ret; } #endif diff --git a/src/libs/client/PluginModel.hpp b/src/libs/client/PluginModel.hpp index ba5598c0..bcf2645c 100644 --- a/src/libs/client/PluginModel.hpp +++ b/src/libs/client/PluginModel.hpp @@ -107,7 +107,7 @@ public: _slv2_plugins = slv2_world_get_all_plugins(_slv2_world); } - void* gui(); + SLV2UIInstance ui(); #endif static void set_rdf_world(Raul::RDF::World& world) { -- cgit v1.2.1