summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client/PluginUI.cpp15
-rw-r--r--src/gui/NodeModule.cpp26
-rw-r--r--src/gui/ingen_gui_lv2.cpp4
3 files changed, 28 insertions, 17 deletions
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index 01e1cb77..9bd3a195 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -53,14 +53,21 @@ lv2_ui_write(SuilController controller,
// float (special case, always 0)
if (format == 0) {
- assert(buffer_size == 4);
- if (*(const float*)buffer == port->value().get<float>())
- return; // do nothing (handle stupid plugin UIs that feed back)
+ if (buffer_size != 4) {
+ ui->world()->log().error(
+ Raul::fmt("%1% UI wrote corrupt float with bad size\n")
+ % ui->block()->plugin()->uri().c_str());
+ return;
+ }
+ const float value = *(const float*)buffer;
+ if (value == port->value().get<float>()) {
+ return; // Ignore feedback
+ }
ui->world()->interface()->set_property(
port->uri(),
uris.ingen_value,
- ui->world()->forge().make(*(const float*)buffer));
+ ui->world()->forge().make(value));
} else if (format == uris.atom_eventTransfer.id) {
const LV2_Atom* atom = (const LV2_Atom*)buffer;
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index 75e4b7c7..068642b1 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -165,19 +165,23 @@ NodeModule::show_human_names(bool b)
void
NodeModule::port_activity(uint32_t index, const Raul::Atom& value)
{
- if (!_plugin_ui)
- return;
-
const URIs& uris = app().uris();
+ if (!_plugin_ui) {
+ return;
+ }
- // FIXME: Well, this sucks...
- LV2_Atom* atom = (LV2_Atom*)malloc(sizeof(LV2_Atom) + value.size());
- atom->type = value.type();
- atom->size = value.size();
- memcpy(LV2_ATOM_BODY(atom), value.get_body(), value.size());
- _plugin_ui->port_event(
- index, lv2_atom_total_size(atom), uris.atom_eventTransfer, atom);
- free(atom);
+ if (value.type() == uris.atom_Float) {
+ _plugin_ui->port_event(index, sizeof(float), 0, value.ptr<float>());
+ } else {
+ // FIXME: Well, this sucks...
+ LV2_Atom* atom = (LV2_Atom*)malloc(sizeof(LV2_Atom) + value.size());
+ atom->type = value.type();
+ atom->size = value.size();
+ memcpy(LV2_ATOM_BODY(atom), value.get_body(), value.size());
+ _plugin_ui->port_event(
+ index, lv2_atom_total_size(atom), uris.atom_eventTransfer, atom);
+ free(atom);
+ }
}
void
diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp
index 061f2276..489fbf39 100644
--- a/src/gui/ingen_gui_lv2.cpp
+++ b/src/gui/ingen_gui_lv2.cpp
@@ -176,8 +176,8 @@ port_event(LV2UI_Handle handle,
uint32_t format,
const void* buffer)
{
- Ingen::IngenLV2UI* ui = (Ingen::IngenLV2UI*)handle;
- const LV2_Atom* atom = (const LV2_Atom*)buffer;
+ Ingen::IngenLV2UI* ui = (Ingen::IngenLV2UI*)handle;
+ const LV2_Atom* atom = (const LV2_Atom*)buffer;
ui->reader->write(atom);
}