From 1c746982c4d1b18308ce549852d8ecd83d612db5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 20 May 2008 00:30:50 +0000 Subject: Fix various problems with control port values. Fix control port feedback issues with LV2 plugin UIs. git-svn-id: http://svn.drobilla.net/lad/ingen@1218 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/PluginUI.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/libs/client/PluginUI.cpp') diff --git a/src/libs/client/PluginUI.cpp b/src/libs/client/PluginUI.cpp index 5215de25..9dcbfcba 100644 --- a/src/libs/client/PluginUI.cpp +++ b/src/libs/client/PluginUI.cpp @@ -16,12 +16,14 @@ */ #include +#include "shared/LV2URIMap.hpp" #include "PluginUI.hpp" #include "NodeModel.hpp" #include "PortModel.hpp" using namespace std; using Ingen::Shared::EngineInterface; +using Ingen::Shared::LV2URIMap; namespace Ingen { namespace Client { @@ -33,6 +35,7 @@ lv2_ui_write(LV2UI_Controller controller, uint32_t format, const void* buffer) { +#if 0 cerr << "********* LV2 UI WRITE (FORMAT " << format << "):" << endl; /*lv2_osc_message_print((const LV2Message*)buffer);*/ @@ -45,16 +48,24 @@ lv2_ui_write(LV2UI_Controller controller, fprintf(stderr, "%2X ", ((unsigned char*)buffer)[i]); } fprintf(stderr, "\n"); +#endif PluginUI* ui = (PluginUI*)controller; SharedPtr port = ui->node()->ports()[port_index]; - if (format == 0) { - ui->world()->engine->set_port_value_immediate(port->path(), - port->type().uri(), - buffer_size, buffer); + LV2URIMap* map = (LV2URIMap*)ui->world()->lv2_features->feature(LV2_URI_MAP_URI); + assert(map); + + if (format == 0) { // float (special case) + assert(buffer_size == 4); + if (*(float*)buffer == port->value().get_float()) + return; // do nothing (handle stupid plugin UIs that feed back) } + + ui->world()->engine->set_port_value_immediate(port->path(), + port->type().uri(), + buffer_size, buffer); } -- cgit v1.2.1