From 118ec555a37ff2324dad2ea81b2b6bef3d0d2c20 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 31 Oct 2014 23:55:55 +0000 Subject: eg-sampler: Support patch:Get, and request initial state from UI. --- plugins/eg-sampler.lv2/sampler_ui.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'plugins/eg-sampler.lv2/sampler_ui.c') diff --git a/plugins/eg-sampler.lv2/sampler_ui.c b/plugins/eg-sampler.lv2/sampler_ui.c index d691c98..643f8c7 100644 --- a/plugins/eg-sampler.lv2/sampler_ui.c +++ b/plugins/eg-sampler.lv2/sampler_ui.c @@ -131,6 +131,19 @@ instantiate(const LV2UI_Descriptor* descriptor, G_CALLBACK(on_load_clicked), ui); + // Request state (filename) from plugin + uint8_t get_buf[512]; + lv2_atom_forge_set_buffer(&ui->forge, get_buf, sizeof(get_buf)); + + LV2_Atom_Forge_Frame frame; + LV2_Atom* msg = (LV2_Atom*)lv2_atom_forge_object( + &ui->forge, &frame, 0, ui->uris.patch_Get); + lv2_atom_forge_pop(&ui->forge, &frame); + + ui->write(ui->controller, 0, lv2_atom_total_size(msg), + ui->uris.atom_eventTransfer, + msg); + *widget = ui->box; return ui; @@ -154,7 +167,7 @@ port_event(LV2UI_Handle handle, SamplerUI* ui = (SamplerUI*)handle; if (format == ui->uris.atom_eventTransfer) { const LV2_Atom* atom = (const LV2_Atom*)buffer; - if (atom->type == ui->uris.atom_Blank) { + if (lv2_atom_forge_is_object_type(&ui->forge, atom->type)) { const LV2_Atom_Object* obj = (const LV2_Atom_Object*)atom; const LV2_Atom* file_uri = read_set_file(&ui->uris, obj); if (!file_uri) { -- cgit v1.2.1