aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-02-18 05:42:34 +0000
committerDavid Robillard <d@drobilla.net>2012-02-18 05:42:34 +0000
commit9c2c83e11d161442f3064b1ae7bc8b778b57542d (patch)
treeff9cf4fb9ae738f9efde233e49929c56dd95da92
parentc114eb799bdb1ed422681b77f06d8dcffe69adfa (diff)
downloadlv2-9c2c83e11d161442f3064b1ae7bc8b778b57542d.tar.xz
Fix invalid messages sent between plugin and UI.
-rw-r--r--plugins/eg-sampler.lv2/sampler.c9
-rw-r--r--plugins/eg-sampler.lv2/sampler_ui.c10
2 files changed, 10 insertions, 9 deletions
diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c
index bf288d7..8ef7bf9 100644
--- a/plugins/eg-sampler.lv2/sampler.c
+++ b/plugins/eg-sampler.lv2/sampler.c
@@ -442,17 +442,18 @@ run(LV2_Handle instance,
lv2_atom_forge_audio_time(&plugin->forge, seq, 0, 0);
LV2_Atom* set = (LV2_Atom*)lv2_atom_forge_blank(
- &plugin->forge, NULL, 0, plugin->uris.msg_Set);
+ &plugin->forge, NULL, 1, plugin->uris.msg_Set);
lv2_atom_forge_property_head(&plugin->forge, set, plugin->uris.msg_body, 0);
- LV2_Atom* body = (LV2_Atom*)lv2_atom_forge_blank(&plugin->forge, set, 0, 0);
+ LV2_Atom* body = (LV2_Atom*)lv2_atom_forge_blank(&plugin->forge, NULL, 2, 0);
lv2_atom_forge_property_head(&plugin->forge, body, plugin->uris.eg_file, 0);
- lv2_atom_forge_uri(&plugin->forge, set,
+ lv2_atom_forge_uri(&plugin->forge, body,
(const uint8_t*)plugin->sample->uri,
plugin->sample->uri_len);
- set->size += body->size;
+
+ set->size += lv2_atom_total_size(body);
seq->size += lv2_atom_total_size(set);
} else {
fprintf(stderr, "Unknown message from worker\n");
diff --git a/plugins/eg-sampler.lv2/sampler_ui.c b/plugins/eg-sampler.lv2/sampler_ui.c
index 179c588..e21a8a9 100644
--- a/plugins/eg-sampler.lv2/sampler_ui.c
+++ b/plugins/eg-sampler.lv2/sampler_ui.c
@@ -96,17 +96,17 @@ on_load_clicked(GtkWidget* widget,
* ]
*/
LV2_Atom* set = (LV2_Atom*)lv2_atom_forge_blank(
- &ui->forge, NULL, 0, ui->uris.msg_Set);
+ &ui->forge, NULL, 1, ui->uris.msg_Set);
lv2_atom_forge_property_head(&ui->forge, set, ui->uris.msg_body, 0);
- LV2_Atom* body = (LV2_Atom*)lv2_atom_forge_blank(&ui->forge, set, 0, 0);
+ LV2_Atom* body = (LV2_Atom*)lv2_atom_forge_blank(&ui->forge, NULL, 2, 0);
lv2_atom_forge_property_head(&ui->forge, body, ui->uris.eg_file, 0);
- lv2_atom_forge_uri(&ui->forge, set, (const uint8_t*)file_uri, file_uri_len);
+ lv2_atom_forge_uri(&ui->forge, body, (const uint8_t*)file_uri, file_uri_len);
- set->size += body->size;
+ set->size += lv2_atom_total_size(body);
- ui->write(ui->controller, 0, sizeof(LV2_Atom) + set->size,
+ ui->write(ui->controller, 0, lv2_atom_total_size(set),
ui->uris.atom_eventTransfer,
set);