From f19b7a8211590e73bc4ef739342e5c1a0755bc0d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 24 Jan 2014 20:31:27 +0000 Subject: Replace use of lv2_atom_forge_property_head with lv2_atom_forge_key. --- lv2/lv2plug.in/ns/ext/atom/atom-test.c | 30 +++++++++++++++--------------- plugins/eg04-sampler.lv2/uris.h | 4 ++-- plugins/eg05-scope.lv2/examploscope.c | 10 +++++----- plugins/eg05-scope.lv2/examploscope_ui.c | 10 ++++++---- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/lv2/lv2plug.in/ns/ext/atom/atom-test.c b/lv2/lv2plug.in/ns/ext/atom/atom-test.c index 9792c84..3f75dc2 100644 --- a/lv2/lv2plug.in/ns/ext/atom/atom-test.c +++ b/lv2/lv2plug.in/ns/ext/atom/atom-test.c @@ -93,7 +93,7 @@ main(void) &forge, lv2_atom_forge_object(&forge, &obj_frame, 0, eg_Object)); // eg_one = (Int)1 - lv2_atom_forge_property_head(&forge, eg_one, 0); + lv2_atom_forge_key(&forge, eg_one); LV2_Atom_Int* one = (LV2_Atom_Int*)lv2_atom_forge_deref( &forge, lv2_atom_forge_int(&forge, 1)); if (one->body != 1) { @@ -101,7 +101,7 @@ main(void) } // eg_two = (Long)2 - lv2_atom_forge_property_head(&forge, eg_two, 0); + lv2_atom_forge_key(&forge, eg_two); LV2_Atom_Long* two = (LV2_Atom_Long*)lv2_atom_forge_deref( &forge, lv2_atom_forge_long(&forge, 2)); if (two->body != 2) { @@ -109,7 +109,7 @@ main(void) } // eg_three = (Float)3.0 - lv2_atom_forge_property_head(&forge, eg_three, 0); + lv2_atom_forge_key(&forge, eg_three); LV2_Atom_Float* three = (LV2_Atom_Float*)lv2_atom_forge_deref( &forge, lv2_atom_forge_float(&forge, 3.0f)); if (three->body != 3) { @@ -117,7 +117,7 @@ main(void) } // eg_four = (Double)4.0 - lv2_atom_forge_property_head(&forge, eg_four, 0); + lv2_atom_forge_key(&forge, eg_four); LV2_Atom_Double* four = (LV2_Atom_Double*)lv2_atom_forge_deref( &forge, lv2_atom_forge_double(&forge, 4.0)); if (four->body != 4) { @@ -125,7 +125,7 @@ main(void) } // eg_true = (Bool)1 - lv2_atom_forge_property_head(&forge, eg_true, 0); + lv2_atom_forge_key(&forge, eg_true); LV2_Atom_Bool* t = (LV2_Atom_Bool*)lv2_atom_forge_deref( &forge, lv2_atom_forge_bool(&forge, true)); if (t->body != 1) { @@ -133,7 +133,7 @@ main(void) } // eg_false = (Bool)0 - lv2_atom_forge_property_head(&forge, eg_false, 0); + lv2_atom_forge_key(&forge, eg_false); LV2_Atom_Bool* f = (LV2_Atom_Bool*)lv2_atom_forge_deref( &forge, lv2_atom_forge_bool(&forge, false)); if (f->body != 0) { @@ -143,7 +143,7 @@ main(void) // eg_path = (Path)"/foo/bar" const char* pstr = "/foo/bar"; const size_t pstr_len = strlen(pstr); - lv2_atom_forge_property_head(&forge, eg_path, 0); + lv2_atom_forge_key(&forge, eg_path); LV2_Atom_String* path = (LV2_Atom_String*)lv2_atom_forge_deref( &forge, lv2_atom_forge_uri(&forge, pstr, pstr_len)); char* pbody = (char*)LV2_ATOM_BODY(path); @@ -154,7 +154,7 @@ main(void) // eg_uri = (URI)"http://example.org/value" const char* ustr = "http://example.org/value"; const size_t ustr_len = strlen(ustr); - lv2_atom_forge_property_head(&forge, eg_uri, 0); + lv2_atom_forge_key(&forge, eg_uri); LV2_Atom_String* uri = (LV2_Atom_String*)lv2_atom_forge_deref( &forge, lv2_atom_forge_uri(&forge, ustr, ustr_len)); char* ubody = (char*)LV2_ATOM_BODY(uri); @@ -164,7 +164,7 @@ main(void) // eg_urid = (URID)"http://example.org/value" LV2_URID eg_value = urid_map(NULL, "http://example.org/value"); - lv2_atom_forge_property_head(&forge, eg_urid, 0); + lv2_atom_forge_key(&forge, eg_urid); LV2_Atom_URID* urid = (LV2_Atom_URID*)lv2_atom_forge_deref( &forge, lv2_atom_forge_urid(&forge, eg_value)); if (urid->body != eg_value) { @@ -172,7 +172,7 @@ main(void) } // eg_string = (String)"hello" - lv2_atom_forge_property_head(&forge, eg_string, 0); + lv2_atom_forge_key(&forge, eg_string); LV2_Atom_String* string = (LV2_Atom_String*)lv2_atom_forge_deref( &forge, lv2_atom_forge_string( &forge, "hello", strlen("hello"))); @@ -182,7 +182,7 @@ main(void) } // eg_literal = (Literal)"hello"@fr - lv2_atom_forge_property_head(&forge, eg_literal, 0); + lv2_atom_forge_key(&forge, eg_literal); LV2_Atom_Literal* literal = (LV2_Atom_Literal*)lv2_atom_forge_deref( &forge, lv2_atom_forge_literal( &forge, "bonjour", strlen("bonjour"), @@ -193,7 +193,7 @@ main(void) } // eg_tuple = "foo",true - lv2_atom_forge_property_head(&forge, eg_tuple, 0); + lv2_atom_forge_key(&forge, eg_tuple); LV2_Atom_Forge_Frame tuple_frame; LV2_Atom_Tuple* tuple = (LV2_Atom_Tuple*)lv2_atom_forge_deref( &forge, lv2_atom_forge_tuple(&forge, &tuple_frame)); @@ -225,7 +225,7 @@ main(void) } // eg_vector = (Vector)1,2,3,4 - lv2_atom_forge_property_head(&forge, eg_vector, 0); + lv2_atom_forge_key(&forge, eg_vector); int32_t elems[] = { 1, 2, 3, 4 }; LV2_Atom_Vector* vector = (LV2_Atom_Vector*)lv2_atom_forge_deref( &forge, lv2_atom_forge_vector( @@ -236,7 +236,7 @@ main(void) } // eg_vector2 = (Vector)1,2,3,4 - lv2_atom_forge_property_head(&forge, eg_vector2, 0); + lv2_atom_forge_key(&forge, eg_vector2); LV2_Atom_Forge_Frame vec_frame; LV2_Atom_Vector* vector2 = (LV2_Atom_Vector*)lv2_atom_forge_deref( &forge, lv2_atom_forge_vector_head( @@ -250,7 +250,7 @@ main(void) } // eg_seq = (Sequence)1, 2 - lv2_atom_forge_property_head(&forge, eg_seq, 0); + lv2_atom_forge_key(&forge, eg_seq); LV2_Atom_Forge_Frame seq_frame; LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)lv2_atom_forge_deref( &forge, lv2_atom_forge_sequence_head(&forge, &seq_frame, 0)); diff --git a/plugins/eg04-sampler.lv2/uris.h b/plugins/eg04-sampler.lv2/uris.h index f9aa5a7..8e9faee 100644 --- a/plugins/eg04-sampler.lv2/uris.h +++ b/plugins/eg04-sampler.lv2/uris.h @@ -78,9 +78,9 @@ write_set_file(LV2_Atom_Forge* forge, LV2_Atom* set = (LV2_Atom*)lv2_atom_forge_object( forge, &frame, 0, uris->patch_Set); - lv2_atom_forge_property_head(forge, uris->patch_property, 0); + lv2_atom_forge_key(forge, uris->patch_property); lv2_atom_forge_urid(forge, uris->eg_sample); - lv2_atom_forge_property_head(forge, uris->patch_value, 0); + lv2_atom_forge_key(forge, uris->patch_value); lv2_atom_forge_path(forge, filename, filename_len); lv2_atom_forge_pop(forge, &frame); diff --git a/plugins/eg05-scope.lv2/examploscope.c b/plugins/eg05-scope.lv2/examploscope.c index 6c40887..b7fb2f3 100644 --- a/plugins/eg05-scope.lv2/examploscope.c +++ b/plugins/eg05-scope.lv2/examploscope.c @@ -190,11 +190,11 @@ tx_rawaudio(LV2_Atom_Forge* forge, lv2_atom_forge_object(forge, &frame, 0, uris->RawAudio); // Add integer 'channelID' property - lv2_atom_forge_property_head(forge, uris->channelID, 0); + lv2_atom_forge_key(forge, uris->channelID); lv2_atom_forge_int(forge, channel); // Add vector of floats 'audioData' property - lv2_atom_forge_property_head(forge, uris->audioData, 0); + lv2_atom_forge_key(forge, uris->audioData); lv2_atom_forge_vector( forge, sizeof(float), uris->atom_Float, n_samples, data); @@ -243,11 +243,11 @@ run(LV2_Handle handle, uint32_t n_samples) lv2_atom_forge_object(&self->forge, &frame, 0, self->uris.ui_State); // Add UI state as properties - lv2_atom_forge_property_head(&self->forge, self->uris.ui_spp, 0); + lv2_atom_forge_key(&self->forge, self->uris.ui_spp); lv2_atom_forge_int(&self->forge, self->ui_spp); - lv2_atom_forge_property_head(&self->forge, self->uris.ui_amp, 0); + lv2_atom_forge_key(&self->forge, self->uris.ui_amp); lv2_atom_forge_float(&self->forge, self->ui_amp); - lv2_atom_forge_property_head(&self->forge, self->uris.param_sampleRate, 0); + lv2_atom_forge_key(&self->forge, self->uris.param_sampleRate); lv2_atom_forge_float(&self->forge, self->rate); lv2_atom_forge_pop(&self->forge, &frame); } diff --git a/plugins/eg05-scope.lv2/examploscope_ui.c b/plugins/eg05-scope.lv2/examploscope_ui.c index edb64f9..a8c1e2c 100644 --- a/plugins/eg05-scope.lv2/examploscope_ui.c +++ b/plugins/eg05-scope.lv2/examploscope_ui.c @@ -85,18 +85,20 @@ send_ui_state(LV2UI_Handle handle) uint8_t obj_buf[1024]; lv2_atom_forge_set_buffer(&ui->forge, obj_buf, sizeof(obj_buf)); - // Event body is a ui_state object + // Start a ui:State object LV2_Atom_Forge_Frame frame; LV2_Atom* msg = (LV2_Atom*)lv2_atom_forge_object( &ui->forge, &frame, 0, ui->uris.ui_State); // msg[samples-per-pixel] = integer - lv2_atom_forge_property_head(&ui->forge, ui->uris.ui_spp, 0); + lv2_atom_forge_key(&ui->forge, ui->uris.ui_spp); lv2_atom_forge_int(&ui->forge, ui->stride); + // msg[amplitude] = float - lv2_atom_forge_property_head(&ui->forge, ui->uris.ui_amp, 0); + lv2_atom_forge_key(&ui->forge, ui->uris.ui_amp); lv2_atom_forge_float(&ui->forge, gain); - // Close off forged data + + // Finish ui:State object lv2_atom_forge_pop(&ui->forge, &frame); // Send message to plugin port '0' -- cgit v1.2.1