aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/eg-sampler.lv2/sampler_ui.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-02-09 06:40:45 +0000
committerDavid Robillard <d@drobilla.net>2012-02-09 06:40:45 +0000
commit3d8a2bef05f69eff154ad350db4be897f6d3edfa (patch)
tree7de4fecf06fe7b247bee97ff2d235a417c7d16da /plugins/eg-sampler.lv2/sampler_ui.c
parent4c3618b8bd6983886f0049f3204552e3a4152bdb (diff)
downloadlv2-3d8a2bef05f69eff154ad350db4be897f6d3edfa.tar.xz
Add message extension.
Diffstat (limited to 'plugins/eg-sampler.lv2/sampler_ui.c')
-rw-r--r--plugins/eg-sampler.lv2/sampler_ui.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/plugins/eg-sampler.lv2/sampler_ui.c b/plugins/eg-sampler.lv2/sampler_ui.c
index ea57cc1..b807be9 100644
--- a/plugins/eg-sampler.lv2/sampler_ui.c
+++ b/plugins/eg-sampler.lv2/sampler_ui.c
@@ -26,6 +26,7 @@
#include "lv2/lv2plug.in/ns/ext/atom/atom-helpers.h"
#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
#include "lv2/lv2plug.in/ns/ext/atom/forge.h"
+#include "lv2/lv2plug.in/ns/ext/message/message.h"
#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
#include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
@@ -77,15 +78,29 @@ on_load_clicked(GtkWidget* widget,
uint8_t obj_buf[OBJ_BUF_SIZE];
lv2_atom_forge_set_buffer(&ui->forge, obj_buf, OBJ_BUF_SIZE);
- LV2_Atom* obj = (LV2_Atom*)lv2_atom_forge_object(
- &ui->forge, NULL, 0, uri_to_id(ui, SET_MESSAGE_URI));
- lv2_atom_forge_property_head(&ui->forge, obj,
+ /* Send [
+ * a msg:Set ;
+ * msg:body [
+ * eg-sampler:filename "/foo/bar.wav" ;
+ * ] ;
+ * ]
+ */
+ LV2_Atom* set = (LV2_Atom*)lv2_atom_forge_blank(
+ &ui->forge, NULL, 0, uri_to_id(ui, LV2_MESSAGE_Set));
+ lv2_atom_forge_property_head(&ui->forge, set,
+ uri_to_id(ui, LV2_MESSAGE_body), 0);
+ LV2_Atom* body = (LV2_Atom*)lv2_atom_forge_blank(&ui->forge, set, 0, 0);
+ lv2_atom_forge_property_head(&ui->forge, body,
uri_to_id(ui, FILENAME_URI), 0);
- lv2_atom_forge_string(&ui->forge, obj, (uint8_t*)filename, filename_len);
+ lv2_atom_forge_string(&ui->forge, set, (uint8_t*)filename, filename_len);
- ui->write(ui->controller, 0, sizeof(LV2_Atom) + obj->size,
+ lv2_atom_forge_property_head(&ui->forge, body,
+ uri_to_id(ui, LV2_MESSAGE_body), 0);
+ set->size += body->size;
+
+ ui->write(ui->controller, 0, sizeof(LV2_Atom) + set->size,
uri_to_id(ui, NS_ATOM "atomTransfer"),
- obj);
+ set);
g_free(filename);
}