diff options
Diffstat (limited to 'lv2/lv2plug.in/ns/ext')
147 files changed, 8179 insertions, 0 deletions
diff --git a/lv2/lv2plug.in/ns/ext/atom/atom-helpers.h b/lv2/lv2plug.in/ns/ext/atom/atom-helpers.h new file mode 100644 index 0000000..6fff74b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/atom/atom-helpers.h @@ -0,0 +1,310 @@ +/* + Copyright 2008-2012 David Robillard <http://drobilla.net> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +/** + @file atom-helpers.h Helper functions for the LV2 Atom extension. + + Note these functions are all static inline, do not take their address. + + This header is non-normative, it is provided for convenience. +*/ + +#ifndef LV2_ATOM_HELPERS_H +#define LV2_ATOM_HELPERS_H + +#include <stdint.h> +#include <stdio.h> +#include <string.h> + +#include "lv2/lv2plug.in/ns/ext/atom/atom.h" + +#ifdef __cplusplus +extern "C" { +#else +# include <stdbool.h> +#endif + +/** Pad a size to 64 bits. */ +static inline uint32_t +lv2_atom_pad_size(uint32_t size) +{ + return (size + 7) & (~7); +} + +/** Return true iff @p atom is null. */ +static inline bool +lv2_atom_is_null(const LV2_Atom* atom) +{ + return !atom || (atom->type == 0 && atom->size == 0); +} + +/** Return true iff @p a is equal to @p b. */ +static inline bool +lv2_atom_equals(const LV2_Atom* a, const LV2_Atom* b) +{ + return (a == b) || ( + (a->type == b->type) && + (a->size == b->size) && + !memcmp(LV2_ATOM_CONTENTS(LV2_Atom, a), + LV2_ATOM_CONTENTS(LV2_Atom, b), + a->size)); +} + +/** + @name Sequence Iterator + @{ +*/ + +/** An iterator over the elements of an LV2_Atom_Sequence. */ +typedef LV2_Atom_Event* LV2_Atom_Sequence_Iter; + +/** Get an iterator pointing to the first element in @p tup. */ +static inline LV2_Atom_Sequence_Iter +lv2_sequence_begin(const LV2_Atom_Sequence* seq) +{ + return (LV2_Atom_Sequence_Iter)(LV2_ATOM_CONTENTS(LV2_Atom_Sequence, seq)); +} + +/** Return true iff @p i has reached the end of @p tup. */ +static inline bool +lv2_sequence_is_end(const LV2_Atom_Sequence* seq, LV2_Atom_Sequence_Iter i) +{ + return (uint8_t*)i >= ((uint8_t*)seq + sizeof(LV2_Atom) + seq->atom.size); +} + +/** Return an iterator to the element following @p i. */ +static inline LV2_Atom_Sequence_Iter +lv2_sequence_iter_next(const LV2_Atom_Sequence_Iter i) +{ + return (LV2_Atom_Sequence_Iter)((uint8_t*)i + + sizeof(LV2_Atom_Event) + + lv2_atom_pad_size(i->body.size)); +} + +/** Return the element pointed to by @p i. */ +static inline LV2_Atom_Event* +lv2_sequence_iter_get(LV2_Atom_Sequence_Iter i) +{ + return (LV2_Atom_Event*)i; +} + +/** + A macro for iterating over all events in a Sequence. + @param sequence The sequence to iterate over + @param iter The name of the iterator + + This macro is used similarly to a for loop (which it expands to), e.g.: + @code + LV2_SEQUENCE_FOREACH(sequence, i) { + LV2_Atom_Event* ev = lv2_sequence_iter_get(i); + // Do something with ev here... + } + @endcode +*/ +#define LV2_SEQUENCE_FOREACH(sequence, iter) \ + for (LV2_Atom_Sequence_Iter (iter) = lv2_sequence_begin(sequence); \ + !lv2_sequence_is_end(sequence, (iter)); \ + (iter) = lv2_sequence_iter_next(iter)) + +/** + @} + @name Tuple Iterator + @{ +*/ + +/** An iterator over the elements of an LV2_Atom_Tuple. */ +typedef LV2_Atom* LV2_Atom_Tuple_Iter; + +/** Get an iterator pointing to the first element in @p tup. */ +static inline LV2_Atom_Tuple_Iter +lv2_tuple_begin(const LV2_Atom_Tuple* tup) +{ + return (LV2_Atom_Tuple_Iter)(LV2_ATOM_BODY(tup)); +} + +/** Return true iff @p i has reached the end of @p tup. */ +static inline bool +lv2_tuple_is_end(const LV2_Atom_Tuple* tup, LV2_Atom_Tuple_Iter i) +{ + return (uint8_t*)i >= ((uint8_t*)tup + sizeof(LV2_Atom) + tup->atom.size); +} + +/** Return an iterator to the element following @p i. */ +static inline LV2_Atom_Tuple_Iter +lv2_tuple_iter_next(const LV2_Atom_Tuple_Iter i) +{ + return (LV2_Atom_Tuple_Iter)( + (uint8_t*)i + sizeof(LV2_Atom) + lv2_atom_pad_size(i->size)); +} + +/** Return the element pointed to by @p i. */ +static inline LV2_Atom* +lv2_tuple_iter_get(LV2_Atom_Tuple_Iter i) +{ + return (LV2_Atom*)i; +} + +/** + A macro for iterating over all properties of a Tuple. + @param tuple The tuple to iterate over + @param iter The name of the iterator + + This macro is used similarly to a for loop (which it expands to), e.g.: + @code + LV2_TUPLE_FOREACH(tuple, i) { + LV2_Atom_Property* prop = lv2_tuple_iter_get(i); + // Do something with prop here... + } + @endcode +*/ +#define LV2_TUPLE_FOREACH(tuple, iter) \ + for (LV2_Atom_Tuple_Iter (iter) = lv2_tuple_begin(tuple); \ + !lv2_tuple_is_end(tuple, (iter)); \ + (iter) = lv2_tuple_iter_next(iter)) + +/** + @} + @name Object Iterator + @{ +*/ + +/** An iterator over the properties of an LV2_Atom_Object. */ +typedef LV2_Atom_Property_Body* LV2_Atom_Object_Iter; + +/** Get an iterator pointing to the first property in @p obj. */ +static inline LV2_Atom_Object_Iter +lv2_object_begin(const LV2_Atom_Object* obj) +{ + return (LV2_Atom_Object_Iter)(LV2_ATOM_CONTENTS(LV2_Atom_Object, obj)); +} + +/** Return true iff @p i has reached the end of @p obj. */ +static inline bool +lv2_object_is_end(const LV2_Atom_Object* obj, LV2_Atom_Object_Iter i) +{ + return (uint8_t*)i >= ((uint8_t*)obj + sizeof(LV2_Atom) + obj->atom.size); +} + +/** Return true iff @p l points to the same property as @p r. */ +static inline bool +lv2_object_iter_equals(const LV2_Atom_Object_Iter l, + const LV2_Atom_Object_Iter r) +{ + return l == r; +} + +/** Return an iterator to the property following @p i. */ +static inline LV2_Atom_Object_Iter +lv2_object_iter_next(const LV2_Atom_Object_Iter i) +{ + const LV2_Atom* const value = (LV2_Atom*)((uint8_t*)i + sizeof(i)); + return (LV2_Atom_Object_Iter)((uint8_t*)i + + sizeof(LV2_Atom_Property_Body) + + lv2_atom_pad_size(value->size)); +} + +/** Return the property pointed to by @p i. */ +static inline LV2_Atom_Property_Body* +lv2_object_iter_get(LV2_Atom_Object_Iter i) +{ + return (LV2_Atom_Property_Body*)i; +} + +/** + A macro for iterating over all properties of an Object. + @param object The object to iterate over + @param iter The name of the iterator + + This macro is used similarly to a for loop (which it expands to), e.g.: + @code + LV2_OBJECT_FOREACH(object, i) { + LV2_Atom_Property* prop = lv2_object_iter_get(i); + // Do something with prop here... + } + @endcode +*/ +#define LV2_OBJECT_FOREACH(object, iter) \ + for (LV2_Atom_Object_Iter (iter) = lv2_object_begin(object); \ + !lv2_object_is_end(object, (iter)); \ + (iter) = lv2_object_iter_next(iter)) + +/** + @} + @name Object Query + @{ +*/ + +/** A single entry in an Object query. */ +typedef struct { + uint32_t key; /**< Key to query (input set by user) */ + const LV2_Atom** value; /**< Found value (output set by query function) */ +} LV2_Atom_Object_Query; + +static const LV2_Atom_Object_Query LV2_OBJECT_QUERY_END = { 0, NULL }; + +/** + Get an object's values for various keys. + + The value pointer of each item in @p query will be set to the location of + the corresponding value in @p object. Every value pointer in @p query MUST + be initialised to NULL. This function reads @p object in a single linear + sweep. By allocating @p query on the stack, objects can be "queried" + quickly without allocating any memory. This function is realtime safe. + + For example: + @code + const LV2_Atom* name = NULL; + const LV2_Atom* age = NULL; + LV2_Atom_Object_Query q[] = { + { urids.eg_name, &name }, + { urids.eg_age, &age }, + LV2_OBJECT_QUERY_END + }; + lv2_object_get(obj, q); + // name and age are now set to the appropriate values in obj, or NULL. + @endcode +*/ +static inline int +lv2_object_get(const LV2_Atom_Object* object, LV2_Atom_Object_Query* query) +{ + int matches = 0; + int n_queries = 0; + + /* Count number of query keys so we can short-circuit when done */ + for (LV2_Atom_Object_Query* q = query; q->key; ++q) { + ++n_queries; + } + + LV2_OBJECT_FOREACH(object, o) { + const LV2_Atom_Property_Body* prop = lv2_object_iter_get(o); + for (LV2_Atom_Object_Query* q = query; q->key; ++q) { + if (q->key == prop->key && !*q->value) { + *q->value = &prop->value; + if (++matches == n_queries) { + return matches; + } + break; + } + } + } + return matches; +} + +/** + @} +*/ + +#endif /* LV2_ATOM_HELPERS_H */ diff --git a/lv2/lv2plug.in/ns/ext/atom/atom-test.c b/lv2/lv2plug.in/ns/ext/atom/atom-test.c new file mode 100644 index 0000000..1a88d7d --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/atom/atom-test.c @@ -0,0 +1,304 @@ +/* + Copyright 2012 David Robillard <http://drobilla.net> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> + +#include "lv2/lv2plug.in/ns/ext/atom/atom-helpers.h" +#include "lv2/lv2plug.in/ns/ext/atom/forge.h" + +char** uris = NULL; +size_t n_uris = 0; + +char* +copy_string(const char* str) +{ + const size_t len = strlen(str); + char* dup = (char*)malloc(len + 1); + memcpy(dup, str, len + 1); + return dup; +} + +LV2_URID +urid_map(LV2_URID_Map_Handle handle, const char* uri) +{ + for (size_t i = 0; i < n_uris; ++i) { + if (!strcmp(uris[i], uri)) { + return i + 1; + } + } + + uris = (char**)realloc(uris, ++n_uris * sizeof(char*)); + uris[n_uris - 1] = copy_string(uri); + return n_uris; +} + +int +test_fail(const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + fprintf(stderr, "error: "); + vfprintf(stderr, fmt, args); + va_end(args); + return 1; +} + +int +main() +{ + LV2_URID_Map map = { NULL, urid_map }; + LV2_Atom_Forge forge; + lv2_atom_forge_init(&forge, &map); + + LV2_URID eg_Object = urid_map(NULL, "http://example.org/Object"); + LV2_URID eg_one = urid_map(NULL, "http://example.org/one"); + LV2_URID eg_two = urid_map(NULL, "http://example.org/two"); + LV2_URID eg_three = urid_map(NULL, "http://example.org/three"); + LV2_URID eg_four = urid_map(NULL, "http://example.org/four"); + LV2_URID eg_true = urid_map(NULL, "http://example.org/true"); + LV2_URID eg_false = urid_map(NULL, "http://example.org/false"); + LV2_URID eg_uri = urid_map(NULL, "http://example.org/uri"); + LV2_URID eg_string = urid_map(NULL, "http://example.org/string"); + LV2_URID eg_literal = urid_map(NULL, "http://example.org/literal"); + LV2_URID eg_tuple = urid_map(NULL, "http://example.org/tuple"); + LV2_URID eg_vector = urid_map(NULL, "http://example.org/vector"); + LV2_URID eg_seq = urid_map(NULL, "http://example.org/seq"); + +#define BUF_SIZE 1024 +#define NUM_PROPS 12 + + uint8_t buf[BUF_SIZE]; + lv2_atom_forge_set_buffer(&forge, buf, BUF_SIZE); + + LV2_Atom* obj = (LV2_Atom*)lv2_atom_forge_object( + &forge, NULL, 0, eg_Object); + + // eg_one = (Int32)1 + lv2_atom_forge_property_head(&forge, obj, eg_one, 0); + LV2_Atom_Int32* one = lv2_atom_forge_int32(&forge, obj, 1); + if (one->value != 1) { + return test_fail("%d != 1\n", one->value); + } + + // eg_two = (Int64)2 + lv2_atom_forge_property_head(&forge, obj, eg_two, 0); + LV2_Atom_Int64* two = lv2_atom_forge_int64(&forge, obj, 2); + if (two->value != 2) { + return test_fail("%ld != 2\n", two->value); + } + + // eg_three = (Float)3.0 + lv2_atom_forge_property_head(&forge, obj, eg_three, 0); + LV2_Atom_Float* three = lv2_atom_forge_float(&forge, obj, 3.0f); + if (three->value != 3) { + return test_fail("%f != 3\n", three->value); + } + + // eg_four = (Double)4.0 + lv2_atom_forge_property_head(&forge, obj, eg_four, 0); + LV2_Atom_Double* four = lv2_atom_forge_double(&forge, obj, 4.0); + if (four->value != 4) { + return test_fail("%ld != 4\n", four->value); + } + + // eg_true = (Bool)1 + lv2_atom_forge_property_head(&forge, obj, eg_true, 0); + LV2_Atom_Bool* t = lv2_atom_forge_bool(&forge, obj, true); + if (t->value != 1) { + return test_fail("%ld != 1 (true)\n", t->value); + } + + // eg_false = (Bool)0 + lv2_atom_forge_property_head(&forge, obj, eg_false, 0); + LV2_Atom_Bool* f = lv2_atom_forge_bool(&forge, obj, false); + if (f->value != 0) { + return test_fail("%ld != 0 (false)\n", f->value); + } + + // eg_uri = (URID)"http://example.org/value" + LV2_URID eg_value = urid_map(NULL, "http://example.org/value"); + lv2_atom_forge_property_head(&forge, obj, eg_uri, 0); + LV2_Atom_URID* uri = lv2_atom_forge_urid(&forge, obj, eg_value); + if (uri->id != eg_value) { + return test_fail("%u != %u\n", uri->id, eg_value); + } + + // eg_string = (String)"hello" + lv2_atom_forge_property_head(&forge, obj, eg_string, 0); + LV2_Atom_String* string = lv2_atom_forge_string( + &forge, obj, (const uint8_t*)"hello", strlen("hello")); + uint8_t* body = (uint8_t*)LV2_ATOM_BODY(string); + if (strcmp((const char*)body, "hello")) { + return test_fail("%s != \"hello\"\n", (const char*)body); + } + + // eg_literal = (Literal)"hello"@fr + lv2_atom_forge_property_head(&forge, obj, eg_literal, 0); + LV2_Atom_Literal* literal = lv2_atom_forge_literal( + &forge, obj, (const uint8_t*)"bonjour", strlen("bonjour"), + 0, urid_map(NULL, "http://lexvo.org/id/term/fr")); + body = (uint8_t*)LV2_ATOM_CONTENTS(LV2_Atom_Literal, literal); + if (strcmp((const char*)body, "bonjour")) { + return test_fail("%s != \"bonjour\"\n", (const char*)body); + } + + // eg_tuple = "foo",true + lv2_atom_forge_property_head(&forge, obj, eg_tuple, 0); + LV2_Atom_Tuple* tuple = lv2_atom_forge_tuple(&forge, obj); + LV2_Atom_String* tup0 = lv2_atom_forge_string( + &forge, (LV2_Atom*)tuple, (const uint8_t*)"foo", strlen("foo")); + LV2_Atom_Bool* tup1 = lv2_atom_forge_bool(&forge, (LV2_Atom*)tuple, true); + obj->size += ((LV2_Atom*)tuple)->size; + LV2_Atom_Tuple_Iter i = lv2_tuple_begin(tuple); + if (lv2_tuple_is_end(tuple, i)) { + return test_fail("Tuple iterator is empty\n"); + } + LV2_Atom* tup0i = (LV2_Atom*)lv2_tuple_iter_get(i); + if (!lv2_atom_equals((LV2_Atom*)tup0, tup0i)) { + return test_fail("Corrupt tuple element 0\n"); + } + i = lv2_tuple_iter_next(i); + if (lv2_tuple_is_end(tuple, i)) { + return test_fail("Premature end of tuple iterator\n"); + } + LV2_Atom* tup1i = lv2_tuple_iter_get(i); + if (!lv2_atom_equals((LV2_Atom*)tup1, tup1i)) { + return test_fail("Corrupt tuple element 1\n"); + } + i = lv2_tuple_iter_next(i); + if (!lv2_tuple_is_end(tuple, i)) { + return test_fail("Tuple iter is not at end\n"); + } + + // eg_vector = (Vector<Int32>)1,2,3,4 + lv2_atom_forge_property_head(&forge, obj, eg_vector, 0); + int32_t elems[] = { 1, 2, 3, 4 }; + LV2_Atom_Vector* vector = lv2_atom_forge_vector( + &forge, obj, 4, forge.Int32, sizeof(int32_t), elems); + void* vec_body = LV2_ATOM_CONTENTS(LV2_Atom_Vector, vector); + if (memcmp(elems, vec_body, sizeof(elems))) { + return test_fail("Corrupt vector\n"); + } + + // eg_seq = (Sequence)1, 2 + lv2_atom_forge_property_head(&forge, obj, eg_seq, 0); + LV2_Atom_Sequence* seq = lv2_atom_forge_sequence_head(&forge, obj, 0); + lv2_atom_forge_audio_time(&forge, (LV2_Atom*)seq, 0, 0); + lv2_atom_forge_int32(&forge, (LV2_Atom*)seq, 1); + lv2_atom_forge_audio_time(&forge, (LV2_Atom*)seq, 1, 0); + lv2_atom_forge_int32(&forge, (LV2_Atom*)seq, 2); + obj->size += seq->atom.size - sizeof(LV2_Atom); + + // Test equality + LV2_Atom_Int32 itwo = { { forge.Int32, sizeof(int32_t) }, 2 }; + if (lv2_atom_equals((LV2_Atom*)one, (LV2_Atom*)two)) { + return test_fail("1 == 2.0\n"); + } else if (lv2_atom_equals((LV2_Atom*)one, (LV2_Atom*)&itwo)) { + return test_fail("1 == 2\n"); + } + + unsigned n_events = 0; + LV2_SEQUENCE_FOREACH(seq, i) { + LV2_Atom_Event* ev = lv2_sequence_iter_get(i); + if (ev->time.audio.frames != n_events + || ev->time.audio.subframes != 0) { + return test_fail("Corrupt event %u has bad time\n", n_events); + } else if (ev->body.type != forge.Int32) { + return test_fail("Corrupt event %u has bad type\n", n_events); + } else if (((LV2_Atom_Int32*)&ev->body)->value != (int)n_events + 1) { + return test_fail("Event %u != %d\n", n_events, n_events + 1); + } + ++n_events; + } + + unsigned n_props = 0; + LV2_OBJECT_FOREACH((LV2_Atom_Object*)obj, i) { + LV2_Atom_Property_Body* prop = lv2_object_iter_get(i); + if (!prop->key) { + return test_fail("Corrupt property %u has no key\n", n_props); + } else if (prop->context) { + return test_fail("Corrupt property %u has context\n", n_props); + } + ++n_props; + } + + if (n_props != NUM_PROPS) { + return test_fail("Corrupt object has %u properties != %u\n", + n_props, NUM_PROPS); + } + + const LV2_Atom* one_match = NULL; + const LV2_Atom* two_match = NULL; + const LV2_Atom* three_match = NULL; + const LV2_Atom* four_match = NULL; + const LV2_Atom* true_match = NULL; + const LV2_Atom* false_match = NULL; + const LV2_Atom* uri_match = NULL; + const LV2_Atom* string_match = NULL; + const LV2_Atom* literal_match = NULL; + const LV2_Atom* tuple_match = NULL; + const LV2_Atom* vector_match = NULL; + const LV2_Atom* seq_match = NULL; + LV2_Atom_Object_Query q[] = { + { eg_one, &one_match }, + { eg_two, &two_match }, + { eg_three, &three_match }, + { eg_four, &four_match }, + { eg_true, &true_match }, + { eg_false, &false_match }, + { eg_uri, &uri_match }, + { eg_string, &string_match }, + { eg_literal, &literal_match }, + { eg_tuple, &tuple_match }, + { eg_vector, &vector_match }, + { eg_seq, &seq_match }, + LV2_OBJECT_QUERY_END + }; + + unsigned matches = lv2_object_get((LV2_Atom_Object*)obj, q); + if (matches != n_props) { + return test_fail("Query failed, %u matches != %u\n", matches, n_props); + } else if (!lv2_atom_equals((LV2_Atom*)one, one_match)) { + return test_fail("Bad match one\n"); + } else if (!lv2_atom_equals((LV2_Atom*)two, two_match)) { + return test_fail("Bad match two\n"); + } else if (!lv2_atom_equals((LV2_Atom*)three, three_match)) { + return test_fail("Bad match three\n"); + } else if (!lv2_atom_equals((LV2_Atom*)four, four_match)) { + return test_fail("Bad match four\n"); + } else if (!lv2_atom_equals((LV2_Atom*)t, true_match)) { + return test_fail("Bad match true\n"); + } else if (!lv2_atom_equals((LV2_Atom*)f, false_match)) { + return test_fail("Bad match false\n"); + } else if (!lv2_atom_equals((LV2_Atom*)uri, uri_match)) { + return test_fail("Bad match URI\n"); + } else if (!lv2_atom_equals((LV2_Atom*)string, string_match)) { + return test_fail("Bad match string\n"); + } else if (!lv2_atom_equals((LV2_Atom*)literal, literal_match)) { + return test_fail("Bad match literal\n"); + } else if (!lv2_atom_equals((LV2_Atom*)tuple, tuple_match)) { + return test_fail("Bad match tuple\n"); + } else if (!lv2_atom_equals((LV2_Atom*)vector, vector_match)) { + return test_fail("Bad match vector\n"); + } else if (!lv2_atom_equals((LV2_Atom*)seq, seq_match)) { + return test_fail("Bad match sequence\n"); + } + + printf("All tests passed.\n"); + return 0; +} diff --git a/lv2/lv2plug.in/ns/ext/atom/atom.h b/lv2/lv2plug.in/ns/ext/atom/atom.h new file mode 100644 index 0000000..bea9197 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/atom/atom.h @@ -0,0 +1,203 @@ +/* + Copyright 2008-2012 David Robillard <http://drobilla.net> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +/** + @file atom.h C header for the LV2 Atom extension + <http://lv2plug.in/ns/ext/atom>. + + This header describes the binary layout of various types defined in the + atom extension. +*/ + +#ifndef LV2_ATOM_H +#define LV2_ATOM_H + +#define LV2_ATOM_URI "http://lv2plug.in/ns/ext/atom" + +#define LV2_ATOM_REFERENCE_TYPE 0 + +#include <stdint.h> +#include <stddef.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** This expression will fail to compile if double does not fit in 64 bits. */ +typedef char lv2_atom_assert_double_fits_in_64_bits[ + ((sizeof(double) <= sizeof(uint64_t)) * 2) - 1]; + +/** + Return a pointer to the contents of a variable-sized atom. + @param type The type of the atom, e.g. LV2_Atom_String. + @param atom A variable-sized atom. +*/ +#define LV2_ATOM_CONTENTS(type, atom) \ + ((void*)((uint8_t*)(atom) + sizeof(type))) + +/** Return a pointer to the body of @p atom (just past the LV2_Atom head). */ +#define LV2_ATOM_BODY(atom) LV2_ATOM_CONTENTS(LV2_Atom, atom) + +/** The header of an atom:Atom. */ +typedef struct { + uint32_t type; /**< Type of this atom (mapped URI). */ + uint32_t size; /**< Size in bytes, not including type and size. */ +} LV2_Atom; + +/** An atom:Int32 or atom:Bool. May be cast to LV2_Atom. */ +typedef struct { + LV2_Atom atom; + int32_t value; +} LV2_Atom_Int32; + +/** An atom:Int64. May be cast to LV2_Atom. */ +typedef struct { + LV2_Atom atom; + int64_t value; +} LV2_Atom_Int64; + +/** An atom:Float. May be cast to LV2_Atom. */ +typedef struct { + LV2_Atom atom; + float value; +} LV2_Atom_Float; + +/** An atom:Double. May be cast to LV2_Atom. */ +typedef struct { + LV2_Atom atom; + double value; +} LV2_Atom_Double; + +/** An atom:Bool. May be cast to LV2_Atom. */ +typedef LV2_Atom_Int32 LV2_Atom_Bool; + +/** An atom:URID. May be cast to LV2_Atom. */ +typedef struct { + LV2_Atom atom; /**< Atom header. */ + uint32_t id; /**< URID. */ +} LV2_Atom_URID; + +/** The complete header of an atom:String. */ +typedef struct { + LV2_Atom atom; /**< Atom header. */ + /* Contents (a null-terminated UTF-8 string) follow here. */ +} LV2_Atom_String; + +/** The header of an atom:Literal body. */ +typedef struct { + uint32_t datatype; /**< The ID of the datatype of this literal. */ + uint32_t lang; /**< The ID of the language of this literal. */ +} LV2_Atom_Literal_Head; + +/** The complete header of an atom:Literal. */ +typedef struct { + LV2_Atom atom; /**< Atom header. */ + LV2_Atom_Literal_Head literal; /**< Literal body header. */ + /* Contents (a null-terminated UTF-8 string) follow here. */ +} LV2_Atom_Literal; + +/** The complete header of an atom:Tuple. */ +typedef struct { + LV2_Atom atom; /**< Atom header. */ + /* Contents (a series of complete atoms) follow here. */ +} LV2_Atom_Tuple; + +/** The complete header of an atom:Vector. */ +typedef struct { + LV2_Atom atom; /**< Atom header. */ + uint32_t elem_count; /**< The number of elements in the vector */ + uint32_t elem_type; /**< The type of each element in the vector */ + /* Contents (a series of packed atom bodies) follow here. */ +} LV2_Atom_Vector; + +/** The header of an atom:Property body (e.g. in an atom:Object). */ +typedef struct { + uint32_t key; /**< Key (predicate) (mapped URI). */ + uint32_t context; /**< Context URID (may be, and generally is, 0). */ + LV2_Atom value; /**< Value atom header. */ +} LV2_Atom_Property_Body; + +/** The complete header of an atom:Property. */ +typedef struct { + LV2_Atom atom; /**< Atom header. */ + uint32_t key; /**< Key (predicate) (mapped URI). */ + uint32_t context; /**< Context URID (may be, and generally is, 0). */ + LV2_Atom value; /**< Value atom header. */ + /* Value atom body follows here. */ +} LV2_Atom_Property; + +/** The complete header of an atom:Object. */ +typedef struct { + LV2_Atom atom; /**< Atom header. */ + uint32_t id; /**< URID for atom:Resource, or blank ID for atom:Blank. */ + uint32_t type; /**< Type URID (same as rdf:type, for fast dispatch). */ + /* Contents (a series of property bodies) follow here. */ +} LV2_Atom_Object; + +/** The complete header of an atom:Response. */ +typedef struct { + LV2_Atom atom; /**< Atom header. */ + uint32_t source; /**< ID of message this is a response to (may be 0). */ + uint32_t type; /**< Specific response type URID (may be 0). */ + uint32_t seq; /**< Response sequence number, 0 for end. */ + LV2_Atom body; /**< Body atom header (may be empty). */ + /* Body optionally follows here. */ +} LV2_Atom_Response; + +/** A time stamp in frames. Note this type is NOT an LV2_Atom. */ +typedef struct { + uint32_t frames; /**< Time in frames relative to this block. */ + uint32_t subframes; /**< Fractional time in 1/(2^32)ths of a frame. */ +} LV2_Atom_Audio_Time; + +/** The header of an atom:Event. Note this type is NOT an LV2_Atom. */ +typedef struct { + /** Time stamp. Which type is valid is determined by context. */ + union { + LV2_Atom_Audio_Time audio; /**< Time in audio frames. */ + double beats; /**< Time in beats. */ + } time; + LV2_Atom body; /**< Event body atom header. */ + /* Body atom contents follow here. */ +} LV2_Atom_Event; + +/** + A sequence of events (time-stamped atoms). + + This is used as the contents of an atom:EventPort, but is a generic Atom + type which can be used anywhere. + + The contents of a sequence is a series of LV2_Atom_Event, each aligned + to 64-bits, e.g.: + <pre> + | Event 1 (size 6) | Event 2 + | | | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + |FRAMES |SUBFRMS|TYPE |SIZE |DATADATADATAPAD|FRAMES |SUBFRMS|... + </pre> +*/ +typedef struct { + LV2_Atom atom; /**< Atom header. */ + uint32_t capacity; /**< Maximum size of contents. */ + uint32_t time_type; /**< URID type of event time stamps. */ + /* Contents (a series of events) follow here. */ +} LV2_Atom_Sequence; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV2_ATOM_H */ diff --git a/lv2/lv2plug.in/ns/ext/atom/atom.ttl b/lv2/lv2plug.in/ns/ext/atom/atom.ttl new file mode 100644 index 0000000..7d534d0 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/atom/atom.ttl @@ -0,0 +1,462 @@ +# LV2 Atom Extension +# Copyright 2007-2012 David Robillard <d@drobilla.net> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix atom: <http://lv2plug.in/ns/ext/atom#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://lv2plug.in/ns/ext/atom> + a lv2:Specification ; + doap:name "LV2 Atom" ; + doap:shortdesc "A generic value container and several data types." ; + doap:license <http://opensource.org/licenses/isc> ; + rdfs:seeAlso <atom-helpers.h> , + <forge.h> ; + doap:release [ + doap:revision "0.4" ; + doap:created "2012-02-07" + ] ; + doap:maintainer [ + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + rdfs:seeAlso <http://drobilla.net/drobilla.rdf> + ] ; + lv2:documentation """ +<p>This extension defines a generic container for data, called an <q>Atom</q>, +and several basic Atom types which can be used to express structured data. +Atoms allow LV2 plugins and hosts to communicate, process, serialise, and store +values of any type via a generic mechanism (e.g. ports, files, networks, +ringbuffers, etc.). Atoms are, with one exception, Plain Old Data (POD) which +may safely be copied (e.g. with a simple call to <code>memcpy</code>).</p> + +<p>Since Atom communication can be implemented generically, plugins that +understand some type can be used together in a host that does not understand +that type, and plugins (e.g. routers, delays) can process atoms of unknown +type.</p> + +<p>Atoms can and should be used anywhere values of various types must be stored +or transmitted. This extension defines port types, atom:ValuePort and +atom:MessagePort, which are connected to an Atom. The atom:Sequence type in +conjunction with atom:MessagePort is intended to replace the <a +href="http://lv2plug.in/ns/ext/event">LV2 event</a> extension.</p> + +<p>The types defined in this extension should be powerful enough to express +almost any structure. Implementers SHOULD build structures out of the types +provided here, rather than define new binary formats (e.g. use atom:Object +rather than a new C <code>struct</code> type). New binary formats are an +implementation burden which harms interoperabilty, and should only be defined +where absolutely necessary.</p> + +<p>Implementing this extension requires a facility for mapping URIs to +integers, such as the <a href="http://lv2plug.in/ns/ext/urid">LV2 URID</a> +extension.</p> +""" . + +atom:cType + a rdf:Property , + owl:DatatypeProperty ; + rdfs:label "C type" ; + rdfs:domain rdfs:Class ; + rdfs:range xsd:string ; + rdfs:comment """ +The identifier for a C type describing the in-memory representation of +an instance of this class. +""" . + +atom:Atom + a rdfs:Class ; + rdfs:label "Atom" ; + atom:cType "LV2_Atom" ; + lv2:documentation """ +<p>Abstract base class for all atoms. An LV2_Atom has a 32-bit +<code>type</code> and <code>size</code> followed by a body of <code>size</code> +bytes. Atoms MUST be 64-bit aligned.</p> + +<p>All concrete Atom types (subclasses of this class) MUST define a precise +binary layout for their body.</p> + +<p>The <code>type</code> field is the URI of an Atom type mapped to an integer. +Implementations SHOULD gracefully ignore, or pass through, atoms with unknown +types.</p> + +<p>All atoms are POD by definition except references, which as a special case +have <code>type = 0</code>. An Atom MUST NOT contain a Reference. It is safe +to copy any non-reference Atom with a simple <code>memcpy</code>, even if the +implementation does not understand <code>type</code>. Though this extension +reserves the type 0 for references, the details of reference handling are +currently unspecified. A future revision of this extension, or a different +extension, may define how to use non-POD data and references. Implementations +MUST NOT send references to another implementation unless the receiver is +explicitly known to support references (e.g. by supporting a feature). The +atom with both <code>type</code> <em>and</em> <code>size</code> 0 is +<q>null</q>, which is not considered a Reference.</p> +""" . + +atom:Bang + a rdfs:Class ; + rdfs:subClassOf atom:Atom ; + rdfs:label "Bang" ; + rdfs:comment "Generic activity or trigger, with no body." . + +atom:Number + a rdfs:Class ; + rdfs:subClassOf atom:Atom ; + rdfs:label "Number" . + +atom:Int32 + a rdfs:Class ; + rdfs:subClassOf atom:Number ; + rdfs:label "Signed 32-bit integer" ; + atom:cType "LV2_Atom_Int32" . + +atom:Int64 + a rdfs:Class ; + rdfs:subClassOf atom:Number ; + rdfs:label "Signed 64-bit integer" ; + atom:cType "LV2_Atom_Int64" . + +atom:Float + a rdfs:Class ; + rdfs:subClassOf atom:Number ; + rdfs:label "32-bit IEEE-754 floating point number" ; + atom:cType "LV2_Atom_Float" . + +atom:Double + a rdfs:Class ; + rdfs:subClassOf atom:Number ; + rdfs:label "64-bit IEEE-754 floating point number" ; + atom:cType "LV2_Atom_Double" . + +atom:Bool + a rdfs:Class ; + rdfs:subClassOf atom:Atom ; + rdfs:label "Boolean" ; + atom:cType "LV2_Atom_Bool" ; + rdfs:comment "An Int32 where 0 is false and any other value is true." . + +atom:String + a rdfs:Class ; + rdfs:subClassOf atom:Atom ; + rdfs:label "String" ; + atom:cType "LV2_Atom_String" ; + lv2:documentation """ +<p>A UTF-8 encoded string.</p> + +<p>The body of an LV2_Atom_String is a C string in UTF-8 encoding, i.e. an +array of bytes (<code>uint8_t</code>) terminated with a NULL byte +(<code>'\\0'</code>).</p> + +<p>This type can be used for free-form strings, but in most cases it is better to +use atom:Literal since this supports a language tag or datatype. Implementations +SHOULD NOT use atom:String unless translating the string does not make sense and +the string has no meaningful datatype.</p> +""" . + +atom:Literal + a rdfs:Class ; + rdfs:subClassOf atom:Atom ; + rdfs:label "String Literal" ; + atom:cType "LV2_Atom_Literal" ; + lv2:documentation """ +<p>A UTF-8 encoded string literal, with an optional datatype or language.</p> + +<p>This type is compatible with rdf:Literal and is capable of expressing a +string in any language or a value of any type. A Literal has a +<code>datatype</code> and <code>lang</code> followed by string data in UTF-8 +encoding. The length of the string data in bytes is <code>size - +sizeof(LV2_Atom_Literal)</code>, including the terminating NULL character. The +<code>lang</code> field SHOULD be a URI of the form +<http://lexvo.org/id/term/LANG> where LANG is an <a +href="http://www.loc.gov/standards/iso639-2/">ISO 693-2</a> or <a +href="http://www.loc.gov/standards/iso639-2/">ISO 693-3</a> language code.</p> + +<p>A Literal may have a <code>datatype</code> OR a <code>lang</code>, but never +both.</p> + +<p>For example, a Literal can be "Hello" in English:</p> +<pre class="c-code"> +void set_to_hello_in_english(LV2_Atom_Literal* lit) { + lit->atom.type = map(expand("atom:Literal")); + lit->atom.size = 14; + lit->datatype = 0; + lit->lang = map("http://lexvo.org/id/term/en"); + memcpy(LV2_ATOM_CONTENTS(LV2_Atom_Literal, lit), + "Hello", + sizeof("Hello")); // Assumes enough space +} +</pre> + +<p>or a Turtle string:</p> +<pre class="c-code"> +void set_to_turtle_string(LV2_Atom_Literal* lit, const char* ttl) { + lit->atom.type = map(expand("atom:Literal")); + lit->atom.size = 64; + lit->datatype = map("http://www.w3.org/2008/turtle#turtle"); + lit->lang = 0; + memcpy(LV2_ATOM_CONTENTS(LV2_Atom_Literal, lit), + ttl, + strlen(ttl) + 1); // Assumes enough space +} +</pre> +""" . + +atom:URID + a rdfs:Class ; + rdfs:subClassOf atom:Atom ; + rdfs:label "Integer ID mapped from a URI" ; + atom:cType "LV2_Atom_ID" ; + lv2:documentation """ +<p>An unsigned 32-bit integer mapped from a URI (e.g. with LV2_URID_Map).</p> +""" . + +atom:Vector + a rdfs:Class ; + rdfs:subClassOf atom:Atom ; + rdfs:label "Vector" ; + atom:cType "LV2_Atom_Vector" ; + lv2:documentation """ +<p>A homogeneous series of atom bodies with equivalent type and size.</p> + +<p>An LV2_Atom_Vector is a 32-bit <code>elem_count</code> and +<code>elem_type</code> followed by <code>elem_count</code> atom bodies of type +<code>elem_type</code>. The element type must be a fixed size atom:Atom type, +i.e. the size of each element is the vector's <code>size / +elem_count</code>.</p> + +<p>For example, an atom:Vector containing 42 elements of type atom:Float:</p> +<pre class="c-code"> +struct VectorOf42Floats { + uint32_t type; // map(expand("atom:Vector")) + uint32_t size; // sizeof(LV2_Atom_Vector) + (42 * sizeof(float); + uint32_t elem_count; // 42 + uint32_t elem_type; // map(expand("atom:Float")) + float elems[32]; +}; +</pre> + +<p>Note that it is possible to construct a valid Atom for each element +of the vector, even by an implementation which does not understand +<code>elem_type</code>.</p> +""" . + +atom:Tuple + a rdfs:Class ; + rdfs:subClassOf atom:Atom ; + rdfs:label "Tuple" ; + lv2:documentation """ +<p>A series of Atoms with varying <code>type</code> and <code>size</code>.</p> + +<p>The body of a Tuple is simply a series of complete atoms, each aligned to +64 bits.</p> +""" . + +atom:Property + a rdfs:Class ; + rdfs:subClassOf atom:Atom ; + rdfs:label "Property" ; + atom:cType "LV2_Atom_Property" ; + lv2:documentation """ +<p>A property of an atom:Object. An LV2_Atom_Property has a URID +<code>key</code> and <code>context</code>, and an Atom <code>value</code>. +This corresponds to an RDF Property, where the <q>key</q> is the <q>predicate</q> +and the <q>value</q> is the object.</p> + +<p>The <code>context</code> field can be used to specify a different context +for each property, where this is useful. Otherwise, it may be 0.</p> +""" . + +atom:Object + a rdfs:Class ; + rdfs:subClassOf atom:Atom ; + rdfs:label "Object" ; + atom:cType "LV2_Atom_Object" ; + lv2:documentation """ +<p>An <q>Object</q> is an atom with a set of properties. This corresponds to +an RDF Resource, and can be thought of as a dictionary with URID keys.</p> + +<p>An LV2_Atom_Object has a uint32_t <code>id</code> and uint32_t +<code>type</code>, followed by a series of atom:Property bodies (without +headers, i.e. LV2_Atom_Property_Body). The LV2_Atom_Object::type field is +semantically equivalent to a property with key rdf:type, but is included in the +structure to allow for fast dispatch.</p> + +<p>This is an abstract Atom type, an Object is always either a atom:Resource +or a atom:Blank.</p> +""" . + +atom:Resource + a rdfs:Class ; + rdfs:subClassOf atom:Object ; + rdfs:label "Resource" ; + atom:cType "LV2_Atom_Object" ; + lv2:documentation """ +<p>An atom:Object where the <code>id</code> field is a URID, i.e. an Object +with a URI.</p> +""" . + +atom:Blank + a rdfs:Class ; + rdfs:subClassOf atom:Object ; + rdfs:label "Blank" ; + atom:cType "LV2_Atom_Object" ; + lv2:documentation """ +<p>An atom:Object where the LV2_Atom_Object::id is a blank node ID (NOT a URI). +The ID of a Blank is valid only within the context the Blank appears in. For +ports this is the context of the associated run() call, i.e. all ports share +the same context so outputs can contain IDs that correspond to IDs of blanks in +the input.</p> """ . + +atom:Event + a rdfs:Class ; + rdfs:label "Event" ; + atom:cType "LV2_Atom_Event" ; + lv2:documentation """ +<p>An atom with a time stamp header prepended, typically an element of an +atom:Sequence. Note this is not an Atom type.</p> +""" . + +atom:Sequence + a rdfs:Class ; + rdfs:subClassOf atom:Atom ; + rdfs:label "Sequence" ; + atom:cType "LV2_Atom_Sequence" ; + lv2:documentation """ +<p>A sequence of atom:Event, i.e. a series of time-stamped Atoms.</p> +""" . + +atom:AtomPort + a rdfs:Class ; + rdfs:subClassOf lv2:Port ; + rdfs:label "Atom Port" ; + lv2:documentation """ +<p>A port which contains an lv2:Atom. Ports of this type will be connected to +a 64-bit aligned LV2_Atom immediately followed by <code>size</code> bytes of +data.</p> + +<p>This is an abstract port type with incomplete semantics which can not be +used directly as a port type. Atom ports should be either a atom:ValuePort or +a atom:MessagePort.</p> + +<p>Before calling a method on a plugin that writes to an AtomPort output, the +host MUST set the size of the Atom in that output to the amount of available +memory immediately following the Atom header. The plugin MUST write a valid +Atom to that port; leaving it untouched is illegal. If there is no reasonable +value to write to the port, the plugin MUST write null (the Atom with both +<code>type</code> and <code>size</code> 0).</p> +""" . + +atom:ValuePort + a rdfs:Class ; + rdfs:subClassOf atom:AtomPort ; + rdfs:label "Value Port" ; + lv2:documentation """ + +<p>An AtomPort that contains a persistent <em>value</em>. A <q>value</q> is +time-independent and may be used numerous times. A ValuePort is <q>pure</q> in +the sense that it may affect output but MUST NOT affect persistent plugin state +in any externally visible way.</p> + +<ul> +<li>If a plugin has fixed values for all inputs, all ValuePort outputs are also +fixed regardless of the number of times the plugin is run.</li> + +<li>If a plugin has fixed input values for all ports except a ValuePort, each +value of that port corresponds to a single set of values for all +ValuePort outputs.</li> + +<li>If the plugin saves state other than port values (e.g. using the <a +href="http://lv2plug.in/ns/ext/state">LV2 State</a> extension), changing only +the value of a ValuePort input MUST NOT change that state. In other words, +value port changes MUST NOT trigger a state change that requires a save.</li> +</ul> + +<p>Value ports are essentially purely functional ports: if a plugin has only +value ports, that plugin is purely functional. Hosts may elect to cache output +and avoid calling run() if the output is already known according to these +rules.</p> +""" . + +atom:MessagePort + a rdfs:Class ; + rdfs:subClassOf atom:AtomPort ; + rdfs:label "Message Port" ; + lv2:documentation """ +<p>An AtomPort that contains transient data which is <em>consumed</em> or +<em>sent</em>. The Atom contained in a MessagePort is time-dependent and only +valid for a single run invocation. Unlike a ValuePort, a MessagePort may be +used to manipulate internal plugin state.</p> + +<p>Intuitively, a MessagePort contains a <q>message</q> or <q>event</q> which +is reacted to <em>once</em> (not a <q>value</q> which is computed with any +number of times).</p> +""" . + +atom:bufferType + a rdf:Property ; + rdfs:domain atom:AtomPort ; + rdfs:label "buffer type" ; + lv2:documentation """ +<p>Indicates that an AtomPort may be connected to a certain Atom type. A port +MAY support several buffer types. The host MUST NOT connect a port to an Atom +with a type not explicitly listed with this property. The value of this +property MUST be a sub-class of atom:Atom. For example, an input port that is +connected directly to an LV2_Atom_Double value is described like so:</p> + +<pre class="turtle-code"> +<plugin> + lv2:port [ + a lv2:InputPort , atom:ValuePort ; + atom:bufferType atom:Double ; + ] . +</pre> + +<p>Note this property only indicates the atom types a port may be directly +connected to, it is not <q>recursive</q>. If a port can be connected to a +collection, use atom:supports to indicate which element types are understood. +If a port supports heterogeneous collections (collections that can contain +several types of elements at once), implementations MUST gracefully handle any +types that are present in the collection, even if those types are not +explicitly supported.</p> +""" . + +atom:supports + a rdf:Property ; + rdfs:label "supports" ; + lv2:documentation """ +<p>Indicates that a particular Atom type is supported.</p> + +<p>This property is defined loosely, it may be used to indicate that anything +<q>supports</q> an Atom type, wherever that may be useful. It applies +<q>recursively</q> where collections are involved.</p> + +<p>In particular, this property can be used to describe which event types are +supported by a port. For example, a port that receives MIDI events is +described like so:</p> + +<pre class="turtle-code"> +<plugin> + lv2:port [ + a lv2:InputPort , atom:MessagePort ; + atom:bufferType atom:Sequence ; + atom:supports midi:MidiEvent ; + ] . +</pre> +""" . diff --git a/lv2/lv2plug.in/ns/ext/atom/ext.pc.in b/lv2/lv2plug.in/ns/ext/atom/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/atom/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/atom/forge.h b/lv2/lv2plug.in/ns/ext/atom/forge.h new file mode 100644 index 0000000..2790778 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/atom/forge.h @@ -0,0 +1,445 @@ +/* + Copyright 2008-2012 David Robillard <http://drobilla.net> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +/** + @file forge.h An API for constructing LV2 atoms. + + This file provides a simple API which can be used to create complex nested + atoms by calling the provided functions to append atoms (or atom headers) in + the correct order. The size of the parent atom is automatically updated, + but the caller must handle this situation if atoms are more deeply nested. + + All output is written to a user-provided buffer. This entire API is + realtime safe and suitable for writing to output port buffers in the run + method. + + Note these functions are all static inline, do not take their address. + + This header is non-normative, it is provided for convenience. +*/ + +#ifndef LV2_ATOM_FORGE_H +#define LV2_ATOM_FORGE_H + +#include <assert.h> +#include <string.h> + +#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/urid/urid.h" + +#ifdef __cplusplus +extern "C" { +#else +# include <stdbool.h> +#endif + +/** + A "forge" for creating atoms by appending to a buffer. +*/ +typedef struct { + uint8_t* buf; + size_t offset; + size_t size; + + LV2_URID Bool; + LV2_URID Double; + LV2_URID Float; + LV2_URID Int32; + LV2_URID Int64; + LV2_URID Literal; + LV2_URID Object; + LV2_URID Property; + LV2_URID Sequence; + LV2_URID String; + LV2_URID Tuple; + LV2_URID URID; + LV2_URID Vector; +} LV2_Atom_Forge; + +/** Set the output buffer where @c forge will write atoms. */ +static inline void +lv2_atom_forge_set_buffer(LV2_Atom_Forge* forge, uint8_t* buf, size_t size) +{ + forge->buf = buf; + forge->size = size; + forge->offset = 0; +} + +/** + Initialise @c forge. + + URIs will be mapped using @c map and stored, a reference to @c map itself is + not held. +*/ +static inline void +lv2_atom_forge_init(LV2_Atom_Forge* forge, LV2_URID_Map* map) +{ + lv2_atom_forge_set_buffer(forge, NULL, 0); + forge->Bool = map->map(map->handle, LV2_ATOM_URI "#Bool"); + forge->Double = map->map(map->handle, LV2_ATOM_URI "#Double"); + forge->Float = map->map(map->handle, LV2_ATOM_URI "#Float"); + forge->Int32 = map->map(map->handle, LV2_ATOM_URI "#Int32"); + forge->Int64 = map->map(map->handle, LV2_ATOM_URI "#Int64"); + forge->Literal = map->map(map->handle, LV2_ATOM_URI "#Literal"); + forge->Object = map->map(map->handle, LV2_ATOM_URI "#Object"); + forge->Property = map->map(map->handle, LV2_ATOM_URI "#Property"); + forge->Sequence = map->map(map->handle, LV2_ATOM_URI "#Sequence"); + forge->String = map->map(map->handle, LV2_ATOM_URI "#String"); + forge->Tuple = map->map(map->handle, LV2_ATOM_URI "#Tuple"); + forge->URID = map->map(map->handle, LV2_ATOM_URI "#URID"); + forge->Vector = map->map(map->handle, LV2_ATOM_URI "#Vector"); +} + +/** + Reserve @c size bytes in the output buffer (used internally). + @return The start of the reserved memory, or NULL if out of space. +*/ +static inline uint8_t* +lv2_atom_forge_reserve(LV2_Atom_Forge* forge, + LV2_Atom* parent, + uint32_t size) +{ + uint8_t* const out = forge->buf + forge->offset; + const uint32_t padded_size = lv2_atom_pad_size(size); + if (forge->offset + padded_size > forge->size) { + return NULL; + } + if (parent) { + parent->size += padded_size; + } + forge->offset += padded_size; + return out; +} + +/** + Write the header of an atom:Atom. + + Space for the complete atom will be reserved, but uninitialised. +*/ +static inline LV2_Atom* +lv2_atom_forge_atom_head(LV2_Atom_Forge* forge, + LV2_Atom* parent, + uint32_t type, + uint32_t size) +{ + LV2_Atom* const out = (LV2_Atom*)lv2_atom_forge_reserve( + forge, parent, size); + if (out) { + out->type = type; + out->size = size - sizeof(LV2_Atom); + } + return out; +} + +/** Write an atom:Int32. */ +static inline LV2_Atom_Int32* +lv2_atom_forge_int32(LV2_Atom_Forge* forge, LV2_Atom* parent, int32_t val) +{ + LV2_Atom_Int32* out = (LV2_Atom_Int32*)lv2_atom_forge_atom_head( + forge, parent, forge->Int32, sizeof(LV2_Atom_Int32)); + if (out) { + out->value = val; + } + return out; +} + +/** Write an atom:Int64. */ +static inline LV2_Atom_Int64* +lv2_atom_forge_int64(LV2_Atom_Forge* forge, LV2_Atom* parent, int64_t val) +{ + LV2_Atom_Int64* out = (LV2_Atom_Int64*)lv2_atom_forge_atom_head( + forge, parent, forge->Int64, sizeof(LV2_Atom_Int64)); + if (out) { + out->value = val; + } + return out; +} + +/** Write an atom:Float. */ +static inline LV2_Atom_Float* +lv2_atom_forge_float(LV2_Atom_Forge* forge, LV2_Atom* parent, float val) +{ + LV2_Atom_Float* out = (LV2_Atom_Float*)lv2_atom_forge_atom_head( + forge, parent, forge->Float, sizeof(LV2_Atom_Float)); + if (out) { + out->value = val; + } + return out; +} + +/** Write an atom:Double. */ +static inline LV2_Atom_Double* +lv2_atom_forge_double(LV2_Atom_Forge* forge, LV2_Atom* parent, double val) +{ + LV2_Atom_Double* out = (LV2_Atom_Double*)lv2_atom_forge_atom_head( + forge, parent, forge->Double, sizeof(LV2_Atom_Double)); + if (out) { + out->value = val; + } + return out; +} + +/** Write an atom:Bool. */ +static inline LV2_Atom_Bool* +lv2_atom_forge_bool(LV2_Atom_Forge* forge, LV2_Atom* parent, bool val) +{ + LV2_Atom_Bool* out = (LV2_Atom_Bool*)lv2_atom_forge_atom_head( + forge, parent, forge->Bool, sizeof(LV2_Atom_Bool)); + if (out) { + out->value = val ? 1 : 0; + } + return out; +} + +/** Write an atom:URID. */ +static inline LV2_Atom_URID* +lv2_atom_forge_urid(LV2_Atom_Forge* forge, LV2_Atom* parent, LV2_URID id) +{ + LV2_Atom_URID* out = (LV2_Atom_URID*)lv2_atom_forge_reserve( + forge, parent, sizeof(LV2_Atom_URID)); + if (out) { + out->atom.type = forge->URID; + out->atom.size = sizeof(uint32_t); + out->id = id; + } + return out; +} + +/** Write an atom:String. */ +static inline LV2_Atom_String* +lv2_atom_forge_string(LV2_Atom_Forge* forge, + LV2_Atom* parent, + const uint8_t* str, + size_t len) +{ + LV2_Atom_String* out = (LV2_Atom_String*)lv2_atom_forge_reserve( + forge, parent, sizeof(LV2_Atom_String) + len + 1); + if (out) { + out->atom.type = forge->String; + out->atom.size = len + 1; + assert(LV2_ATOM_CONTENTS(LV2_Atom_String, out) == LV2_ATOM_BODY(out)); + uint8_t* buf = LV2_ATOM_CONTENTS(LV2_Atom_String, out); + memcpy(buf, str, len); + buf[len] = '\0'; + } + return out; +} + +/** Write an atom:Literal. */ +static inline LV2_Atom_Literal* +lv2_atom_forge_literal(LV2_Atom_Forge* forge, + LV2_Atom* parent, + const uint8_t* str, + size_t len, + uint32_t datatype, + uint32_t lang) +{ + LV2_Atom_Literal* out = (LV2_Atom_Literal*)lv2_atom_forge_reserve( + forge, parent, sizeof(LV2_Atom_Literal) + len + 1); + if (out) { + out->atom.type = forge->Literal; + out->atom.size = sizeof(LV2_Atom_Literal_Head) + len + 1; + out->literal.datatype = datatype; + out->literal.lang = lang; + uint8_t* buf = LV2_ATOM_CONTENTS(LV2_Atom_Literal, out); + memcpy(buf, str, len); + buf[len] = '\0'; + } + return out; +} + +/** Write an atom:Vector header and reserve space for the body. */ +static inline LV2_Atom_Vector* +lv2_atom_forge_reserve_vector(LV2_Atom_Forge* forge, + LV2_Atom* parent, + uint32_t elem_count, + uint32_t elem_type, + uint32_t elem_size) +{ + const size_t size = sizeof(LV2_Atom_Vector) + (elem_size * elem_count); + LV2_Atom_Vector* out = (LV2_Atom_Vector*)lv2_atom_forge_reserve( + forge, parent, size); + if (out) { + out->atom.type = forge->Vector; + out->atom.size = size - sizeof(LV2_Atom); + out->elem_count = elem_count; + out->elem_type = elem_type; + } + return out; +} + +/** Write an atom:Vector. */ +static inline LV2_Atom_Vector* +lv2_atom_forge_vector(LV2_Atom_Forge* forge, + LV2_Atom* parent, + uint32_t elem_count, + uint32_t elem_type, + uint32_t elem_size, + void* elems) +{ + LV2_Atom_Vector* out = lv2_atom_forge_reserve_vector( + forge, parent, elem_count, elem_type, elem_size); + if (out) { + uint8_t* buf = LV2_ATOM_CONTENTS(LV2_Atom_Vector, out); + memcpy(buf, elems, elem_size * elem_count); + } + return out; +} + +/** + Write the header of an atom:Tuple. + + To complete the tuple, write a sequence of atoms, always passing the + returned tuple as the @c parent parameter (or otherwise ensuring the size is + updated correctly). + + For example: + @code + // Write tuple (1, 2.0) + LV2_Atom* tup = (LV2_Atom*)lv2_atom_forge_tuple(forge, NULL); + lv2_atom_forge_int32(forge, tup, 1); + lv2_atom_forge_float(forge, tup, 2.0); + @endcode +*/ +static inline LV2_Atom_Tuple* +lv2_atom_forge_tuple(LV2_Atom_Forge* forge, + LV2_Atom* parent) +{ + return (LV2_Atom_Tuple*)lv2_atom_forge_atom_head( + forge, parent, forge->Tuple, sizeof(LV2_Atom)); +} + +/** + Write the header of an atom:Object. + + To complete the object, write a sequence of properties, always passing the + object as the @c parent parameter (or otherwise ensuring the size is updated + correctly). + + For example: + @code + LV2_URID eg_Cat = map("http://example.org/Cat"); + LV2_URID eg_name = map("http://example.org/name"); + + // Write object header + LV2_Atom* obj = (LV2_Atom*)lv2_atom_forge_object(forge, NULL, 0, eg_Cat); + + // Write property: eg:name = "Hobbes" + lv2_atom_forge_property_head(forge, obj, eg_name, 0); + lv2_atom_forge_string(forge, obj, "Hobbes", strlen("Hobbes")); + @endcode +*/ +static inline LV2_Atom_Object* +lv2_atom_forge_object(LV2_Atom_Forge* forge, + LV2_Atom* parent, + LV2_URID id, + LV2_URID type) +{ + LV2_Atom_Object* out = (LV2_Atom_Object*)lv2_atom_forge_reserve( + forge, parent, sizeof(LV2_Atom_Object)); + if (out) { + out->atom.type = forge->Object; + out->atom.size = sizeof(LV2_Atom_Object) - sizeof(LV2_Atom); + out->id = id; + out->type = type; + } + return out; +} + +/** + Write the header for a property body (likely in an Object). + See lv2_atom_forge_object() documentation for an example. +*/ +static inline LV2_Atom_Property_Body* +lv2_atom_forge_property_head(LV2_Atom_Forge* forge, + LV2_Atom* parent, + LV2_URID key, + LV2_URID context) +{ + LV2_Atom_Property_Body* out = (LV2_Atom_Property_Body*) + lv2_atom_forge_reserve(forge, parent, 2 * sizeof(uint32_t)); + if (out) { + out->key = key; + out->context = context; + } + return out; +} + +/** + Write the header for a Sequence. + The size of the returned sequence will be 0, so passing it as the parent + parameter to other forge methods will do the right thing. +*/ +static inline LV2_Atom_Sequence* +lv2_atom_forge_sequence_head(LV2_Atom_Forge* forge, + LV2_Atom* parent, + uint32_t capacity) +{ + LV2_Atom_Sequence* out = (LV2_Atom_Sequence*) + lv2_atom_forge_reserve(forge, parent, sizeof(LV2_Atom_Sequence)); + if (out) { + out->atom.type = forge->Sequence; + out->atom.size = sizeof(LV2_Atom_Sequence) - sizeof(LV2_Atom); + out->capacity = capacity; + out->pad = 0; + } + return out; +} + +/** + Write the time stamp header of an Event (in a Sequence) in audio frames. + After this, call the appropriate forge method(s) to write the body, passing + the same @c parent parameter. Note the returned LV2_Event is NOT an Atom. +*/ +static inline LV2_Atom_Event* +lv2_atom_forge_audio_time(LV2_Atom_Forge* forge, + LV2_Atom* parent, + uint32_t frames, + uint32_t subframes) +{ + LV2_Atom_Event* out = (LV2_Atom_Event*) + lv2_atom_forge_reserve(forge, parent, 2 * sizeof(uint32_t)); + if (out) { + out->time.audio.frames = frames; + out->time.audio.subframes = subframes; + } + return out; +} + +/** + Write the time stamp header of an Event (in a Sequence) in beats. + After this, call the appropriate forge method(s) to write the body, passing + the same @c parent parameter. Note the returned LV2_Event is NOT an Atom. +*/ +static inline LV2_Atom_Event* +lv2_atom_forge_beat_time(LV2_Atom_Forge* forge, + LV2_Atom* parent, + double beats) +{ + LV2_Atom_Event* out = (LV2_Atom_Event*) + lv2_atom_forge_reserve(forge, parent, sizeof(double)); + if (out) { + out->time.beats = beats; + } + return out; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV2_ATOM_FORGE_H */ diff --git a/lv2/lv2plug.in/ns/ext/atom/manifest.ttl b/lv2/lv2plug.in/ns/ext/atom/manifest.ttl new file mode 100644 index 0000000..37f0f58 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/atom/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/atom> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 4 ; + rdfs:seeAlso <atom.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/atom/waf b/lv2/lv2plug.in/ns/ext/atom/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/atom/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/atom/wscript b/lv2/lv2plug.in/ns/ext/atom/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/atom/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/contexts/contexts.h b/lv2/lv2plug.in/ns/ext/contexts/contexts.h new file mode 100644 index 0000000..f49b474 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/contexts/contexts.h @@ -0,0 +1,82 @@ +/* LV2 Contexts Extension + * Copyright (C) 2007-2009 David Robillard <http://drobilla.net> + * + * This header is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This header is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** @file + * C header for the LV2 Contexts extension + * <http://lv2plug.in/ns/ext/contexts>. + */ + +#ifndef LV2_CONTEXTS_H +#define LV2_CONTEXTS_H + +#include <stdint.h> + +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" + +#define LV2_CONTEXTS_URI "http://lv2plug.in/ns/ext/contexts" + +static inline void +lv2_contexts_set_port_valid(void* flags, uint32_t index) { + ((uint8_t*)flags)[index / 8] |= 1 << (index % 8); +} + +static inline void +lv2_contexts_unset_port_valid(void* flags, uint32_t index) { + ((uint8_t*)flags)[index / 8] &= ~(1 << (index % 8)); +} + +static inline int +lv2_contexts_port_is_valid(const void* flags, uint32_t index) { + return (((uint8_t*)flags)[index / 8] & (1 << (index % 8))) != 0; +} + +typedef struct { + + /** The message run function. This is called once to process a set of + * inputs and produce a set of outputs. + * + * Before calling the host MUST set valid_inputs such that the bit + * corresponding to each input port is 1 iff data is present. The plugin + * MUST only inspect bits corresponding to ports in the message thread. + * + * Similarly, before returning the plugin MUST set valid_outputs such that + * the bit corresponding to each output port of the message context is 1 + * iff the value at that port has changed. + * The plugin must return 1 if outputs have been written, 0 otherwise. + */ + uint32_t (*run)(LV2_Handle instance, + const void* valid_inputs, + void* valid_outputs); + +} LV2_Contexts_MessageContext; + +typedef void* LV2_Contexts_Request_Run_Data; + +typedef struct { + + /** Pointer to opaque host data (to be passed to request_run) */ + LV2_Contexts_Request_Run_Data data; + + /** Request the host execute the context with the given URI */ + void (*request_run)(LV2_Contexts_Request_Run_Data host_handle, + uint32_t context_uri); + +} LV2_Contexts_Request_Run_Feature; + +#endif /* LV2_CONTEXTS_H */ + diff --git a/lv2/lv2plug.in/ns/ext/contexts/contexts.ttl b/lv2/lv2plug.in/ns/ext/contexts/contexts.ttl new file mode 100644 index 0000000..c56c649 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/contexts/contexts.ttl @@ -0,0 +1,134 @@ +# LV2 Contexts Extension +# +# Allows for an LV2 plugin to have several independent contexts, each with its +# own run callback and associated ports. +# +# Copyright (C) 2007-2010 David Robillard +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +@prefix ctx: <http://lv2plug.in/ns/ext/contexts#> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . + +<http://lv2plug.in/ns/ext/contexts> + a lv2:Specification , lv2:Feature ; + doap:name "LV2 Contexts" ; + doap:shortdesc "Support for plugins with several execution contexts." ; + lv2:documentation """ +<p>An extension for LV2 plugins which have several execution contexts.</p> + +<p>Contexts allow plugins to run tasks and/or process input/output in +multiple threads. Contexts can be used to add non-realtime functionality +to a plugin while still keeping the audio run() method realtime safe.</p> + +<p>A context is an LV2 feature, so the usual LV2 feature mechanism is used +to determine whether a plugin has a given context, and whether or not it is +mandatory.</p> + +<p>Unless otherwise stated, each context (defined by some URI) adds a new +threading class similar to the Audio class defined by LV2. Each context has a +run callback and a connect_port callback both in the same class (i.e. can't be +called concurrently), but may be called concurrently with functions for other +contexts (excluding the Instantiation class). Context properties such as +ctx:hardRTCapable apply to both functions. +The host MUST only call the correct connect_port function associated with the +context for that port, i.e. it is an error to use the main LV2 connect_port +function on a port with a context other than the main LV2 run function.</p> +""" . + + +########################## +## Context Base Classes ## +########################## + +ctx:Context a rdfs:Class ; + rdfs:label "LV2 Context" ; + lv2:documentation """ +<p>A potentially concurrent context (callback) on a plugin.</p> + +<p>Ports are always associated with a context. If a port has no explicit context +property, then its context is ctx:audioContext (the default LV2 run() context).</p> + +<p>A plugin indicates support for a context by supporting an LV2 Feature with +that context's URI. If a plugin optionally supports a context (e.g. +<code><plugin> lv2:optionalFeature ctx:idleContext .</code>), then +all ports associated with that context MUST be lv2:connectionOptional. Thus, +hosts that do not support contexts will connect such ports to NULL and the +plugin can run with only a standard LV2 run() context.</p> + +<p>Any plugin that supports any context (optionally or mandatorily) MUST adhere +to the following additional threading rules for LV2_Descriptor.connect_port:</p> +<ul> +<li>connect_port MUST only be called for a given port from the context +associated with that port</li> +<li>connect_port MAY be called concurrently for ports with different +contexts (but MUST NOT be called concurrently for multiple ports in the +same context)</li> +</ul> +<p>Note this implies that any shared data access in connect_port may be +accessed concurrently. The plugin is responsible for any synchronisation +or locking necessary to make this possible.</p> +""" . + +ctx:audioContext a ctx:Context , lv2:Feature ; + rdfs:comment """The context of LV2_Descriptor.run().""" . + +ctx:messageContext a ctx:Context , lv2:Feature ; + lv2:documentation """ +<p>A non-realtime context for plugin control via message passing. This context +has a run method which takes a bitset of flags for parameters specifying which +input and output ports are valid before and after the run method has executed, +respectively (see <code>LV2_Contexts_MessageContext</code>).</p> +""" . + +ctx:idleContext a ctx:Context , lv2:Feature ; + rdfs:comment """ +A non-realtime idle context, periodically run by the host roughly every second. +This context never has any ports. +""" . + +ctx:requestRunFeature a lv2:Feature ; + lv2:documentation """ +<p>A feature allowing the plugin to request the execution of a particular +context at an arbitrary time. To support this feature, the host MUST pass an +LV2_Feature to <code>instantiate</code> with <code>data</code> pointing to a +LV2_Contexts_Request_Run_Feature.</p> + +<p>The plugin MAY call <code>request_run</code> with the given +<code>data</code> from any non-realtime context to demand soon-as-possible execution +of the specified context.</p> +""" . + +ctx:context a rdf:Property ; + rdfs:domain lv2:Port ; + rdfs:range ctx:Context ; + rdfs:label "is used in context" ; + rdfs:comment """ +The context a particular port is associated with; the port will only be +connected/read/written by that context. + +If no context is specified, the port is considered part of the default LV2 +audio context.""" . + + diff --git a/lv2/lv2plug.in/ns/ext/contexts/ext.pc.in b/lv2/lv2plug.in/ns/ext/contexts/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/contexts/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/contexts/manifest.ttl b/lv2/lv2plug.in/ns/ext/contexts/manifest.ttl new file mode 100644 index 0000000..d2cc036 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/contexts/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/contexts> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 1 ; + rdfs:seeAlso <contexts.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/contexts/test.c b/lv2/lv2plug.in/ns/ext/contexts/test.c new file mode 100644 index 0000000..ca41a10 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/contexts/test.c @@ -0,0 +1,67 @@ +#include <stdio.h> +#include <stdint.h> +#include <stdbool.h> +#include <limits.h> +#include <assert.h> +#include <unistd.h> +#include "contexts.h" + +#define TEST_ASSERT(check) do {\ + if (!(check)) {\ + fprintf(stderr, "Failure at line %d: %s\n", __LINE__, #check);\ + assert(false);\ + _exit(1);\ + }\ +} while (0) + +#define NUM_PORTS 64 + +void +print_flags(void* flags) +{ + for (int i = NUM_PORTS; i >= 0; --i) + printf((lv2_contexts_port_is_valid(flags, i)) ? "1" : "0"); + printf("\n"); +} + + +int +main() +{ + uint64_t flags = 0; + print_flags(&flags); + + lv2_contexts_set_port_valid(&flags, 16); + print_flags(&flags); + for (int i = 0; i < NUM_PORTS; ++i) { + if (i == 16) { + TEST_ASSERT(lv2_contexts_port_is_valid(&flags, i)); + } else { + TEST_ASSERT(!lv2_contexts_port_is_valid(&flags, i)); + } + } + + lv2_contexts_set_port_valid(&flags, 46); + lv2_contexts_set_port_valid(&flags, 0); + print_flags(&flags); + for (int i = 0; i < NUM_PORTS; ++i) { + if (i == 0 || i == 16 || i == 46) { + TEST_ASSERT(lv2_contexts_port_is_valid(&flags, i)); + } else { + TEST_ASSERT(!lv2_contexts_port_is_valid(&flags, i)); + } + } + + lv2_contexts_unset_port_valid(&flags, 16); + print_flags(&flags); + for (int i = 0; i < NUM_PORTS; ++i) { + if (i == 0 || i == 46) { + TEST_ASSERT(lv2_contexts_port_is_valid(&flags, i)); + } else { + TEST_ASSERT(!lv2_contexts_port_is_valid(&flags, i)); + } + } + + return 0; +} + diff --git a/lv2/lv2plug.in/ns/ext/contexts/waf b/lv2/lv2plug.in/ns/ext/contexts/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/contexts/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/contexts/wscript b/lv2/lv2plug.in/ns/ext/contexts/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/contexts/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/cv-port/cv-port.ttl b/lv2/lv2plug.in/ns/ext/cv-port/cv-port.ttl new file mode 100644 index 0000000..09016d6 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/cv-port/cv-port.ttl @@ -0,0 +1,77 @@ +# LV2 CV Port Extension +# Copyright 2011 David Robillard <http://drobilla.net> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix cv: <http://lv2plug.in/ns/ext/cv-port#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/cv-port> + a lv2:Specification ; + doap:license <http://opensource.org/licenses/isc> ; + doap:name "LV2 CV Port" ; + doap:shortdesc "Control Voltage ports for LV2 plugins." ; + doap:maintainer [ + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + rdfs:seeAlso <http://drobilla.net/drobilla.rdf> + ] ; + lv2:documentation """ +<p>This extension defines Control Voltage (CV) ports, which are audio-rate +control ports like those used on classical voltage-controlled synthesizers. +These ports serve as control ports like <a +href="http://lv2plug.in/ns/lv2core#ControlPort">lv2:ControlPort</a> but can +also be used for audio-rate modulation of control signals. This enables many +types of processing and synthesis which are not possible with a lower control +rate.</p> +""" . + +cv:CVPort + a rdfs:Class ; + rdfs:label "CV Port" ; + rdfs:subClassOf lv2:Port ; + lv2:documentation """ + +<p>Ports of this type have identical semantics to <a +href="http://lv2plug.in/ns/lv2core#AudioPort">lv2:AudioPort</a> in terms of +buffer format and connection/input/output logistics. However, rather than the +buffer representing audio, the buffer represents audio-rate control data. A +CVPort SHOULD have the same properties a <a +href="http://lv2plug.in/ns/lv2core#ControlPort">lv2:ControlPort</a> typically +has to describe appropriate control values (e.g. <a +href="http://lv2plug.in/ns/lv2core#minimum">lv2:minimum</a>, <a +href="http://lv2plug.in/ns/lv2core#maximum">lv2:maximum</a>, <a +href="http://lv2plug.in/ns/lv2core#default">lv2:default</a>)</p> + +<p>Hosts SHOULD take care to prevent data from a CVPort port from being used as +audio except in cases where this is known to be safe.</p> + +<p>Example:</p> +<pre class="turtle-code"> +<http://example.org/some-plugin> + lv2:port [ + a cv:CVPort, lv2:InputPort ; + lv2:index 0 ; + lv2:minimum -1.0 ; + lv2:maximum 1.0 ; + lv2:default 0.0 ; + lv2:symbol "modulation" ; + lv2:name "Modulation" ; + ] . +</pre> +""" . diff --git a/lv2/lv2plug.in/ns/ext/cv-port/ext.pc.in b/lv2/lv2plug.in/ns/ext/cv-port/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/cv-port/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/cv-port/manifest.ttl b/lv2/lv2plug.in/ns/ext/cv-port/manifest.ttl new file mode 100644 index 0000000..e5fa145 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/cv-port/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/cv-port> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 1 ; + rdfs:seeAlso <cv-port.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/cv-port/waf b/lv2/lv2plug.in/ns/ext/cv-port/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/cv-port/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/cv-port/wscript b/lv2/lv2plug.in/ns/ext/cv-port/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/cv-port/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/data-access/data-access.h b/lv2/lv2plug.in/ns/ext/data-access/data-access.h new file mode 100644 index 0000000..fac6974 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/data-access/data-access.h @@ -0,0 +1,56 @@ +/* + LV2 Data Access Extension + Copyright 2008-2011 David Robillard <http://drobilla.net> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +/** + @file data-access.h + C header for the LV2 Extension Data extension + <http://lv2plug.in/ns/ext/data-access>. + + This extension defines a method for (e.g.) plugin UIs to have (possibly + marshalled) access to the extension_data function on a plugin instance. +*/ + +#ifndef LV2_DATA_ACCESS_H +#define LV2_DATA_ACCESS_H + +#define LV2_DATA_ACCESS_URI "http://lv2plug.in/ns/ext/data-access" + +/** + The data field of the LV2_Feature for this extension. + + To support this feature the host must pass an LV2_Feature struct to the + instantiate method with URI "http://lv2plug.in/ns/ext/data-access" + and data pointed to an instance of this struct. +*/ +typedef struct { + /** + A pointer to a method the UI can call to get data (of a type specified + by some other extension) from the plugin. + + This call never is never guaranteed to return anything, UIs should + degrade gracefully if direct access to the plugin data is not possible + (in which case this function will return NULL). + + This is for access to large data that can only possibly work if the UI + and plugin are running in the same process. For all other things, use + the normal LV2 UI communication system. + */ + const void* (*data_access)(const char* uri); + +} LV2_Extension_Data_Feature; + +#endif /* LV2_DATA_ACCESS_H */ diff --git a/lv2/lv2plug.in/ns/ext/data-access/data-access.ttl b/lv2/lv2plug.in/ns/ext/data-access/data-access.ttl new file mode 100644 index 0000000..6b0d817 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/data-access/data-access.ttl @@ -0,0 +1,82 @@ +# LV2 Data Access Extension +# Copyright 2008-2011 David Robillard <d@drobilla.net> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix da: <http://lv2plug.in/ns/ext/data-access#> . +@prefix dcs: <http://ontologi.es/doap-changeset#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix lv2ev: <http://lv2plug.in/ns/ext/event#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://drobilla.net/drobilla#me> + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + foaf:mbox <mailto:d@drobilla.net> ; + rdfs:seeAlso <http://drobilla.net/drobilla> . + +<http://lv2plug.in/ns/ext/data-access> + a lv2:Specification , + doap:Project ; + doap:license <http://opensource.org/licenses/isc> ; + doap:name "LV2 Data Access" ; + doap:shortdesc "Provides access to LV2_Descriptor::extension_data()." ; + doap:developer <http://drobilla.net/drobilla#me> ; + doap:release [ + doap:revision "1.4" ; + doap:created "2011-11-21" ; + doap:file-release <http://lv2plug.in/spec/lv2-data-access-1.4.tar.bz2> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Update packaging." + ] , [ + rdfs:label "Improve documentation." + ] + ] + ] , [ + doap:revision "1.2" ; + doap:created "2011-05-26" ; + doap:file-release <http://lv2plug.in/spec/lv2-data-access-1.2.tar.bz2> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Add build system for installation." + ] , [ + rdfs:label "Switch to ISC license." + ] + ] + ] , [ + doap:revision "1.0" ; + doap:created "2010-10-04" ; + doap:file-release <http://lv2plug.in/spec/lv2-data-access-1.0.tar.gz> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Initial release." + ] + ] + ] ; + lv2:documentation """ +<p>This extension defines a feature, LV2_Extension_Data_Feature, which provides +access to LV2_Descriptor::extension_data() for plugin UIs or other potentially +remote users of a plugin.</p> + +<p>To support this feature the host must pass an LV2_Feature struct to the +instantiate method with URI LV2_DATA_ACCESS_URI and data pointed to an instance +of LV2_Extension_Data_Feature.</p> +""" .
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/data-access/ext.pc.in b/lv2/lv2plug.in/ns/ext/data-access/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/data-access/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/data-access/manifest.ttl b/lv2/lv2plug.in/ns/ext/data-access/manifest.ttl new file mode 100644 index 0000000..f7ccd9d --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/data-access/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/data-access> + a lv2:Specification ; + lv2:minorVersion 1 ; + lv2:microVersion 4 ; + rdfs:seeAlso <data-access.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/data-access/waf b/lv2/lv2plug.in/ns/ext/data-access/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/data-access/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/data-access/wscript b/lv2/lv2plug.in/ns/ext/data-access/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/data-access/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/dynmanifest/dynmanifest.h b/lv2/lv2plug.in/ns/ext/dynmanifest/dynmanifest.h new file mode 100644 index 0000000..51908b7 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/dynmanifest/dynmanifest.h @@ -0,0 +1,144 @@ +/* + Dynamic manifest specification for LV2 + Copyright 2008-2011 Stefano D'Angelo <zanga.mail@gmail.com> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +/** + @file dynmanifest.h + C header for the LV2 Dynamic Manifest extension + <http://lv2plug.in/ns/ext/dynmanifest>. + Revision: 1.2 +*/ + +#ifndef LV2_DYN_MANIFEST_H_INCLUDED +#define LV2_DYN_MANIFEST_H_INCLUDED + +#include <stdio.h> + +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" + +#define LV2_DYN_MANIFEST_URI "http://lv2plug.in/ns/ext/dynmanifest" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + Dynamic manifest generator handle. + + This handle indicates a particular status of a dynamic manifest generator. + The host MUST NOT attempt to interpret it and, unlikely LV2_Handle, it is + NOT even valid to compare this to NULL. The dynamic manifest generator MAY + use it to reference internal data. +*/ +typedef void * LV2_Dyn_Manifest_Handle; + +/** + Generate the dynamic manifest. + + @param handle Pointer to an uninitialized dynamic manifest generator handle. + + @param features NULL terminated array of LV2_Feature structs which represent + the features the host supports. The dynamic manifest generator may refuse to + (re)generate the dynamic manifest if required features are not found here + (however hosts SHOULD NOT use this as a discovery mechanism, instead of + reading the static manifest file). This array must always exist; if a host + has no features, it MUST pass a single element array containing NULL. + + @return 0 on success, otherwise a non-zero error code. The host SHOULD + evaluate the result of the operation by examining the returned value and + MUST NOT try to interpret the value of handle. +*/ +int lv2_dyn_manifest_open(LV2_Dyn_Manifest_Handle * handle, + const LV2_Feature *const * features); + +/** + Fetch a "list" of subject URIs described in the dynamic manifest. + + The dynamic manifest generator has to fill the resource only with the needed + triples to make the host aware of the "objects" it wants to expose. For + example, if the plugin library exposes a regular LV2 plugin, it should + output only a triple like the following: + + <http://www.example.com/plugin/uri> a lv2:Plugin . + + The objects that are elegible for exposure are those that would need to be + represented by a subject node in a static manifest. + + @param handle Dynamic manifest generator handle. + + @param fp FILE * identifying the resource the host has to set up for the + dynamic manifest generator. The host MUST pass a writable, empty resource to + this function, and the dynamic manifest generator MUST ONLY perform write + operations on it at the end of the stream (e.g., using only fprintf(), + fwrite() and similar). + + @return 0 on success, otherwise a non-zero error code. +*/ +int lv2_dyn_manifest_get_subjects(LV2_Dyn_Manifest_Handle handle, + FILE * fp); + +/** + Function that fetches data related to a specific URI. + + The dynamic manifest generator has to fill the resource with data related to + object represented by the given URI. For example, if the library exposes a + regular LV2 plugin whose URI, as retrieved by the host using + lv2_dyn_manifest_get_subjects() is http://www.example.com/plugin/uri, it + should output something like: + + <pre> + <http://www.example.com/plugin/uri> + a lv2:Plugin ; + doap:name "My Plugin" ; + lv2:binary <mylib.so> ; + etc:etc "..." . + </pre> + + @param handle Dynamic manifest generator handle. + + @param fp FILE * identifying the resource the host has to set up for the + dynamic manifest generator. The host MUST pass a writable resource to this + function, and the dynamic manifest generator MUST ONLY perform write + operations on it at the current position of the stream (e.g. using only + fprintf(), fwrite() and similar). + + @param uri URI to get data about (in the "plain" form, i.e., absolute URI + without Turtle prefixes). + + @return 0 on success, otherwise a non-zero error code. +*/ +int lv2_dyn_manifest_get_data(LV2_Dyn_Manifest_Handle handle, + FILE * fp, + const char * uri); + +/** + Function that ends the operations on the dynamic manifest generator. + + This function SHOULD be used by the dynamic manifest generator to perform + cleanup operations, etc. + + Once this function is called, referring to handle will cause undefined + behavior. + + @param handle Dynamic manifest generator handle. +*/ +void lv2_dyn_manifest_close(LV2_Dyn_Manifest_Handle handle); + +#ifdef __cplusplus +} +#endif + +#endif /* LV2_DYN_MANIFEST_H_INCLUDED */ diff --git a/lv2/lv2plug.in/ns/ext/dynmanifest/dynmanifest.ttl b/lv2/lv2plug.in/ns/ext/dynmanifest/dynmanifest.ttl new file mode 100644 index 0000000..2054a17 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/dynmanifest/dynmanifest.ttl @@ -0,0 +1,107 @@ +# LV2 Dynamic Manifest Extension +# Copyright 2008-2011 Stefano D'Angelo <zanga.mail@gmail.com> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix dman: <http://lv2plug.in/ns/ext/dynmanifest#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://lv2plug.in/ns/ext/dynmanifest> + a lv2:Specification ; + lv2:documentation """ +<p>The LV2 API, on its own, cannot be used to write plugin libraries where data +is dynamically generated at runtime (e.g. API wrappers), since LV2 requires +needed information to be provided in one or more static data (RDF) files. This +API addresses this limitation by extending the LV2 API.</p> + +<p>To detect that a plugin library implements a dynamic manifest generator, +the host checks its static manifest for a description like:</p> + +<pre class="turtle-code"> +<http://example.org/my-dynamic-manifest> + a dman:DynManifest ; + lv2:binary <mydynmanifest.so> . +</pre> + +<p>To load the data, the host loads the library +(e.g. <code>mydynmanifest.so</code>) as usual and fetches the dynamic Turtle +data from it using this API.</p> + +<p>The host is allowed to request regeneration of the dynamic manifest multiple +times, and the plugin library is expected to provide updated data if/when +possible. All data and references provided via this API before the last +regeneration of the dynamic manifest is to be considered invalid by the host, +including plugin descriptors whose URIs were discovered using this API.</p> + +<h3>Accessing Data</h3> + +<p>Whenever a host wants to access data using this API, it could:</p> + +<ol> +<li>Call lv2_dyn_manifest_open().</li> +<li>Create a FILE for functions to write data to (e.g. using tmpfile()).</li> +<li>Get a <q>list</q> of exposed subject URIs using + lv2_dyn_manifest_get_subjects().</li> +<li>Call lv2_dyn_manifest_get_data() for each URI of interest to + get the data related to that URI (which can be written to any FILE).</li> +<li>Call lv2_dyn_manifest_close().</li> +<li>Parse the content of the FILE(s).</li> +<li>Free/delete/unlink the FILE(s).</li> +</ol> + +<p>Each call to the above mentioned dynamic manifest functions MUST write a +complete, valid Turtle document (including all needed prefix definitions) to +the output FILE.</p> + +<p>Each call to lv2_dyn_manifest_open() causes the (re)generation of the +dynamic manifest data, and invalidates all data fetched before the call.</p> + +<p>In case the plugin library uses this same API to access other dynamic +manifests, it MUST implement some mechanism to avoid potentially endless loops +(such as A loads B, B loads A, etc.) and, in case such a loop is detected, the +operation MUST fail. For this purpose, use of a static boolean flag is +suggested.</p> + +<h3>Threading Rules</h3> + +<p>All of the functions defined by this specification belong to the Discovery +class.</p> +""" . + +dman:DynManifest + a rdfs:Class ; + rdfs:subClassOf lv2:Resource ; + rdfs:label "Dynamic manifest generator" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty lv2:binary ; + owl:minCardinality 1 ; + rdfs:comment """ +A DynManifest MUST have at least 1 lv2:binary, which MUST implement all the +functions defined in dynmanifest.h. +""" + ] ; + rdfs:comment """ +The class which represents a dynamic manifest generator. + +There MUST NOT be any instances of dman:DynManifest in the generated manifest. + +All relative URIs in the generated data MUST be relative to the base path +that would be used to parse a normal LV2 manifest (the bundle path). +""" . diff --git a/lv2/lv2plug.in/ns/ext/dynmanifest/ext.pc.in b/lv2/lv2plug.in/ns/ext/dynmanifest/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/dynmanifest/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/dynmanifest/lv2-dynmanifest.doap.ttl b/lv2/lv2plug.in/ns/ext/dynmanifest/lv2-dynmanifest.doap.ttl new file mode 100644 index 0000000..6c4d985 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/dynmanifest/lv2-dynmanifest.doap.ttl @@ -0,0 +1,43 @@ +@prefix dcs: <http://ontologi.es/doap-changeset#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://drobilla.net/drobilla#me> + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + foaf:mbox <mailto:d@drobilla.net> ; + rdfs:seeAlso <http://drobilla.net/drobilla> . + +<http://lv2plug.in/ns/ext/dynmanifest> + a doap:Project ; + doap:license <http://opensource.org/licenses/isc> ; + doap:name "LV2 Dynamic Manifest" ; + doap:homepage <http://naspro.atheme.org> ; + doap:created "2009-06-13" ; + doap:shortdesc "Support for dynamic data generation." ; + doap:programming-language "C" ; + doap:developer [ + a foaf:Person ; + foaf:name "Stefano D'Angelo" + ] ; + doap:release [ + doap:revision "1.2" ; + doap:created "2011-11-21" ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Improve documentation." + ] + ] + ] , [ + doap:revision "1.0" ; + doap:created "2010-04-10" ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Initial release." + ] + ] + ] . diff --git a/lv2/lv2plug.in/ns/ext/dynmanifest/manifest.ttl b/lv2/lv2plug.in/ns/ext/dynmanifest/manifest.ttl new file mode 100644 index 0000000..cc5a83d --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/dynmanifest/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/dynmanifest> + a lv2:Specification ; + lv2:minorVersion 1 ; + lv2:microVersion 2 ; + rdfs:seeAlso <dynmanifest.ttl> , + <lv2-dynmanifest.doap.ttl> . diff --git a/lv2/lv2plug.in/ns/ext/dynmanifest/waf b/lv2/lv2plug.in/ns/ext/dynmanifest/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/dynmanifest/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/dynmanifest/wscript b/lv2/lv2plug.in/ns/ext/dynmanifest/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/dynmanifest/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/event/event-helpers.h b/lv2/lv2plug.in/ns/ext/event/event-helpers.h new file mode 100644 index 0000000..75ba14b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/event/event-helpers.h @@ -0,0 +1,246 @@ +/* lv2_event_helpers.h - Helper functions for the LV2 events extension. + * + * Copyright (C) 2008-2009 David Robillard <http://drobilla.net> + * + * This header is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This header is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this header; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 01222-1307 USA + */ + +#ifndef LV2_EVENT_HELPERS_H +#define LV2_EVENT_HELPERS_H + +#include <stdint.h> +#include <stdbool.h> +#include <string.h> +#include <stdlib.h> +#include <assert.h> +#include "lv2/lv2plug.in/ns/ext/event/event.h" + +/** @file + * Helper functions for the LV2 Event extension + * <http://lv2plug.in/ns/ext/event>. + * + * These functions are provided for convenience only, use of them is not + * required for supporting lv2ev (i.e. the events extension is defined by the + * raw buffer format described in lv2_event.h and NOT by this API). + * + * Note that these functions are all static inline which basically means: + * do not take the address of these functions. */ + + +/** Pad a size to 64 bits (for event sizes) */ +static inline uint16_t +lv2_event_pad_size(uint16_t size) +{ + return (size + 7) & (~7); +} + + +/** Initialize (empty, reset..) an existing event buffer. + * The contents of buf are ignored entirely and overwritten, except capacity + * which is unmodified. */ +static inline void +lv2_event_buffer_reset(LV2_Event_Buffer* buf, + uint16_t stamp_type, + uint8_t *data) +{ + buf->data = data; + buf->header_size = sizeof(LV2_Event_Buffer); + buf->stamp_type = stamp_type; + buf->event_count = 0; + buf->size = 0; +} + + +/** Allocate a new, empty event buffer. */ +static inline LV2_Event_Buffer* +lv2_event_buffer_new(uint32_t capacity, uint16_t stamp_type) +{ + const size_t size = sizeof(LV2_Event_Buffer) + capacity; + LV2_Event_Buffer* buf = (LV2_Event_Buffer*)malloc(size); + if (buf != NULL) { + buf->capacity = capacity; + lv2_event_buffer_reset(buf, stamp_type, (uint8_t *)(buf + 1)); + return buf; + } else { + return NULL; + } +} + + +/** An iterator over an LV2_Event_Buffer. + * + * Multiple simultaneous read iterators over a single buffer is fine, + * but changing the buffer invalidates all iterators (e.g. RW Lock). */ +typedef struct { + LV2_Event_Buffer* buf; + uint32_t offset; +} LV2_Event_Iterator; + + +/** Reset an iterator to point to the start of @a buf. + * @return True if @a iter is valid, otherwise false (buffer is empty) */ +static inline bool +lv2_event_begin(LV2_Event_Iterator* iter, + LV2_Event_Buffer* buf) +{ + iter->buf = buf; + iter->offset = 0; + return (buf->size > 0); +} + + +/** Check if @a iter is valid. + * @return True if @a iter is valid, otherwise false (past end of buffer) */ +static inline bool +lv2_event_is_valid(LV2_Event_Iterator* iter) +{ + return (iter->offset < iter->buf->size); +} + + +/** Advance @a iter forward one event. + * @a iter must be valid. + * @return True if @a iter is valid, otherwise false (reached end of buffer) */ +static inline bool +lv2_event_increment(LV2_Event_Iterator* iter) +{ + assert(lv2_event_is_valid(iter)); + + LV2_Event* const ev = (LV2_Event*)( + (uint8_t*)iter->buf->data + iter->offset); + + iter->offset += lv2_event_pad_size(sizeof(LV2_Event) + ev->size); + + return true; +} + + +/** Dereference an event iterator (get the event currently pointed at). + * @a iter must be valid. + * @a data if non-NULL, will be set to point to the contents of the event + * returned. + * @return A Pointer to the event @a iter is currently pointing at, or NULL + * if the end of the buffer is reached (in which case @a data is + * also set to NULL). */ +static inline LV2_Event* +lv2_event_get(LV2_Event_Iterator* iter, + uint8_t** data) +{ + assert(lv2_event_is_valid(iter)); + + LV2_Event* const ev = (LV2_Event*)( + (uint8_t*)iter->buf->data + iter->offset); + + if (data) + *data = (uint8_t*)ev + sizeof(LV2_Event); + + return ev; +} + + +/** Write an event at @a iter. + * The event (if any) pointed to by @a iter will be overwritten, and @a iter + * incremented to point to the following event (i.e. several calls to this + * function can be done in sequence without twiddling iter in-between). + * @return True if event was written, otherwise false (buffer is full). */ +static inline bool +lv2_event_write(LV2_Event_Iterator* iter, + uint32_t frames, + uint32_t subframes, + uint16_t type, + uint16_t size, + const uint8_t* data) +{ + if (iter->buf->capacity - iter->buf->size < sizeof(LV2_Event) + size) + return false; + + LV2_Event* const ev = (LV2_Event*)( + (uint8_t*)iter->buf->data + iter->offset); + + ev->frames = frames; + ev->subframes = subframes; + ev->type = type; + ev->size = size; + memcpy((uint8_t*)ev + sizeof(LV2_Event), data, size); + ++iter->buf->event_count; + + size = lv2_event_pad_size(sizeof(LV2_Event) + size); + iter->buf->size += size; + iter->offset += size; + + return true; +} + + +/** Reserve space for an event in the buffer and return a pointer to + the memory where the caller can write the event data, or NULL if there + is not enough room in the buffer. */ +static inline uint8_t* +lv2_event_reserve(LV2_Event_Iterator* iter, + uint32_t frames, + uint32_t subframes, + uint16_t type, + uint16_t size) +{ + size = lv2_event_pad_size(size); + if (iter->buf->capacity - iter->buf->size < sizeof(LV2_Event) + size) + return NULL; + + LV2_Event* const ev = (LV2_Event*)((uint8_t*)iter->buf->data + + iter->offset); + + ev->frames = frames; + ev->subframes = subframes; + ev->type = type; + ev->size = size; + ++iter->buf->event_count; + + size = lv2_event_pad_size(sizeof(LV2_Event) + size); + iter->buf->size += size; + iter->offset += size; + + return (uint8_t*)ev + sizeof(LV2_Event); +} + + +/** Write an event at @a iter. + * The event (if any) pointed to by @a iter will be overwritten, and @a iter + * incremented to point to the following event (i.e. several calls to this + * function can be done in sequence without twiddling iter in-between). + * @return True if event was written, otherwise false (buffer is full). */ +static inline bool +lv2_event_write_event(LV2_Event_Iterator* iter, + const LV2_Event* ev, + const uint8_t* data) +{ + if (iter->buf->capacity - iter->buf->size < sizeof(LV2_Event) + ev->size) + return false; + + LV2_Event* const write_ev = (LV2_Event*)( + (uint8_t*)iter->buf->data + iter->offset); + + *write_ev = *ev; + memcpy((uint8_t*)write_ev + sizeof(LV2_Event), data, ev->size); + ++iter->buf->event_count; + + const uint16_t size = lv2_event_pad_size(sizeof(LV2_Event) + ev->size); + iter->buf->size += size; + iter->offset += size; + + return true; +} + +#endif /* LV2_EVENT_HELPERS_H */ + diff --git a/lv2/lv2plug.in/ns/ext/event/event.h b/lv2/lv2plug.in/ns/ext/event/event.h new file mode 100644 index 0000000..2c340ba --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/event/event.h @@ -0,0 +1,281 @@ +/* + LV2 Event Extension + Copyright 2008-2011 David Robillard <http://drobilla.net> + Copyright 2006-2007 Lars Luthman <lars.luthman@gmail.com> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#ifndef LV2_EVENT_H +#define LV2_EVENT_H + +#define LV2_EVENT_URI "http://lv2plug.in/ns/ext/event" +#define LV2_EVENT_AUDIO_STAMP 0 + +#include <stdint.h> + +/** + @file event.h + C API for the LV2 Event extension <http://lv2plug.in/ns/ext/event>. + + This extension is a generic transport mechanism for time stamped events + of any type (e.g. MIDI, OSC, ramps, etc). Each port can transport mixed + events of any type; the type of events and timestamps are defined by a URI + which is mapped to an integer by the host for performance reasons. + + This extension requires the host to support the LV2 URI Map extension. + Any host which supports this extension MUST guarantee that any call to + the LV2 URI Map uri_to_id function with the URI of this extension as the + 'map' argument returns a value within the range of uint16_t. +*/ + +/** + The best Pulses Per Quarter Note for tempo-based uint32_t timestamps. + Equal to 2^12 * 5 * 7 * 9 * 11 * 13 * 17, which is evenly divisble + by all integers from 1 through 18 inclusive, and powers of 2 up to 2^12. +*/ +static const uint32_t LV2_EVENT_PPQN = 3136573440U; + +/** + An LV2 event (header only). + + LV2 events are generic time-stamped containers for any type of event. + The type field defines the format of a given event's contents. + + This struct defines the header of an LV2 event. An LV2 event is a single + chunk of POD (plain old data), usually contained in a flat buffer (see + LV2_EventBuffer below). Unless a required feature says otherwise, hosts may + assume a deep copy of an LV2 event can be created safely using a simple: + + memcpy(ev_copy, ev, sizeof(LV2_Event) + ev->size); (or equivalent) +*/ +typedef struct { + + /** + The frames portion of timestamp. The units used here can optionally be + set for a port (with the lv2ev:timeUnits property), otherwise this is + audio frames, corresponding to the sample_count parameter of the LV2 run + method (e.g. frame 0 is the first frame for that call to run). + */ + uint32_t frames; + + /** + The sub-frames portion of timestamp. The units used here can optionally + be set for a port (with the lv2ev:timeUnits property), otherwise this is + 1/(2^32) of an audio frame. + */ + uint32_t subframes; + + /** + The type of this event, as a number which represents some URI + defining an event type. This value MUST be some value previously + returned from a call to the uri_to_id function defined in the LV2 + URI map extension (see lv2_uri_map.h). + There are special rules which must be followed depending on the type + of an event. If the plugin recognizes an event type, the definition + of that event type will describe how to interpret the event, and + any required behaviour. Otherwise, if the type is 0, this event is a + non-POD event and lv2_event_unref MUST be called if the event is + 'dropped' (see above). Even if the plugin does not understand an event, + it may pass the event through to an output by simply copying (and NOT + calling lv2_event_unref). These rules are designed to allow for generic + event handling plugins and large non-POD events, but with minimal hassle + on simple plugins that "don't care" about these more advanced features. + */ + uint16_t type; + + /** + The size of the data portion of this event in bytes, which immediately + follows. The header size (12 bytes) is not included in this value. + */ + uint16_t size; + + /* size bytes of data follow here */ + +} LV2_Event; + + +/** + A buffer of LV2 events (header only). + + Like events (which this contains) an event buffer is a single chunk of POD: + the entire buffer (including contents) can be copied with a single memcpy. + The first contained event begins sizeof(LV2_EventBuffer) bytes after the + start of this struct. + + After this header, the buffer contains an event header (defined by struct + LV2_Event), followed by that event's contents (padded to 64 bits), followed + by another header, etc: + + | | | | | | | + | | | | | | | | | | | | | | | | | | | | | | | | | + |FRAMES |SUBFRMS|TYP|LEN|DATA..DATA..PAD|FRAMES | ... +*/ +typedef struct { + + /** + The contents of the event buffer. This may or may not reside in the + same block of memory as this header, plugins must not assume either. + The host guarantees this points to at least capacity bytes of allocated + memory (though only size bytes of that are valid events). + */ + uint8_t* data; + + /** + The size of this event header in bytes (including everything). + + This is to allow for extending this header in the future without + breaking binary compatibility. Whenever this header is copied, + it MUST be done using this field (and NOT the sizeof this struct). + */ + uint16_t header_size; + + /** + The type of the time stamps for events in this buffer. + As a special exception, '0' always means audio frames and subframes + (1/UINT32_MAX'th of a frame) in the sample rate passed to instantiate. + + INPUTS: The host must set this field to the numeric ID of some URI + defining the meaning of the frames/subframes fields of contained events + (obtained by the LV2 URI Map uri_to_id function with the URI of this + extension as the 'map' argument, see lv2_uri_map.h). The host must + never pass a plugin a buffer which uses a stamp type the plugin does not + 'understand'. The value of this field must never change, except when + connect_port is called on the input port, at which time the host MUST + have set the stamp_type field to the value that will be used for all + subsequent run calls. + + OUTPUTS: The plugin may set this to any value that has been returned + from uri_to_id with the URI of this extension for a 'map' argument. + When connected to a buffer with connect_port, output ports MUST set this + field to the type of time stamp they will be writing. On any call to + connect_port on an event input port, the plugin may change this field on + any output port, it is the responsibility of the host to check if any of + these values have changed and act accordingly. + */ + uint16_t stamp_type; + + /** + The number of events in this buffer. + + INPUTS: The host must set this field to the number of events contained + in the data buffer before calling run(). The plugin must not change + this field. + + OUTPUTS: The plugin must set this field to the number of events it has + written to the buffer before returning from run(). Any initial value + should be ignored by the plugin. + */ + uint32_t event_count; + + /** + The size of the data buffer in bytes. + This is set by the host and must not be changed by the plugin. + The host is allowed to change this between run() calls. + */ + uint32_t capacity; + + /** + The size of the initial portion of the data buffer containing data. + + INPUTS: The host must set this field to the number of bytes used + by all events it has written to the buffer (including headers) + before calling the plugin's run(). + The plugin must not change this field. + + OUTPUTS: The plugin must set this field to the number of bytes + used by all events it has written to the buffer (including headers) + before returning from run(). + Any initial value should be ignored by the plugin. + */ + uint32_t size; + +} LV2_Event_Buffer; + + +/** + Opaque pointer to host data. +*/ +typedef void* LV2_Event_Callback_Data; + + +/** + Non-POD events feature. + + To support this feature the host must pass an LV2_Feature struct to the + plugin's instantiate method with URI "http://lv2plug.in/ns/ext/event" + and data pointed to an instance of this struct. Note this feature + is not mandatory to support the event extension. +*/ +typedef struct { + + /** + Opaque pointer to host data. + + The plugin MUST pass this to any call to functions in this struct. + Otherwise, it must not be interpreted in any way. + */ + LV2_Event_Callback_Data callback_data; + + /** + Take a reference to a non-POD event. + + If a plugin receives an event with type 0, it means the event is a + pointer to some object in memory and not a flat sequence of bytes + in the buffer. When receiving a non-POD event, the plugin already + has an implicit reference to the event. If the event is stored AND + passed to an output, lv2_event_ref MUST be called on that event. + If the event is only stored OR passed through, this is not necessary + (as the plugin already has 1 implicit reference). + + @param event An event received at an input that will not be copied to + an output or stored in any way. + + @param context The calling context. Like event types, this is a mapped + URI, see lv2_context.h. Simple plugin with just a run() method should + pass 0 here (the ID of the 'standard' LV2 run context). The host + guarantees that this function is realtime safe iff @a context is + realtime safe. + + PLUGINS THAT VIOLATE THESE RULES MAY CAUSE CRASHES AND MEMORY LEAKS. + */ + uint32_t (*lv2_event_ref)(LV2_Event_Callback_Data callback_data, + LV2_Event* event); + + /** + Drop a reference to a non-POD event. + + If a plugin receives an event with type 0, it means the event is a + pointer to some object in memory and not a flat sequence of bytes + in the buffer. If the plugin does not pass the event through to + an output or store it internally somehow, it MUST call this function + on the event (more information on using non-POD events below). + + @param event An event received at an input that will not be copied to an + output or stored in any way. + + @param context The calling context. Like event types, this is a mapped + URI, see lv2_context.h. Simple plugin with just a run() method should + pass 0 here (the ID of the 'standard' LV2 run context). The host + guarantees that this function is realtime safe iff @a context is + realtime safe. + + PLUGINS THAT VIOLATE THESE RULES MAY CAUSE CRASHES AND MEMORY LEAKS. + */ + uint32_t (*lv2_event_unref)(LV2_Event_Callback_Data callback_data, + LV2_Event* event); + +} LV2_Event_Feature; + + +#endif /* LV2_EVENT_H */ diff --git a/lv2/lv2plug.in/ns/ext/event/event.ttl b/lv2/lv2plug.in/ns/ext/event/event.ttl new file mode 100644 index 0000000..67285aa --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/event/event.ttl @@ -0,0 +1,224 @@ +# LV2 Event Extension +# Copyright 2008-2011 David Robillard <http://drobilla.net> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix dcs: <http://ontologi.es/doap-changeset#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix ev: <http://lv2plug.in/ns/ext/event#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://drobilla.net/drobilla#me> + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + foaf:mbox <mailto:d@drobilla.net> ; + rdfs:seeAlso <http://drobilla.net/drobilla> . + +_:larsl + a foaf:Person ; + foaf:name "Lars Luthman" . + +<http://lv2plug.in/ns/ext/event> + a lv2:Specification ; + doap:license <http://opensource.org/licenses/isc> ; + doap:name "LV2 Event" ; + doap:shortdesc "A port-based real-time generic event interface." ; + rdfs:seeAlso <event-helpers.h> ; + doap:release [ + doap:revision "1.4" ; + doap:created "2011-11-21" ; + doap:file-release <http://lv2plug.in/spec/lv2-event-1.4.tar.bz2> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Update packaging." + ] + ] + ] , [ + doap:revision "1.2" ; + doap:created "2011-05-26" ; + doap:file-release <http://lv2plug.in/spec/lv2-event-1.2.tar.bz2> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Add build system (for installation)." + ] , [ + rdfs:label "Convert documentation to HTML and use lv2:documentation." + ] , [ + rdfs:label "Use lv2:Specification to be discovered as an extension." + ] + ] + ] , [ + doap:revision "1.0" ; + doap:created "2010-11-24" ; + doap:file-release <http://lv2plug.in/spec/lv2-event-1.0.tar.gz> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Initial release." + ] + ] + ] ; + doap:developer <http://drobilla.net/drobilla#me> , + _:larsl ; + lv2:documentation """ +<p>This extension defines a generic time-stamped event port type, which can be +used to create plugins that read and write real-time events, such as MIDI, +OSC, or any other type of event payload. The type(s) of event supported by +a port is defined in the data file for a plugin, for example:</p> +<pre class="turtle-code"> +<http://example.org/some-plugin> + lv2:port [ + a ev:EventPort, lv2:InputPort ; + lv2:index 0 ; + ev:supportsEvent <http://lv2plug.in/ns/ext/midi#MidiEvent> ; + lv2:symbol "midi_input" ; + lv2:name "MIDI input" ; + ] . +</pre> +""" . + +ev:EventPort + a rdfs:Class ; + rdfs:label "Event port" ; + rdfs:subClassOf lv2:Port ; + rdfs:comment """ +Ports of this type will be connected to a struct of type LV2_Event_Buffer, +defined in event.h. These ports contain a sequence of generic events +(possibly several types mixed in a single stream), the specific types of +which are defined by some URI in another LV2 extension. +""" . + +ev:Event + a rdfs:Class ; + rdfs:label "LV2 event" ; + rdfs:comment """ +A single generic time-stamped event. + +An ev:EventPort contains an LV2_Event_Buffer which contains a sequence +of these events. The binary format of LV2 events is defined by the +LV2_Event struct in event.h. + +Specific event types (e.g. MIDI, OSC) are defined by extensions, and should +be rdfs:subClassOf this class. +""" . + +ev:TimeStamp + a rdfs:Class ; + rdfs:label "LV2 event time stamp" ; + rdfs:comment """ +The time stamp of an Event. + +This defines the meaning of the 'frames' and 'subframes' fields of an +LV2_Event (both unsigned 32-bit integers). +""" . + +ev:FrameStamp + a rdfs:Class ; + rdfs:subClassOf ev:TimeStamp ; + rdfs:label "Audio frame time stamp" ; + rdfs:comment """ +The default time stamp unit for an LV2 event: the frames field represents +audio frames (in the sample rate passed to intantiate), and the subframes +field is 1/UINT32_MAX of a frame. +""" . + +ev:generic + a lv2:PortProperty ; + rdfs:label "Generic event port" ; + rdfs:comment """ +Indicates that this port does something meaningful for any event type +(e.g. event mixers, delays, serialisers, etc). If this property is set, hosts +should consider the port suitable for any type of event. Otherwise, hosts +should consider the port 'appropriate' only for the specific event types +listed with :supportsEvent. Note that plugins must gracefully handle unknown +event types whether or not this property is present. +""" . + +ev:supportsEvent + a rdf:Property ; + rdfs:domain lv2:Port ; + rdfs:range ev:Event ; + rdfs:label "Supports event type" ; + rdfs:comment """ +Indicates that this port supports or "understands" a certain event type. +For input ports, this means the plugin understands and does something useful +with events of this type. For output ports, this means the plugin may generate +events of this type. If the plugin never actually generates events of this type, +but might pass them through from an input, this property should not be set (use +ev:inheritsEvent for that). +Plugins with event input ports must always gracefully handle any type of event, +even if it does not 'support' it. This property should always be set for +event types the plugin understands/generates so hosts can discover plugins +appropriate for a given scenario (e.g. plugins with a MIDI input). +Hosts are not expected to consider event ports suitable for some type of +event if the relevant :supportsEvent property is not set, unless the +ev:generic property for that port is also set. +""" . + +ev:inheritsEvent + a rdf:Property ; + rdfs:domain lv2:Port ; + rdfs:range lv2:Port ; + rdfs:label "Inherits event type" ; + rdfs:comment """ +Indicates that this output port might pass through events that arrived at some +other input port (or generate an event of the same type as events arriving at +that input). The host must always check the stamp type of all outputs when +connecting an input, but this property should be set whenever it applies. +""" . + +ev:supportsTimeStamp + a rdf:Property ; + rdfs:domain lv2:Port ; + rdfs:range ev:TimeStamp ; + rdfs:label "Supports time stamp type" ; + rdfs:comment """ +Indicates that this port supports or "understands" a certain time stamp type. +Meaningful only for input ports, the host must never connect a port to an +event buffer with a time stamp type that isn't supported by the port. +""" . + +ev:generatesTimeStamp + a rdf:Property ; + rdfs:domain lv2:Port ; + rdfs:range ev:TimeStamp ; + rdfs:label "Outputs time stamp type" ; + rdfs:comment """ +Indicates that this port may output a certain time stamp type, regardless of +the time stamp type of any input ports. If the port outputs stamps based on +what type inputs are connected to, this property should not be set (use the +ev:inheritsTimeStamp property for that). Hosts MUST check the time_stamp value +of any output port buffers after a call to connect_port on ANY event input +port on the plugin. If the plugin changes the stamp_type field of an output +event buffer during a call to run(), the plugin must call the +stamp_type_changed function provided by the host in the LV2_Event_Feature +struct, if it is non-NULL. +""" . + +ev:inheritsTimeStamp + a rdf:Property ; + rdfs:domain lv2:Port ; + rdfs:range lv2:Port ; + rdfs:label "Inherits time stamp type" ; + rdfs:comment """ +Indicates that this port follows the time stamp type of an input port. +This property is not necessary, but it should be set for outputs that +base their output type on an input port so the host can make more sense +of the plugin and provide a more sensible interface. +""" . diff --git a/lv2/lv2plug.in/ns/ext/event/ext.pc.in b/lv2/lv2plug.in/ns/ext/event/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/event/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/event/manifest.ttl b/lv2/lv2plug.in/ns/ext/event/manifest.ttl new file mode 100644 index 0000000..fa12f94 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/event/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/event> + a lv2:Specification ; + lv2:minorVersion 1 ; + lv2:microVersion 4 ; + rdfs:seeAlso <event.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/event/waf b/lv2/lv2plug.in/ns/ext/event/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/event/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/event/wscript b/lv2/lv2plug.in/ns/ext/event/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/event/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/host-info/ext.pc.in b/lv2/lv2plug.in/ns/ext/host-info/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/host-info/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/host-info/host-info.ttl b/lv2/lv2plug.in/ns/ext/host-info/host-info.ttl new file mode 100644 index 0000000..4f563bb --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/host-info/host-info.ttl @@ -0,0 +1,117 @@ +# LV2 Host Info Extension +# Copyright (C) 2009 David Robillard <d@drobilla.net> +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +@prefix hi: <http://lv2plug.in/ns/ext/host-info#> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix amb: <http://ambisonics.ch/standards/channels/> . + +<http://lv2plug.in/ns/ext/host-info> a lv2:Specification ; + doap:license <http://usefulinc.com/doap/licenses/mit> ; + doap:name "LV2 Host Info" ; + doap:shortdesc "A format for describing LV2 hosts." ; + doap:maintainer [ + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + rdfs:seeAlso <http://drobilla.net/drobilla.rdf> + ] ; + lv2:documentation """ +<p>This specification defines various properties to represent useful information +about LV2 hosts. Currently, the primary use of this specification is to describe which +extensions are supported by a given host.</p> + +<p>The extensions supported by a host can be described like this:</p> +<pre class="turtle-code"> +@prefix hi: <http://lv2plug.in/ns/ext/host-info#> . + +<http://example.org/some-host> + a hi:Host ; + doap:name "Foo Rack" ; + hi:supportsExtension [ + hi:extension <http://example.org/some-extension> ; + hi:sinceVersion "1.2.0" + ] . +</pre> +""" . + + +## Core Classes / Properties + +hi:Host a rdfs:Class ; + rdfs:label "LV2 Host" ; + rdfs:subClassOf [ a owl:Restriction ; + owl:onProperty doap:name ; + owl:someValuesFrom xsd:string ; + owl:minCardinality 1 ; + rdfs:comment "A hi:Host MUST have at least one string doap:name" + ] ; + rdfs:comment """ +An application that supports loading LV2 plugins, or performs other +LV2 related functionality. +""" . + +hi:supportsExtension a rdf:Property ; + rdfs:domain hi:Host ; + rdfs:range hi:ExtensionSupport ; + rdfs:label "supports extension" ; + rdfs:comment "Relates a Host to its ExtensionSupport" . + +hi:ExtensionSupport a rdfs:Class ; + rdfs:label "Extension Support" ; + rdfs:subClassOf [ a owl:Restriction ; + owl:onProperty hi:sinceVersion ; + owl:someValuesFrom xsd:string ; + owl:minCardinality 1 ; + rdfs:comment """ +A hi:ExtensionSupport MUST have at least one string hi:sinceVersion +""" ] ; + rdfs:comment "A description of the support for an extension by a Host" . + +hi:extension a rdf:Property ; + rdfs:domain hi:ExtensionSupport ; + rdfs:range lv2:Specification ; + rdfs:label "extension" ; + rdfs:comment "Indicates the extension supported by a host." . + +hi:sinceVersion a rdf:Property ; + rdfs:domain hi:ExtensionSupport ; + rdfs:range xsd:string ; + rdfs:label "since version" ; + rdfs:comment """ +The initial version of a host which supported an extension. +This property MUST always be given +""" . + +hi:untilVersion a rdf:Property ; + rdfs:domain hi:ExtensionSupport ; + rdfs:range xsd:string ; + rdfs:label "until version" ; + rdfs:comment """ +The final version of a host which supported an extension. This property can +be used if support for an extension was discontinued in a host for some reason. +""" . + diff --git a/lv2/lv2plug.in/ns/ext/host-info/manifest.ttl b/lv2/lv2plug.in/ns/ext/host-info/manifest.ttl new file mode 100644 index 0000000..ae1e097 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/host-info/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/host-info> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 1 ; + rdfs:seeAlso <host-info.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/host-info/waf b/lv2/lv2plug.in/ns/ext/host-info/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/host-info/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/host-info/wscript b/lv2/lv2plug.in/ns/ext/host-info/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/host-info/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/instance-access/ext.pc.in b/lv2/lv2plug.in/ns/ext/instance-access/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/instance-access/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/instance-access/instance-access.h b/lv2/lv2plug.in/ns/ext/instance-access/instance-access.h new file mode 100644 index 0000000..7e18ee4 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/instance-access/instance-access.h @@ -0,0 +1,38 @@ +/* + LV2 Instance Access Extension + Copyright 2008-2011 David Robillard <http://drobilla.net> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#ifndef LV2_INSTANCE_ACCESS_H +#define LV2_INSTANCE_ACCESS_H + +#define LV2_INSTANCE_ACCESS_URI "http://lv2plug.in/ns/ext/instance-access" + + +/** @file + * C header for the LV2 Instance Access extension + * <http://lv2plug.in/ns/ext/instance-access>. + * + * This extension defines a method for (e.g.) plugin UIs to get a direct + * handle to an LV2 plugin instance (LV2_Handle), if possible. + * + * To support this feature the host must pass an LV2_Feature struct to the + * UI instantiate method with URI "http://lv2plug.in/ns/ext/instance-access" + * and data pointed directly to the LV2_Handle of the plugin instance. + */ + + +#endif /* LV2_INSTANCE_ACCESS_H */ + diff --git a/lv2/lv2plug.in/ns/ext/instance-access/instance-access.ttl b/lv2/lv2plug.in/ns/ext/instance-access/instance-access.ttl new file mode 100644 index 0000000..14eb732 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/instance-access/instance-access.ttl @@ -0,0 +1,80 @@ +# LV2 Instance Access Extension +# Copyright 2008-2011 David Robillard <d@drobilla.net> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix dcs: <http://ontologi.es/doap-changeset#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix ia: <http://lv2plug.in/ns/ext/instance-access#> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix lv2ev: <http://lv2plug.in/ns/ext/event#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://drobilla.net/drobilla#me> + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + foaf:mbox <mailto:d@drobilla.net> ; + rdfs:seeAlso <http://drobilla.net/drobilla> . + +<http://lv2plug.in/ns/ext/instance-access> + a lv2:Specification ; + doap:license <http://opensource.org/licenses/isc> ; + doap:name "LV2 Instance Access" ; + doap:shortdesc "Provides access to the LV2_Handle of a plugin." ; + doap:developer <http://drobilla.net/drobilla#me> ; + doap:release [ + doap:revision "1.4" ; + doap:created "2011-11-21" ; + doap:file-release <http://lv2plug.in/spec/lv2-instance-access-1.4.tar.bz2> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Update packaging." + ] , [ + rdfs:label "Improve documentation." + ] + ] + ] , [ + doap:revision "1.2" ; + doap:created "2011-05-26" ; + doap:file-release <http://lv2plug.in/spec/lv2-instance-access-1.2.tar.bz2> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Add build system for installation." + ] , [ + rdfs:label "Switch to ISC license." + ] + ] + ] , [ + doap:revision "1.0" ; + doap:created "2010-10-04" ; + doap:file-release <http://lv2plug.in/spec/lv2-instance-access-1.0.tar.gz> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Initial release." + ] + ] + ] ; + lv2:documentation """ +<p>This extension defines a feature which allows plugin UIs to get a direct +handle to an LV2 plugin instance (LV2_Handle), if possible.</p> + +<p>To support this feature the host must pass an LV2_Feature struct to the UI +instantiate method with URI LV2_INSTANCE_ACCESS_URI and data pointed directly +to the LV2_Handle of the plugin instance.</p> +""" . diff --git a/lv2/lv2plug.in/ns/ext/instance-access/manifest.ttl b/lv2/lv2plug.in/ns/ext/instance-access/manifest.ttl new file mode 100644 index 0000000..d6412c5 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/instance-access/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/instance-access> + a lv2:Specification ; + lv2:minorVersion 1 ; + lv2:microVersion 4 ; + rdfs:seeAlso <instance-access.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/instance-access/waf b/lv2/lv2plug.in/ns/ext/instance-access/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/instance-access/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/instance-access/wscript b/lv2/lv2plug.in/ns/ext/instance-access/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/instance-access/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/log/ext.pc.in b/lv2/lv2plug.in/ns/ext/log/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/log/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/log/log.h b/lv2/lv2plug.in/ns/ext/log/log.h new file mode 100644 index 0000000..c139a27 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/log/log.h @@ -0,0 +1,91 @@ +/* + Copyright 2012 David Robillard <http://drobilla.net> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +/** + @file log.h C header for the LV2 Log extension + <http://lv2plug.in/ns/ext/log>. +*/ + +#ifndef LV2_LOG_H +#define LV2_LOG_H + +#define LV2_LOG_URI "http://lv2plug.in/ns/ext/log" +#define LV2_LOG_LOG_URI LV2_LOG_URI "#log" +#define LV2_LOG_ERROR_URI LV2_LOG_URI "#Error" +#define LV2_LOG_INFO_URI LV2_LOG_URI "#Info" +#define LV2_LOG_WARN_URI LV2_LOG_URI "#Warn" + +#include <stdarg.h> + +#include "lv2/lv2plug.in/ns/ext/urid/urid.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __GNUC__ +/** Allow type checking of printf-like functions. */ +# define LV2_LOG_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1))) +#else +# define LV2_LOG_FUNC +#endif + +/** + Opaque data to host data for LV2_Log_Log. +*/ +typedef void* LV2_Log_Handle; + +/** + Log (http://lv2plug.in/ns/ext/log#log). +*/ +typedef struct _LV2_Log { + /** + Opaque pointer to host data. + + This MUST be passed to methods in this struct henever they are called. + Otherwise, it must not be interpreted in any way. + */ + LV2_Log_Handle handle; + + /** + Log a message, passing format parameters directly. + + The API of this function matches that of the standard C printf + function, except for the addition of the first two parameters. + */ + LV2_LOG_FUNC(3, 4) + int (*printf)(LV2_Log_Handle handle, + LV2_URID level, + const char* fmt, ...); + + /** + Log a message, passing format parameters in a va_list. + + The API of this function matches that of the standard C vprintf + function, except for the addition of the first two parameters. + */ + LV2_LOG_FUNC(3, 0) + int (*vprintf)(LV2_Log_Handle handle, + LV2_URID level, + const char* fmt, + va_list ap); +} LV2_Log_Log; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV2_LOG_H */ diff --git a/lv2/lv2plug.in/ns/ext/log/log.ttl b/lv2/lv2plug.in/ns/ext/log/log.ttl new file mode 100644 index 0000000..567333f --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/log/log.ttl @@ -0,0 +1,74 @@ +# LV2 Log Extension +# Copyright 2012 David Robillard <d@drobilla.net> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix log: <http://lv2plug.in/ns/ext/log#> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://lv2plug.in/ns/ext/log> + a lv2:Specification ; + doap:name "LV2 Log" ; + doap:shortdesc "A feature for writing log messages." ; + doap:maintainer [ + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + rdfs:seeAlso <http://drobilla.net/drobilla.rdf> + ] ; + lv2:documentation """ + +<p>This extension defines a feature, LV2_Log_Log, which allows plugins to print +messages to logs implemented by the host with an API much like the standard C +printf functions. This allows, for example, plugin logs to be nicely presented +to the user in a graphical user interface.</p> + +<p>Different log <q>levels</q> (e.g. <q>error</q> or <q>information</q>) are +defined by URI and passed as an LV2_URID. Thus, the possible number of log +levels is unlimited, but implementations SHOULD use the levels defined in this +extension unless they have a special reason to do otherwise.</p> +""" . + +log:Level + a rdfs:Class ; + lv2:documentation """ +<p>A log level. Subclasses of this class can be passed to LV2_Log_Log methods +to describe the nature of the log message.</p>""" . + +log:Error + a rdfs:Class ; + rdfs:subClassOf log:Level ; + rdfs:comment "An error" . + +log:Info + a rdfs:Class ; + rdfs:subClassOf log:Level ; + rdfs:comment "An informative message" . + +log:Warn + a rdfs:Class ; + rdfs:subClassOf log:Level ; + rdfs:comment "A warning" . + +log:log + a lv2:Feature ; + lv2:documentation """ +<p>A feature which plugins may use to log messages. To support this feature, +the host must pass an LV2_Feature to LV2_Descriptor::instantiate() with URI +LV2_LOG_LOG_URI and data pointed to an instance of LV2_Log_Log.</p> +""" . diff --git a/lv2/lv2plug.in/ns/ext/log/manifest.ttl b/lv2/lv2plug.in/ns/ext/log/manifest.ttl new file mode 100644 index 0000000..7d00e2e --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/log/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/log> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 1 ; + rdfs:seeAlso <log.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/log/waf b/lv2/lv2plug.in/ns/ext/log/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/log/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/log/wscript b/lv2/lv2plug.in/ns/ext/log/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/log/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/midi/ext.pc.in b/lv2/lv2plug.in/ns/ext/midi/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/midi/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/midi/manifest.ttl b/lv2/lv2plug.in/ns/ext/midi/manifest.ttl new file mode 100644 index 0000000..a8e194e --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/midi/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/midi> + a lv2:Specification ; + lv2:minorVersion 1 ; + lv2:microVersion 4 ; + rdfs:seeAlso <midi.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/midi/midi.ttl b/lv2/lv2plug.in/ns/ext/midi/midi.ttl new file mode 100644 index 0000000..64edf0e --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/midi/midi.ttl @@ -0,0 +1,115 @@ +# LV2 MIDI Extension +# Copyright 2008-2011 David Robillard <d@drobilla.net> +# Copyright 2006 Lars Luthman <lars.luthman@gmail.com> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix dcs: <http://ontologi.es/doap-changeset#> . +@prefix atom: <http://lv2plug.in/ns/ext/atom#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix ev: <http://lv2plug.in/ns/ext/event#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix midi: <http://lv2plug.in/ns/ext/midi#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://drobilla.net/drobilla#me> + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + foaf:mbox <mailto:d@drobilla.net> ; + rdfs:seeAlso <http://drobilla.net/drobilla> . + +_:larsl + a foaf:Person ; + foaf:name "Lars Luthman" ; + foaf:mbox <mailto:lars.luthman@gmail.com> . + +<http://lv2plug.in/ns/ext/midi> + a lv2:Specification ; + doap:license <http://opensource.org/licenses/isc> ; + doap:name "LV2 MIDI" ; + doap:shortdesc "A data type for raw MIDI." ; + doap:maintainer <http://drobilla.net/drobilla#me> ; + doap:developer _:larsl ; + doap:release [ + doap:revision "1.4" ; + doap:created "2011-11-21" ; + doap:file-release <http://lv2plug.in/spec/lv2-midi-1.4.tar.bz2> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Update packaging." + ] , [ + rdfs:label "Improve documentation." + ] + ] + ] , [ + doap:revision "1.2" ; + doap:created "2011-05-26" ; + doap:file-release <http://lv2plug.in/spec/lv2-midi-1.2.tar.bz2> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Add build system for installation." + ] , [ + rdfs:label "Switch to ISC license." + ] + ] + ] , [ + doap:revision "1.0" ; + doap:created "2010-10-04" ; + doap:file-release <http://lv2plug.in/spec/lv2-midi-1.0.tar.gz> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Initial release." + ] + ] + ] ; + lv2:documentation """ +<p>This extension defines a data type for a MIDI message, midi:MidiEvent, which +is normalized for fast and convenient processing by plugins. It is +particularly useful as the payload of an <a +href="http://lv2plug.in/ns/ext/atom#Atom">Atom</a> or <a +href="http://lv2plug.in/ns/ext/event#Event">Event</a>.</p> +""" . + +midi:MidiEvent + a rdfs:Class ; + rdfs:label "LV2 MIDI message." ; + rdfs:subClassOf ev:Event , + atom:Atom ; + lv2:documentation """ +<p>A single raw MIDI message (i.e. a sequence of bytes).</p> + +<p>This is equivalent to a standard MIDI messages, except with the following +restrictions to simplify handling:</p> +<ul> + <li>Running status is not allowed, every message must have its own status + byte.</li> + + <li>Note On messages with velocity 0 are not allowed. These messages are + equivalent to Note Off in standard MIDI streams, but here only proper Note + Off messages are allowed.</li> + + <li>"Realtime messages" (status bytes 0xF8 to 0xFF) are allowed, but may + not occur inside other messages like they can in standard MIDI streams.</li> + + <li>All messages are complete valid MIDI messages. This means, for example, + that only the first byte in each event (the status byte) may have the eighth + bit set, that Note On and Note Off events are always 3 bytes long, etc. + Where messages are communicated, the writer is responsible for writing valid + messages, and the reader may assume that all events are valid.</li> +</ul> +""" . diff --git a/lv2/lv2plug.in/ns/ext/midi/waf b/lv2/lv2plug.in/ns/ext/midi/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/midi/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/midi/wscript b/lv2/lv2plug.in/ns/ext/midi/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/midi/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/osc/ext.pc.in b/lv2/lv2plug.in/ns/ext/osc/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/osc/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/osc/lv2_osc.c b/lv2/lv2plug.in/ns/ext/osc/lv2_osc.c new file mode 100644 index 0000000..afea2c9 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/osc/lv2_osc.c @@ -0,0 +1,238 @@ +/* LV2 OSC Messages Extension + * Copyright (C) 2007-2009 David Robillard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <errno.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include "lv2_osc.h" +#include "lv2_osc_print.h" + +/*#ifndef BIG_ENDIAN + #ifndef LITTLE_ENDIAN + #warning This code requires BIG_ENDIAN or LITTLE_ENDIAN to be defined + #warning Assuming little endian. THIS MAY BREAK HORRIBLY! + #endif +#endif*/ + +#define lv2_osc_swap32(x) \ +({ \ + uint32_t __x = (x); \ + ((uint32_t)( \ + (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \ + (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \ + (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ + (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \ +}) + +#define lv2_osc_swap64(x) \ +({ \ + uint64_t __x = (x); \ + ((uint64_t)( \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) << 8) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \ + (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \ +}) + + +/** Pad a size to a multiple of 32 bits */ +inline static uint32_t +lv2_osc_pad_size(uint32_t size) +{ + return size + 3 - ((size-1) % 4); +} + + +inline static uint32_t +lv2_osc_string_size(const char *s) +{ + return lv2_osc_pad_size((uint32_t)strlen(s) + 1); +} + + +static inline uint32_t +lv2_osc_blob_size(const void* blob) +{ + return sizeof(uint32_t) + lv2_osc_pad_size(*((uint32_t*)blob)); +} + + +uint32_t +lv2_osc_arg_size(char type, const LV2_OSC_Argument* arg) +{ + switch (type) { + case 'c': + case 'i': + case 'f': + case 'S': // Symbol (URI-mapped integer) + return 4; + + case 'h': + case 'd': + return 8; + + case 's': + return lv2_osc_string_size(&arg->s); + + case 'b': + return lv2_osc_blob_size(&arg->b); + + default: + fprintf(stderr, "Warning: unknown OSC type '%c'.", type); + return 0; + } +} + + +void +lv2_osc_argument_swap_byte_order(char type, LV2_OSC_Argument* arg) +{ + switch (type) { + case 'i': + case 'f': + case 'b': + case 'c': + *(int32_t*)arg = lv2_osc_swap32(*(int32_t*)arg); + break; + + case 'h': + case 'd': + *(int64_t*)arg = lv2_osc_swap64(*(int64_t*)arg); + break; + } +} + + +/** Convert a message from network byte order to host byte order. */ +void +lv2_osc_message_swap_byte_order(LV2_OSC_Event* msg) +{ + const char* const types = lv2_osc_get_types(msg); + + for (uint32_t i=0; i < msg->argument_count; ++i) + lv2_osc_argument_swap_byte_order(types[i], lv2_osc_get_argument(msg, i)); +} + + +/** Not realtime safe, returned value must be free()'d by caller. */ +LV2_OSC_Event* +lv2_osc_message_new(const char* path, const char* types, ...) +{ + /* FIXME: path only */ + + LV2_OSC_Event* result = malloc(sizeof(LV2_OSC_Event) + + 4 + lv2_osc_string_size(path)); + + const uint32_t path_size = lv2_osc_string_size(path); + result->data_size = path_size + 4; // 4 for types + result->argument_count = 0; + result->types_offset = lv2_osc_string_size(path) + 1; + (&result->data)[result->types_offset - 1] = ','; + (&result->data)[result->types_offset] = '\0'; + + memcpy(&result->data, path, strlen(path) + 1); + + return result; +} + + +/** Create a new LV2_OSC_Event from a raw OSC message. + * + * If \a out_buf is NULL, new memory will be allocated. Otherwise the returned + * value will be equal to buf, unless there is insufficient space in which + * case NULL is returned. + */ +LV2_OSC_Event* +lv2_osc_message_from_raw(uint32_t out_buf_size, + void* out_buf, + uint32_t raw_msg_size, + void* raw_msg) +{ + const uint32_t message_header_size = (sizeof(uint32_t) * 4); + + const uint32_t path_size = lv2_osc_string_size((char*)raw_msg); + const uint32_t types_len = strlen((char*)(raw_msg + path_size + 1)); + uint32_t index_size = types_len * sizeof(uint32_t); + + if (out_buf == NULL) { + out_buf_size = message_header_size + index_size + raw_msg_size; + out_buf = malloc((size_t)out_buf_size); + } else if (out_buf && out_buf_size < message_header_size + raw_msg_size) { + return NULL; + } + + LV2_OSC_Event* write_loc = (LV2_OSC_Event*)(out_buf); + write_loc->argument_count = types_len; + write_loc->data_size = index_size + raw_msg_size; + + // Copy raw message + memcpy(&write_loc->data + index_size, raw_msg, raw_msg_size); + + write_loc->types_offset = index_size + path_size + 1; + const char* const types = lv2_osc_get_types(write_loc); + + // Calculate/Write index + uint32_t args_base_offset = write_loc->types_offset + lv2_osc_string_size(types) - 1; + uint32_t arg_offset = 0; + + for (uint32_t i=0; i < write_loc->argument_count; ++i) { + ((uint32_t*)&write_loc->data)[i] = args_base_offset + arg_offset; + const LV2_OSC_Argument* const arg = (LV2_OSC_Argument*)(&write_loc->data + args_base_offset + arg_offset); + // Special case because size is still big-endian +#ifndef BIG_ENDIAN + if (types[i] == 'b') // special case because size is still big-endian + arg_offset += lv2_osc_swap32(*((int32_t*)arg)); + else +#endif + arg_offset += lv2_osc_arg_size(types[i], arg); + } + + /*printf("Index:\n"); + for (uint32_t i=0; i < write_loc->argument_count; ++i) { + printf("%u ", ((uint32_t*)&write_loc->data)[i]); + } + printf("\n"); + + printf("Data:\n"); + for (uint32_t i=0; i < (write_loc->argument_count * 4) + size; ++i) { + printf("%3u", i % 10); + } + printf("\n"); + for (uint32_t i=0; i < (write_loc->argument_count * 4) + size; ++i) { + char c = *(((char*)&write_loc->data) + i); + if (c >= 32 && c <= 126) + printf("%3c", c); + else + printf("%3d", (int)c); + } + printf("\n");*/ + + // Swap to host byte order if necessary +#ifndef BIG_ENDIAN + lv2_osc_message_swap_byte_order(write_loc); +#endif + + printf("Created message:\n"); + lv2_osc_message_print(write_loc); + + return write_loc; +} diff --git a/lv2/lv2plug.in/ns/ext/osc/lv2_osc_print.c b/lv2/lv2plug.in/ns/ext/osc/lv2_osc_print.c new file mode 100644 index 0000000..5282d46 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/osc/lv2_osc_print.c @@ -0,0 +1,66 @@ +/* LV2 OSC Messages Extension - Pretty printing methods + * Copyright (C) 2007-2009 David Robillard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <stdio.h> +#include "lv2_osc_print.h" + +void +lv2_osc_argument_print(char type, const LV2_OSC_Argument* arg) +{ + int32_t blob_size; + + switch (type) { + case 'c': + printf("%c", arg->c); break; + case 'i': + printf("%d", arg->i); break; + case 'f': + printf("%f", arg->f); break; + case 'h': + printf("%ld", arg->h); break; + case 'd': + printf("%f", arg->d); break; + case 's': + printf("\"%s\"", &arg->s); break; + /*case 'S': + printf("\"%s\"", &arg->S); break;*/ + case 'b': + blob_size = *((int32_t*)arg); + printf("{ "); + for (int32_t i=0; i < blob_size; ++i) + printf("%X, ", (&arg->b)[i+4]); + printf(" }"); + break; + default: + printf("?"); + } +} + + +void +lv2_osc_print(const LV2_OSC_Event* msg) +{ + const char* const types = lv2_osc_get_types(msg); + + printf("%s (%s) ", lv2_osc_get_path(msg), types); + for (uint32_t i=0; i < msg->argument_count; ++i) { + lv2_osc_argument_print(types[i], lv2_osc_get_argument(msg, i)); + printf(" "); + } + printf("\n"); +} + diff --git a/lv2/lv2plug.in/ns/ext/osc/lv2_osc_test.c b/lv2/lv2plug.in/ns/ext/osc/lv2_osc_test.c new file mode 100644 index 0000000..3f76d41 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/osc/lv2_osc_test.c @@ -0,0 +1,55 @@ +#include <assert.h> +#include <string.h> +#include <stdio.h> +#include <lo/lo.h> +#include "lv2_osc.h" +#include "lv2_osc_print.h" + +int +main() +{ + lo_message lo_msg = lo_message_new(); + //lo_message_add_symbol(lo_msg, "a_sym"); + lo_message_add_string(lo_msg, "Hello World"); + lo_message_add_char(lo_msg, 'a'); + lo_message_add_int32(lo_msg, 1234); + lo_message_add_float(lo_msg, 0.1234); + lo_message_add_int64(lo_msg, 5678); + lo_message_add_double(lo_msg, 0.5678); + + + /*unsigned char blob_data[] = { 0,1,2,3,4,5,6,7,8,9 }; + lo_blob blob = lo_blob_new(10, blob_data); + lo_message_add_blob(lo_msg, blob);*/ + + /* Leaks like a sieve */ + + size_t raw_msg_size = 0; + void* raw_msg = lo_message_serialise(lo_msg, "/foo/bar", NULL, &raw_msg_size); + + LV2Message* msg = lv2_osc_message_from_raw(0.0, 0, NULL, raw_msg_size, raw_msg); + assert(msg); + + LV2OSCBuffer* buf = lv2_osc_buffer_new(1024); + + int ret = lv2_osc_buffer_append_message(buf, msg); + if (ret) + fprintf(stderr, "Message append failed: %s", strerror(ret)); + + lo_message lo_msg_2 = lo_message_new(); + lo_message_add_string(lo_msg_2, "Another message"); + + raw_msg = lo_message_serialise(lo_msg_2, "/baz", NULL, &raw_msg_size); + + msg = lv2_osc_message_from_raw(0.0, 0, NULL, raw_msg_size, raw_msg); + assert(msg); + + ret = lv2_osc_buffer_append_message(buf, msg); + if (ret) + fprintf(stderr, "Message append failed: %s", strerror(ret)); + + printf("\nBuffer contents:\n\n"); + lv2_osc_buffer_print(buf); + + return 0; +} diff --git a/lv2/lv2plug.in/ns/ext/osc/manifest.ttl b/lv2/lv2plug.in/ns/ext/osc/manifest.ttl new file mode 100644 index 0000000..7209b05 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/osc/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/osc> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 1 ; + rdfs:seeAlso <osc.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/osc/osc-print.h b/lv2/lv2plug.in/ns/ext/osc/osc-print.h new file mode 100644 index 0000000..ceebbf7 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/osc/osc-print.h @@ -0,0 +1,42 @@ +/* LV2 OSC Messages Extension - Pretty printing methods + * Copyright (C) 2007-2009 David Robillard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/** @file + * Helper functions for printing LV2 OSC messages as defined by the + * LV2 OSC extension <http://lv2plug.in/ns/ext/osc>. + */ + +#ifndef LV2_OSC_PRINT_H +#define LV2_OSC_PRINT_H + +#include "lv2/lv2plug.in/ns/ext/osc/osc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void +lv2_osc_argument_print(char type, const LV2_OSC_Argument* arg); + +void +lv2_osc_message_print(const LV2_OSC_Event* msg); + +#ifdef __cplusplus +} +#endif + +#endif /* LV2_OSC_PRINT_H */ diff --git a/lv2/lv2plug.in/ns/ext/osc/osc.h b/lv2/lv2plug.in/ns/ext/osc/osc.h new file mode 100644 index 0000000..05e39cc --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/osc/osc.h @@ -0,0 +1,119 @@ +/* LV2 OSC Messages Extension + * Copyright (C) 2007-2009 David Robillard <http://drobilla.net> + * + * This header is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This header is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef LV2_OSC_H +#define LV2_OSC_H + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** @file + * C header for the LV2 OSC extension <http://lv2plug.in/ns/ext/osc>. + * This extension defines a format for (raw) OSC messages/events. + */ + + +/** Argument (in a message). + * + * The name of the element in this union directly corresponds to the OSC + * type tag character in LV2_Event::types. + */ +typedef union { + /* Standard OSC types */ + int32_t i; /**< 32 bit signed integer */ + float f; /**< 32 bit IEEE-754 floating point number ("float") */ + char s; /**< Standard C, NULL terminated string */ + uint8_t b; /**< Blob (int32 size then size bytes padded to 32 bits) */ + + /* "Nonstandard" OSC types (defined in the OSC standard) */ + int64_t h; /* 64 bit signed integer */ + // t /* OSC-timetag */ + double d; /* 64 bit IEEE 754 floating point number ("double") */ + // S /* Symbol, represented as an OSC-string */ + int32_t c; /* Character, represented as a 32-bit integer */ + // r /* 32 bit RGBA color */ + // m /* 4 byte MIDI message. Bytes from MSB to LSB are: port id, status byte, data1, data2 */ + // T /* True. No bytes are allocated in the argument data. */ + // F /* False. No bytes are allocated in the argument data. */ + // N /* Nil. No bytes are allocated in the argument data. */ + // I /* Infinitum. No bytes are allocated in the argument data. */ + // [ /* The beginning of an array. */ + // ] /* The end of an array. */ +} LV2_OSC_Argument; + + + +/** Message. + * + * This is an OSC message at heart, but with some additional cache information + * to allow fast access to parameters. This is the payload of an LV2_Event, + * time stamp and size (being generic) are in the containing header. + */ +typedef struct { + uint32_t data_size; /**< Total size of data, in bytes */ + uint32_t argument_count; /**< Number of arguments in data */ + uint32_t types_offset; /**< Offset of types string in data */ + + /** Take the address of this member to get a pointer to the remaining data. + * + * Contents are an argument index: + * uint32_t argument_index[argument_count] + * + * followed by a standard OSC message: + * char path[path_length] (padded OSC string) + * char types[argument_count] (padded OSC string) + * void data[data_size] + */ + char data; + +} LV2_OSC_Event; + +LV2_OSC_Event* lv2_osc_event_new(const char* path, const char* types, ...); + +LV2_OSC_Event* lv2_osc_event_from_raw(uint32_t out_buf_size, void* out_buf, + uint32_t raw_msg_size, void* raw_msg); + +static inline uint32_t lv2_osc_get_osc_message_size(const LV2_OSC_Event* msg) + { return (msg->argument_count * sizeof(char) + 1) + msg->data_size; } + +static inline const void* lv2_osc_get_osc_message(const LV2_OSC_Event* msg) + { return (const void*)(&msg->data + (sizeof(uint32_t) * msg->argument_count)); } + +static inline const char* lv2_osc_get_path(const LV2_OSC_Event* msg) + { return (const char*)(&msg->data + (sizeof(uint32_t) * msg->argument_count)); } + +static inline const char* lv2_osc_get_types(const LV2_OSC_Event* msg) + { return (const char*)(&msg->data + msg->types_offset); } + +static inline LV2_OSC_Argument* lv2_osc_get_argument(const LV2_OSC_Event* msg, uint32_t i) + { return (LV2_OSC_Argument*)(&msg->data + ((uint32_t*)&msg->data)[i]); } + +/* +int lv2_osc_buffer_append_message(LV2_Event_Buffer* buf, LV2_Event* msg); +int lv2_osc_buffer_append(LV2_Event_Buffer* buf, double time, const char* path, const char* types, ...); +void lv2_osc_buffer_compact(LV2_Event_Buffer* buf); +*/ + +#ifdef __cplusplus +} +#endif + +#endif /* LV2_OSC_H */ diff --git a/lv2/lv2plug.in/ns/ext/osc/osc.ttl b/lv2/lv2plug.in/ns/ext/osc/osc.ttl new file mode 100644 index 0000000..c83a69d --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/osc/osc.ttl @@ -0,0 +1,39 @@ +# LV2 OSC Messages Extension +# Copyright (C) 2007 David Robillard <d@drobilla.net> +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +@prefix osc: <http://lv2plug.in/ns/ext/osc#> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . + +<http://lv2plug.in/ns/ext/osc> a lv2:Specification ; + doap:license <http://usefulinc.com/doap/licenses/mit> ; + doap:name "LV2 OSC Events" ; + doap:shortdesc "A data type for raw OSC." ; + doap:maintainer [ + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + rdfs:seeAlso <http://drobilla.net/drobilla.xrdf> + ] . diff --git a/lv2/lv2plug.in/ns/ext/osc/waf b/lv2/lv2plug.in/ns/ext/osc/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/osc/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/osc/wscript b/lv2/lv2plug.in/ns/ext/osc/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/osc/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/parameter/ext.pc.in b/lv2/lv2plug.in/ns/ext/parameter/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/parameter/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/parameter/manifest.ttl b/lv2/lv2plug.in/ns/ext/parameter/manifest.ttl new file mode 100644 index 0000000..d7af7ff --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/parameter/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/parameter> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 1 ; + rdfs:seeAlso <parameter.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/parameter/parameter.ttl b/lv2/lv2plug.in/ns/ext/parameter/parameter.ttl new file mode 100644 index 0000000..e43cc48 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/parameter/parameter.ttl @@ -0,0 +1,111 @@ +# LV2 Parameter Extension +# Copyright (C) 2010 David Robillard <d@drobilla.net> +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +@prefix atom: <http://lv2plug.in/ns/ext/atom#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix param: <http://lv2plug.in/ns/ext/parameter#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://lv2plug.in/ns/ext/parameter> + a lv2:Specification ; + doap:name "LV2 Parameter" ; + doap:shortdesc "Dynamic message-controlled LV2 plugin parameters." ; + doap:maintainer [ + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + rdfs:seeAlso <http://drobilla.net/drobilla.rdf> + ] ; + rdfs:comment """ +""" . + + +param:Parameter a rdfs:Class ; a lv2:Resource ; + rdfs:label "Parameter" ; + lv2:documentation """ +<p>A parameter on an LV2 plugin. Parameters can be manipulated to alter +the behaviour or output of a plugin. Unlike lv2:ControlPort:</p> +<ul> +<li>A parameter may have any data type</li> +<li>Parameters can be dynamically added or removed</li> +<li>Parameter values can be manipulated by the plugin</li> +</ul> + +<p>Note that plugins are not required to support this potential functionality, +parameters can be used to provide a basic LADSPA-like set of floating point +parameters in a more extensible manner.</p> + +<p>Parameters are essentially controls that are not 1:1 associated with ports +(manipulation of parameters can be accomplished by e.g. sending messages +to a command port).</p> +""" . + + +param:supportsType a rdf:Property ; + rdfs:domain param:Parameter ; + rdfs:range atom:Atom ; + rdfs:label "supports type" ; + lv2:documentation """ +<p>Indicates that a Parameter has values of a particular type. A Parameter may +support many types. Parameter values are always LV2 Atoms as defined by the <a +href="http://lv2plug.in/ns/ext/atom">LV2 Atom</a> Extension Any type of LV2 +Atom may be used as a parameter value.</p> +""" . + + +param:value a rdf:Property ; + rdfs:domain param:Parameter ; + rdfs:label "value" ; + rdfs:comment """ +Indicates that a Parameter has a certain value. A Parameter has at most +one value at any given time. The type of the value specified must be +one of the types specified by param:supportsType. When used in a plugin +data file this property specifies the default value of a parameter. +""" . + + +param:minimum a rdf:Property ; + rdfs:domain param:Parameter ; + rdfs:label "minimum" ; + rdfs:comment """ +Specifies the minimum value of a Parameter (for Parameters with comparable +types for which this makes sense). The type of the minimum must be one of +the types specified by param:supportsType. The host MAY attempt to set a +parameter to any value (of a legal type), i.e. the plugin MUST NOT assume +attempts to change a parameter are within range and SHOULD clamp accordingly. +""" . + + +param:maximum a rdf:Property ; + rdfs:domain param:Parameter ; + rdfs:label "maximum" ; + rdfs:comment """ +Specifies the maximum value of a Parameter (for Parameters with comparable +types for which this makes sense). The type of the maximum must be one of +the types specified by param:supportsType. The host MAY attempt to set a +parameter to any value (of a legal type), i.e. the plugin MUST NOT assume +attempts to change a parameter are within range and SHOULD clamp accordingly. +""" . + diff --git a/lv2/lv2plug.in/ns/ext/parameter/waf b/lv2/lv2plug.in/ns/ext/parameter/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/parameter/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/parameter/wscript b/lv2/lv2plug.in/ns/ext/parameter/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/parameter/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/port-groups/ext.pc.in b/lv2/lv2plug.in/ns/ext/port-groups/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/port-groups/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/port-groups/manifest.ttl b/lv2/lv2plug.in/ns/ext/port-groups/manifest.ttl new file mode 100644 index 0000000..ff4205b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/port-groups/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/port-groups> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 1 ; + rdfs:seeAlso <port-groups.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/port-groups/port-groups.ttl b/lv2/lv2plug.in/ns/ext/port-groups/port-groups.ttl new file mode 100644 index 0000000..edf5359 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/port-groups/port-groups.ttl @@ -0,0 +1,490 @@ +# LV2 Port Groups Extension +# Copyright 2009-2011 David Robillard <d@drobilla.net> +# Copyright 2008-2009 Lars Luthman <lars.luthman@gmail.com> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix pg: <http://lv2plug.in/ns/ext/port-groups#> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix amb: <http://ambisonics.ch/standards/channels/> . + +<http://lv2plug.in/ns/ext/port-groups> a lv2:Specification ; + doap:license <http://opensource.org/licenses/isc> ; + doap:name "LV2 Port Groups" ; + doap:shortdesc "Multi-channel groups of LV2 ports." ; + rdfs:comment "Defines semantic groupings of LV2 ports" ; + doap:maintainer [ + a foaf:Person ; + foaf:name "Lars Luthman" ; + foaf:mbox <mailto:lars.luthman@gmail.com> + ] , [ + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + rdfs:seeAlso <http://drobilla.net/drobilla.rdf> + ] . + + +## Core Classes / Properties + +pg:Group a rdfs:Class ; + rdfs:label "LV2 Port Group" ; + rdfs:subClassOf [ a owl:Restriction ; + owl:onProperty lv2:symbol ; + owl:someValuesFrom xsd:string ; + owl:cardinality 1 ; + rdfs:comment """ +A pg:Group MUST have exactly one string lv2:symbol. This symbol must be +unique according to the same rules as the lv2:symbol for an lv2:Port, where +group symbols and port symbols reside in the same namespace. In other words, +a group on a plugin MUST NOT have the same symbol as another group or a port +on that plugin. Rationale: Hosts or bindings may find it useful to construct +an identifier to refer to groups for the same reasons this is useful for ports. +""" + ] ; + rdfs:subClassOf [ a owl:Restriction ; + owl:onProperty pg:hasRole ; + owl:someValuesFrom pg:RoleAssignment ; + owl:minCardinality 1 ; + rdfs:comment "A Group MUST have at least one role assignment" + ] ; + rdfs:comment """ +A grouping of ports that can be logically considered a single "stream", e.g. +two audio ports in a group may form a stereo stream. The pg:source predicate +can also be used to describe this correspondence between separate ports/groups. +""" . + +pg:index a rdf:Property ; + rdfs:domain pg:RoleAssignment ; + rdfs:range xsd:nonNegativeInteger ; + rdfs:label "index" ; + rdfs:comment "Index of a role within some group" . + +pg:RoleAssignment a rdfs:Class ; + rdfs:label "Role Assignment" ; + rdfs:comment "A numbered role within some Group." ; + rdfs:subClassOf [ a owl:Restriction ; + owl:onProperty pg:index ; + owl:cardinality 1 ; + rdfs:comment """ +A RoleAssignment MUST have exactly one index. +""" ] ; + rdfs:subClassOf [ a owl:Restriction ; + owl:onProperty pg:role ; + owl:cardinality 1 ; + rdfs:comment """ +A RoleAssignment MUST have exactly one role. +""" ] ; + rdfs:comment """ +All group definitions MUST define the order of channels. Note that this +does not have anything to do with port indices, this information is only +defined here for use by other extensions. For simply assigning groups +and roles to a basic LV2 plugin, index is irrelevant. +""" . + +pg:hasRole a rdf:Property ; + rdfs:domain pg:Group ; + rdfs:range pg:Role ; + rdfs:label "Has port with role" ; + rdfs:comment """ +Indicates that a group always has a port with a particular role. +""" . + +pg:mayHaveRole a rdf:Property ; + rdfs:domain pg:Group ; + rdfs:range pg:Role ; + rdfs:label "May have port with role" ; + rdfs:comment """ +Indicates that a group may have a port with a particular role. +""" . + +pg:sideChainOf a rdf:Property ; + rdfs:domain pg:Group , lv2:Port ; + rdfs:range pg:Group , lv2:Port ; + rdfs:label "Side-chain of" ; + rdfs:comment """ +Indicates that this port or group should be considered a "side chain" of +some other port or group. The precise definition of "side chain" depends +on the plugin, but in general this group should be considered a modifier to +some other group, rather than an independent input itself. +""" . + +pg:subGroupOf a rdf:Property ; + rdfs:domain pg:Group ; + rdfs:range pg:Group ; + rdfs:label "Sub-group of" ; + rdfs:comment """ +Indicates that this group is a child of another group. This property has +no meaning with respect to plugin execution, but the host may find this +information useful (e.g. to provide a compact user interface). Note that +all groups on a plugin MUST have a unique symbol with respect to the plugin +as documented for pg:Group, i.e. sub-groups must have a unique symbol among +all groups and ports on the plugin. +""" . + +pg:source a rdf:Property ; + rdfs:domain pg:Group , lv2:Port ; + rdfs:range pg:Group , lv2:Port ; + rdfs:label "Source group" ; + rdfs:comment """ +Indicates that this port or group should be considered the "result" of +some other port or group. This property only makes sense on groups with +outputs when the source is a group with inputs. This can be used to convey +a relationship between corresponding input and output groups with different +types, e.g. a mono->stereo plugin. +""" . + +pg:mainGroup a rdf:Property ; + rdfs:domain lv2:Plugin ; + rdfs:range pg:Group ; + rdfs:label "Main port group" ; + rdfs:comment """ +Indicates that this group should be considered the "main" inputs/outputs of +the plugin, e.g. it probably makes sense to just connect main groups and set +some controls. A plugin MUST NOT have more than one :mainGroup property. +High-level hosts that simply want to insert an plugin in a given stream +should use this property to determine where the plugin 'fits'. +""" . + +pg:inGroup a rdf:Property ; + rdfs:domain lv2:Port ; + rdfs:range pg:Group ; + rdfs:label "In port group" ; + rdfs:comment """ +Indicates that this port is a part of a group of ports on the plugin. +Ports that have a meaningful "role" that may be useful to hosts SHOULD also +have a :role property, otherwise ports in the group have no meaningful order. +""" . + +pg:Role a rdfs:Class ; + rdfs:label "Port role" ; + rdfs:comment """ +The role of a port with respect to its plugin or group. If the port is a +member of a group (has an :inGroup property) the role is relevant with respect +to that group. Otherwise the role is relevant with respect to the plugin. +""" . + +pg:role a rdf:Property ; + rdfs:range pg:Role ; + rdfs:label "Role" ; + rdfs:comment """ +Indicates that this port has a particular role with respect to its enclosing +plugin or group (whichever is smaller). A port may have several roles if it +makes sense to do so (though some Role or Group definition may forbid this). +""" . + + +# Discrete + +pg:DiscreteGroup a rdfs:Class ; + rdfs:subClassOf pg:Group ; + rdfs:comment """ +"Discrete" channel configurations. These groups are divided into channels +where each represents a particular speaker location. The position of sound +in one of these groups depends on a particular speaker configuration. +""" . + +pg:leftChannel a pg:Role ; rdfs:label "Left" . +pg:rightChannel a pg:Role ; rdfs:label "Right" . +pg:centerChannel a pg:Role ; rdfs:label "Center" . +pg:sideChannel a pg:Role ; rdfs:label "Side" . +pg:centerLeftChannel a pg:Role ; rdfs:label "Center Left" . +pg:centerRightChannel a pg:Role ; rdfs:label "Center Right" . +pg:sideLeftChannel a pg:Role ; rdfs:label "Side Left" . +pg:sideRightChannel a pg:Role ; rdfs:label "Side Right" . +pg:rearLeftChannel a pg:Role ; rdfs:label "Rear Left" . +pg:rearRightChannel a pg:Role ; rdfs:label "Rear Right" . +pg:rearCenterChannel a pg:Role ; rdfs:label "Rear Center" . +pg:lfeChannel a pg:Role ; rdfs:label "Sub (LFE)" . + +pg:MonoGroup a rdfs:Class ; + rdfs:subClassOf pg:DiscreteGroup ; + rdfs:label "Mono" ; + pg:hasRole [ pg:index 0; pg:role pg:centerChannel ] . + +pg:StereoGroup a rdfs:Class ; + rdfs:subClassOf pg:DiscreteGroup ; + rdfs:label "Stereo" ; + pg:hasRole [ pg:index 0; pg:role pg:leftChannel ] ; + pg:hasRole [ pg:index 1; pg:role pg:rightChannel ] . + +pg:MidSideGroup a rdfs:Class ; + rdfs:subClassOf pg:DiscreteGroup ; + rdfs:label "Mid-Side Stereo" ; + pg:hasRole [ pg:index 0; pg:role pg:centerChannel ] ; + pg:hasRole [ pg:index 1; pg:role pg:sideChannel ] . + +pg:ThreePointZeroGroup a rdfs:Class ; + rdfs:subClassOf pg:DiscreteGroup ; + rdfs:label "3.0 Surround" ; + pg:hasRole [ pg:index 0; pg:role pg:leftChannel ] ; + pg:hasRole [ pg:index 1; pg:role pg:rightChannel ] ; + pg:hasRole [ pg:index 2; pg:role pg:rearCenterChannel ] . + +pg:FourPointZeroGroup a rdfs:Class ; + rdfs:subClassOf pg:DiscreteGroup ; + rdfs:label "4.0 Surround (Quadraphonic)" ; + pg:hasRole [ pg:index 0; pg:role pg:leftChannel ] ; + pg:hasRole [ pg:index 1; pg:role pg:centerChannel ] ; + pg:hasRole [ pg:index 2; pg:role pg:rightChannel ] ; + pg:hasRole [ pg:index 3; pg:role pg:rearCenterChannel ] . + +pg:FivePointZeroGroup a rdfs:Class ; + rdfs:subClassOf pg:DiscreteGroup ; + rdfs:label "5.0 Surround (3-2 stereo)" ; + pg:hasRole [ pg:index 0; pg:role pg:leftChannel ] ; + pg:hasRole [ pg:index 1; pg:role pg:centerChannel ] ; + pg:hasRole [ pg:index 2; pg:role pg:rightChannel ] ; + pg:hasRole [ pg:index 3; pg:role pg:rearLeftChannel ] ; + pg:hasRole [ pg:index 4; pg:role pg:rearRightChannel ] . + +pg:FivePointOneGroup a rdfs:Class ; + rdfs:subClassOf pg:DiscreteGroup ; + rdfs:label "5.1 Surround (3-2 stereo)" ; + pg:hasRole [ pg:index 0; pg:role pg:leftChannel ] ; + pg:hasRole [ pg:index 1; pg:role pg:centerChannel ] ; + pg:hasRole [ pg:index 2; pg:role pg:rightChannel ] ; + pg:hasRole [ pg:index 3; pg:role pg:rearLeftChannel ] ; + pg:hasRole [ pg:index 4; pg:role pg:rearRightChannel ] ; + pg:hasRole [ pg:index 5; pg:role pg:lfeChannel ] . + +pg:SixPointOneGroup a rdfs:Class ; + rdfs:subClassOf pg:DiscreteGroup ; + rdfs:label "6.1 Surround" ; + pg:hasRole [ pg:index 0; pg:role pg:leftChannel ] ; + pg:hasRole [ pg:index 1; pg:role pg:centerChannel ] ; + pg:hasRole [ pg:index 2; pg:role pg:rightChannel ] ; + pg:hasRole [ pg:index 3; pg:role pg:sideLeftChannel ] ; + pg:hasRole [ pg:index 4; pg:role pg:sideRightChannel ] ; + pg:hasRole [ pg:index 5; pg:role pg:rearCenterChannel ] ; + pg:hasRole [ pg:index 6; pg:role pg:lfeChannel ] . + +pg:SevenPointOneGroup a rdfs:Class ; + rdfs:subClassOf pg:DiscreteGroup ; + rdfs:label "7.1 Surround" ; + pg:hasRole [ pg:index 0; pg:role pg:leftChannel ] ; + pg:hasRole [ pg:index 1; pg:role pg:centerChannel ] ; + pg:hasRole [ pg:index 2; pg:role pg:rightChannel ] ; + pg:hasRole [ pg:index 3; pg:role pg:sideLeftChannel ] ; + pg:hasRole [ pg:index 4; pg:role pg:sideRightChannel ] ; + pg:hasRole [ pg:index 5; pg:role pg:rearLeftChannel ] ; + pg:hasRole [ pg:index 6; pg:role pg:rearRightChannel ] ; + pg:hasRole [ pg:index 7; pg:role pg:lfeChannel ] . + +pg:SevenPointOneWideGroup a rdfs:Class ; + rdfs:subClassOf pg:DiscreteGroup ; + rdfs:label "7.1 Surround (Wide)" ; + pg:hasRole [ pg:index 0; pg:role pg:leftChannel ] ; + pg:hasRole [ pg:index 1; pg:role pg:centerLeftChannel ] ; + pg:hasRole [ pg:index 2; pg:role pg:centerChannel ] ; + pg:hasRole [ pg:index 3; pg:role pg:centerRightChannel ] ; + pg:hasRole [ pg:index 4; pg:role pg:rightChannel ] ; + pg:hasRole [ pg:index 5; pg:role pg:rearLeftChannel ] ; + pg:hasRole [ pg:index 6; pg:role pg:rearRightChannel ] ; + pg:hasRole [ pg:index 7; pg:role pg:lfeChannel ] . + + +# Ambisonic + +pg:AmbisonicGroup a rdfs:Class ; + rdfs:subClassOf pg:Group ; + rdfs:comment """ +"Ambisonic" channel configurations. These groups are divided into channels +which together represent a position in an abstract n-dimensional space. +The position of sound in one of these groups does not depend on a particular +speaker configuration; a decoder can be used to convert an ambisonic stream +for any speaker configuration. +""" . + +#amb:ACN0 a pg:Role ; rdfs:label "ACN 0 (W)" . +#amb:ACN1 a pg:Role ; rdfs:label "ACN 1 (Y)" . +#amb:ACN2 a pg:Role ; rdfs:label "ACN 2 (Z)" . +#amb:ACN3 a pg:Role ; rdfs:label "ACN 3 (X)" . +#amb:ACN4 a pg:Role ; rdfs:label "ACN 4 (V)" . +#amb:ACN5 a pg:Role ; rdfs:label "ACN 5 (T)" . +#amb:ACN6 a pg:Role ; rdfs:label "ACN 6 (R)" . +#amb:ACN7 a pg:Role ; rdfs:label "ACN 7 (S)" . +#amb:ACN8 a pg:Role ; rdfs:label "ACN 8 (U)" . +#amb:ACN9 a pg:Role ; rdfs:label "ACN 9 (Q)" . +#amb:ACN10 a pg:Role ; rdfs:label "ACN 10 (O)" . +#amb:ACN11 a pg:Role ; rdfs:label "ACN 11 (M)" . +#amb:ACN12 a pg:Role ; rdfs:label "ACN 12 (K)" . +#amb:ACN13 a pg:Role ; rdfs:label "ACN 13 (L)" . +#amb:ACN14 a pg:Role ; rdfs:label "ACN 14 (N)" . +#amb:ACN15 a pg:Role ; rdfs:label "ACN 15 (P)" . + +pg:AmbisonicBH1P0Group a rdfs:Class ; + rdfs:subClassOf pg:AmbisonicGroup ; + rdfs:label "Ambisonic B stream of horizontal order 1 and peripheral order 0." ; + pg:hasRole [ pg:index 0; pg:role amb:ACN0 ] ; + pg:hasRole [ pg:index 1; pg:role amb:ACN1 ] ; + pg:hasRole [ pg:index 2; pg:role amb:ACN3 ] . + +pg:AmbisonicBH1P1Group a rdfs:Class ; + rdfs:subClassOf pg:AmbisonicGroup ; + rdfs:label "Ambisonic B stream of horizontal order 1 and peripheral order 1." ; + pg:hasRole [ pg:index 0; pg:role amb:ACN0 ] ; + pg:hasRole [ pg:index 1; pg:role amb:ACN1 ] ; + pg:hasRole [ pg:index 2; pg:role amb:ACN2 ] ; + pg:hasRole [ pg:index 3; pg:role amb:ACN3 ] . + +pg:AmbisonicBH2P0Group a rdfs:Class ; + rdfs:subClassOf pg:AmbisonicGroup ; + rdfs:label "Ambisonic B stream of horizontal order 2 and peripheral order 0." ; + pg:hasRole [ pg:index 0; pg:role amb:ACN0 ] ; + pg:hasRole [ pg:index 1; pg:role amb:ACN1 ] ; + pg:hasRole [ pg:index 2; pg:role amb:ACN3 ] ; + pg:hasRole [ pg:index 3; pg:role amb:ACN4 ] ; + pg:hasRole [ pg:index 4; pg:role amb:ACN8 ] . + +pg:AmbisonicBH2P1Group a rdfs:Class ; + rdfs:subClassOf pg:AmbisonicGroup ; + rdfs:label "Ambisonic B stream of horizontal order 2 and peripheral order 1." ; + pg:hasRole [ pg:index 0; pg:role amb:ACN0 ] ; + pg:hasRole [ pg:index 1; pg:role amb:ACN1 ] ; + pg:hasRole [ pg:index 2; pg:role amb:ACN2 ] ; + pg:hasRole [ pg:index 3; pg:role amb:ACN3 ] ; + pg:hasRole [ pg:index 4; pg:role amb:ACN4 ] ; + pg:hasRole [ pg:index 5; pg:role amb:ACN8 ] . + +pg:AmbisonicBH2P2Group a rdfs:Class ; + rdfs:subClassOf pg:AmbisonicGroup ; + rdfs:label "Ambisonic B stream of horizontal order 2 and peripheral order 2." ; + pg:hasRole [ pg:index 0; pg:role amb:ACN0 ] ; + pg:hasRole [ pg:index 1; pg:role amb:ACN1 ] ; + pg:hasRole [ pg:index 2; pg:role amb:ACN2 ] ; + pg:hasRole [ pg:index 3; pg:role amb:ACN3 ] ; + pg:hasRole [ pg:index 4; pg:role amb:ACN4 ] ; + pg:hasRole [ pg:index 5; pg:role amb:ACN5 ] ; + pg:hasRole [ pg:index 6; pg:role amb:ACN6 ] ; + pg:hasRole [ pg:index 7; pg:role amb:ACN7 ] ; + pg:hasRole [ pg:index 8; pg:role amb:ACN8 ] . + +pg:AmbisonicBH3P0Group a rdfs:Class ; + rdfs:subClassOf pg:AmbisonicGroup ; + rdfs:label "Ambisonic B stream of horizontal order 3 and peripheral order 0." ; + pg:hasRole [ pg:index 0; pg:role amb:ACN0 ] ; + pg:hasRole [ pg:index 1; pg:role amb:ACN1 ] ; + pg:hasRole [ pg:index 2; pg:role amb:ACN3 ] ; + pg:hasRole [ pg:index 3; pg:role amb:ACN4 ] ; + pg:hasRole [ pg:index 4; pg:role amb:ACN8 ] ; + pg:hasRole [ pg:index 5; pg:role amb:ACN9 ] ; + pg:hasRole [ pg:index 6; pg:role amb:ACN15 ] . + +pg:AmbisonicBH3P1Group a rdfs:Class ; + rdfs:subClassOf pg:AmbisonicGroup ; + rdfs:label "Ambisonic B stream of horizontal order 3 and peripheral order 1." ; + pg:hasRole [ pg:index 0; pg:role amb:ACN0 ] ; + pg:hasRole [ pg:index 1; pg:role amb:ACN1 ] ; + pg:hasRole [ pg:index 2; pg:role amb:ACN2 ] ; + pg:hasRole [ pg:index 3; pg:role amb:ACN3 ] ; + pg:hasRole [ pg:index 4; pg:role amb:ACN4 ] ; + pg:hasRole [ pg:index 5; pg:role amb:ACN8 ] ; + pg:hasRole [ pg:index 6; pg:role amb:ACN9 ] ; + pg:hasRole [ pg:index 7; pg:role amb:ACN15 ] . + +pg:AmbisonicBH3P2Group a rdfs:Class ; + rdfs:subClassOf pg:AmbisonicGroup ; + rdfs:label "Ambisonic B stream of horizontal order 3 and peripheral order 2." ; + pg:hasRole [ pg:index 0; pg:role amb:ACN0 ] ; + pg:hasRole [ pg:index 1; pg:role amb:ACN1 ] ; + pg:hasRole [ pg:index 2; pg:role amb:ACN2 ] ; + pg:hasRole [ pg:index 3; pg:role amb:ACN3 ] ; + pg:hasRole [ pg:index 4; pg:role amb:ACN4 ] ; + pg:hasRole [ pg:index 5; pg:role amb:ACN5 ] ; + pg:hasRole [ pg:index 6; pg:role amb:ACN6 ] ; + pg:hasRole [ pg:index 7; pg:role amb:ACN7 ] ; + pg:hasRole [ pg:index 8; pg:role amb:ACN8 ] ; + pg:hasRole [ pg:index 9; pg:role amb:ACN9 ] ; + pg:hasRole [ pg:index 10; pg:role amb:ACN15 ] . + +pg:AmbisonicBH3P3Group a rdfs:Class ; + rdfs:subClassOf pg:AmbisonicGroup ; + rdfs:label "Ambisonic B stream of horizontal order 3 and peripheral order 3." ; + pg:hasRole [ pg:index 0; pg:role amb:ACN0 ] ; + pg:hasRole [ pg:index 1; pg:role amb:ACN1 ] ; + pg:hasRole [ pg:index 2; pg:role amb:ACN2 ] ; + pg:hasRole [ pg:index 3; pg:role amb:ACN3 ] ; + pg:hasRole [ pg:index 4; pg:role amb:ACN4 ] ; + pg:hasRole [ pg:index 5; pg:role amb:ACN5 ] ; + pg:hasRole [ pg:index 6; pg:role amb:ACN6 ] ; + pg:hasRole [ pg:index 7; pg:role amb:ACN7 ] ; + pg:hasRole [ pg:index 8; pg:role amb:ACN8 ] ; + pg:hasRole [ pg:index 9; pg:role amb:ACN9 ] ; + pg:hasRole [ pg:index 10; pg:role amb:ACN10 ] ; + pg:hasRole [ pg:index 11; pg:role amb:ACN11 ] ; + pg:hasRole [ pg:index 12; pg:role amb:ACN12 ] ; + pg:hasRole [ pg:index 13; pg:role amb:ACN13 ] ; + pg:hasRole [ pg:index 14; pg:role amb:ACN14 ] ; + pg:hasRole [ pg:index 15; pg:role amb:ACN15 ] . + + +# Controls + +pg:ControlGroup a rdfs:Class ; + rdfs:subClassOf pg:Group ; + rdfs:comment """ +A group representing a set of associated controls. +""" . + +pg:amplitude a pg:Role ; rdfs:label "Amplitude" . +pg:attack a pg:Role ; rdfs:label "Attack" . +pg:cutoffFrequency a pg:Role ; rdfs:label "Cutoff Frequency" . +pg:decay a pg:Role ; rdfs:label "Decay" . +pg:delay a pg:Role ; rdfs:label "Delay" . +pg:frequency a pg:Role ; rdfs:label "Frequency" . +pg:hold a pg:Role ; rdfs:label "Hold" . +pg:pulseWidth a pg:Role ; rdfs:label "Pulse Width" . +pg:ratio a pg:Role ; rdfs:label "Ratio" . +pg:release a pg:Role ; rdfs:label "Release" . +pg:resonance a pg:Role ; rdfs:label "Resonance" . +pg:sustain a pg:Role ; rdfs:label "Sustain" . +pg:threshold a pg:Role ; rdfs:label "Threshold" . +pg:waveform a pg:Role ; rdfs:label "Waveform" . + +pg:EnvelopeControlGroup a rdfs:Class ; + rdfs:subClassOf pg:ControlGroup ; + rdfs:label "Controls for a DAHDSR envelope." ; + pg:mayHaveRole pg:delay ; + pg:mayHaveRole pg:attack ; + pg:mayHaveRole pg:hold ; + pg:mayHaveRole pg:decay ; + pg:mayHaveRole pg:sustain ; + pg:mayHaveRole pg:release . + +pg:OscillatorControlGroup a rdfs:Class ; + rdfs:subClassOf pg:ControlGroup ; + rdfs:label "Controls for an oscillator." ; + pg:mayHaveRole pg:frequency ; + pg:mayHaveRole pg:amplitude ; + pg:mayHaveRole pg:waveform ; + pg:mayHaveRole pg:pulseWidth . + +pg:FilterControlGroup a rdfs:Class ; + rdfs:subClassOf pg:ControlGroup ; + rdfs:label "Controls for a filter." ; + pg:mayHaveRole pg:cutoffFrequency ; + pg:mayHaveRole pg:resonance . + +pg:CompressorControlGroup a rdfs:Class ; + rdfs:subClassOf pg:ControlGroup ; + rdfs:label "Controls for a compressor." ; + pg:mayHaveRole pg:threshold ; + pg:mayHaveRole pg:ratio . + diff --git a/lv2/lv2plug.in/ns/ext/port-groups/waf b/lv2/lv2plug.in/ns/ext/port-groups/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/port-groups/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/port-groups/wscript b/lv2/lv2plug.in/ns/ext/port-groups/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/port-groups/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/port-props/ext.pc.in b/lv2/lv2plug.in/ns/ext/port-props/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/port-props/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/port-props/manifest.ttl b/lv2/lv2plug.in/ns/ext/port-props/manifest.ttl new file mode 100644 index 0000000..b4afe2f --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/port-props/manifest.ttl @@ -0,0 +1,8 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/port-props> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 1 ; + rdfs:seeAlso <port-props.ttl> . diff --git a/lv2/lv2plug.in/ns/ext/port-props/port-props.ttl b/lv2/lv2plug.in/ns/ext/port-props/port-props.ttl new file mode 100644 index 0000000..d811959 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/port-props/port-props.ttl @@ -0,0 +1,217 @@ +@prefix pprops: <http://lv2plug.in/ns/ext/port-props#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://lv2plug.in/ns/ext/port-props> + a lv2:Specification ; + doap:name "LV2 Port Properties" ; + doap:release [ + doap:revision "0.1" ; + doap:created "2011-11-01" + ] ; + doap:created "2009-01-01" ; + doap:shortdesc "Additional properties for LV2 plugin ports." ; + doap:maintainer [ + a foaf:Person ; + foaf:name "Krzysztof Foltman" + ] , [ + a foaf:Person ; + foaf:name "David Robillard" ; + rdfs:seeAlso <http://drobilla.net/drobilla.rdf> + ] ; + lv2:documentation """ +<p>This extension defines several useful properties for LV2 plugin ports, which +can be used in plugin descriptions to better describe ports. Using this +metadata, hosts can build better UIs for plugins, and provide more advanced +automatic functionality.</p> +""" . + +pprops:trigger + a lv2:PortProperty ; + rdfs:label "Trigger" ; + rdfs:comment """ +Indicates that the data item corresponds to a momentary event that has been +detected (control output ports) or is to be triggered (control input ports). +For input ports, the port needs to be reset to lv2:default value after run() +function of the plugin has returned. If the control port is assigned a GUI +widget by the host, the widget should be of auto-off (momentary, one-shot) type +- for example, a push button if the port is also declared as lv2:toggled, or a +series of push button or auto-clear input box with a "Send" button if the port +is also lv2:integer. +""" . + +pprops:supportsStrictBounds + a lv2:Feature ; + rdfs:label "Supports strict bounds" ; + rdfs:comment """ +Indicates use of host support for pprops:hasStrictBounds port property. A +plugin that specifies it as optional feature can omit value clamping for +hasStrictBounds ports, if the feature is supported by the host. When specified +as required feature, it indicates that the plugin does not do any clamping for +input ports that have a pprops:hasStrictBounds property. +""" . + +pprops:hasStrictBounds + a lv2:PortProperty ; + rdfs:label "Has strict bounds" ; + rdfs:comment """ +For hosts that support pprops:supportsStrictBounds, this indicates that the +value of the port should never exceed the port's minimum and maximum control +points. For input ports, it moves the responsibility for limiting the range of +values to host, if it supports pprops:supportsStrictBounds. For output ports, +it indicates that values within specified range are to be expected, and +breaking that should be considered by the host as error in plugin +implementation. +""" . + +pprops:expensive + a lv2:PortProperty ; + rdfs:label "Changes trigger expensive calculation" ; + rdfs:comment """ +Input ports only. Indicates that any changes to the port value may trigger +expensive background calculation (e.g. regenerate some lookup tables in a +background thread). Any value changes may have not have immediate effect, or +may cause silence or diminished-quality version of the output until background +processing is finished. Ports having this property are typically not well +suited for connection to outputs of other plugins, and should not be offered as +connection targets or for automation by default. +""" . + +pprops:causesArtifacts + a lv2:PortProperty ; + rdfs:label "May cause audio artifacts when changed" ; + rdfs:comment """ +Input ports only. Indicates that any changes to the port value may produce +slight artifacts to produced audio signals (zipper noise and other results of +signal discontinuities). Connecting ports of this type to continuous signals +is not recommended, and when presenting a list of automation targets, those +ports may be marked as artifact-producing. +""" . + +pprops:continuousCV + a lv2:PortProperty ; + rdfs:label "Carries a smooth modulation signal" ; + rdfs:comment """ +Indicates that the port carries a "smooth" modulation signal. Control input +ports of this type are well-suited for being connected to sources of smooth +signals (knobs with smoothing, modulation rate oscillators, output ports with +continuousCV type, etc.). Typically, the plugin with ports which have this +property will implement appropriate smoothing to avoid audio artifacts. For +output ports, this property suggests the value of the port is likely to change +frequently, and describes a smooth signal (e.g. successive values may be +considered points along a curve). +""" . + +pprops:discreteCV + a lv2:PortProperty ; + rdfs:label "Carries a discrete modulation signal" ; + rdfs:comment """ +Indicates that the port carries a "discrete" modulation signal. Input ports of +this type are well-suited for being connected to sources of discrete signals +(switches, buttons, classifiers, event detectors, etc.). May be combined with +pprops:trigger property. For output ports, this property suggests the value of +the port describe discrete values that should be interpreted as steps (and not +points along a curve). +""" . + +pprops:reportsBpm + a lv2:PortProperty ; + rdfs:label "Carries the current tempo expressed in BPM" ; + rdfs:comment """ +Indicates that the port is used to pass the current tempo in context of the +plugin (which may be current song tempo, or tempo of a particular subset of the +song, or the subgraph the plugin resides in). For input ports, the host may +automatically feed the port with current tempo and hide the port from the user, +unless the user or other factors encourage different behaviour. +""" . + +pprops:reportsBeatsPerBar + a lv2:PortProperty ; + rdfs:label "Carries the current number of beats in a bar" ; + rdfs:comment """ +Indicates that the port may be used to pass the current number of beats in a +bar. """ . + +pprops:reportsBeatUnit + a lv2:PortProperty ; + rdfs:label "Carries the current beat size" ; + rdfs:comment """ +Indicates that the port may be used to pass the current size of a beat (4 for a +crochet/quarter note, 8 for a quaver/eighth note, etc.). +""" . + +pprops:logarithmic + a lv2:PortProperty ; + rdfs:label "Port value uses a logarithmic scale" ; + rdfs:comment """ +Indicates that port value behaviour within specified range (bounds) is a value +using logarithmic scale. The lower and upper bounds must be specified, and +must be of the same sign. +""" . + +pprops:notAutomatic + a lv2:PortProperty ; + rdfs:label "Port is not intended as a CV input" ; + rdfs:comment """ +Indicates that the port is not primarily intended to be fed with modulation +signals from external sources (other plugins, etc.). It is merely a UI hint +and hosts may allow the user to override it. +""" . + +pprops:notOnGUI + a lv2:PortProperty ; + rdfs:label "Port is not to be displayed on a GUI or equivalent" ; + rdfs:comment """ +Indicates that the port is not primarily intended to be represented by a +separate control in the user interface window (or any similar mechanism used +for direct, immediate control of control ports). It is merely a UI hint and +hosts may allow the user to override it. +""" . + +pprops:priority + a rdf:Property ; + rdfs:domain lv2:Port ; + rdfs:range xsd:float ; + rdfs:label "Relative usefulness of a port" ; + rdfs:comment """ +Indicates how (typically) useful is the port comparing to other ports with that +property (higher value = more important). The values do not need to be unique, +and ports can be grouped based on their priorities. +""" . + +pprops:rangeSteps + a rdf:Property ; + rdfs:domain lv2:Port ; + rdfs:range xsd:nonNegativeInteger ; + rdfs:label "Number of value quantization steps" ; + lv2:documentation """ +<p>This value indicates into how many evenly-divided points the (control) port +range shoujld be divided for step-wise control. This may be used for changing +the value with step-based controllers like arrow keys, mouse wheel, rotary +encoders, etc.</p> + +<p>Note that when used with a pprops:logarithmic port, the steps are +logarithmic too, and port value can be calculated as:</p> + +<pre class="c-code"> +value = lower * pow(upper / lower, step / (steps - 1)) +</pre> + +<p>and the step from value is:</p> + +<pre class="c-code"> +step = (steps - 1) * log(value / lower) / log(upper / lower) +</pre> + +<p>where:</p> +<ul> +<li><code>value</code> is the port value</li> +<li><code>step</code> is the step number (0..steps)</li> +<li><code>steps</code> is the number of steps (= value of :rangeSteps property)</li> +<li><code>lower</code> and <code>upper</code> are the bounds</li> +</ul> +""" . diff --git a/lv2/lv2plug.in/ns/ext/port-props/waf b/lv2/lv2plug.in/ns/ext/port-props/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/port-props/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/port-props/wscript b/lv2/lv2plug.in/ns/ext/port-props/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/port-props/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/presets/ext.pc.in b/lv2/lv2plug.in/ns/ext/presets/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/presets/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/presets/manifest.ttl b/lv2/lv2plug.in/ns/ext/presets/manifest.ttl new file mode 100644 index 0000000..51985ab --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/presets/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/presets> + a lv2:Specification ; + lv2:minorVersion 2 ; + lv2:microVersion 2 ; + rdfs:seeAlso <presets.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/presets/presets.ttl b/lv2/lv2plug.in/ns/ext/presets/presets.ttl new file mode 100644 index 0000000..e11210a --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/presets/presets.ttl @@ -0,0 +1,148 @@ +# LV2 Presets Extension +# Copyright 2009-2011 David Robillard <d@drobilla.net> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix dcs: <http://ontologi.es/doap-changeset#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix pset: <http://lv2plug.in/ns/ext/presets#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://drobilla.net/drobilla#me> + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + foaf:mbox <mailto:d@drobilla.net> ; + rdfs:seeAlso <http://drobilla.net/drobilla> . + +<http://lv2plug.in/ns/ext/presets> + a lv2:Specification ; + doap:license <http://opensource.org/licenses/isc> ; + doap:name "LV2 Presets" ; + doap:shortdesc "Presets for LV2 plugins. " ; + doap:maintainer <http://drobilla.net/drobilla#me> ; + doap:release [ + doap:revision "2.2" ; + doap:created "2011-11-21" ; + doap:file-release <http://lv2plug.in/spec/lv2-presets-2.2.tar.bz2> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Update packaging." + ] , [ + rdfs:label "Improve documentation." + ] + ] + ] , [ + doap:revision "2.0" ; + doap:created "2010-10-04" ; + doap:file-release <http://lv2plug.in/spec/lv2-presets-2.0.tar.gz> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Initial release." + ] + ] + ] ; + lv2:documentation """ +<p>This extension describes a format for presets (i.e. named sets of control +values) for LV2 plugins. The structure of pset:Preset is deliberately very +similar to the description of a plugin and can be thought of as a plugin +<q>overlay</q>. For example:</p> + +<pre class="turtle-code"> +@prefix eg: <http://example.org/> . + +eg:mypreset + a pset:Preset ; + rdfs:label "One louder" ; + pset:appliesTo eg:myplugin ; + lv2:port [ + lv2:symbol "volume1" ; + pset:value 11 + ] , [ + lv2:symbol "volume2" ; + pset:value 11.0 + ] . +</pre> + +<p>Presets may be defined in any bundles, including the plugin's bundle, +separate third party preset bundles, or user-created preset bundles created by +hosts. The manifest.ttl of a bundle containing presets should list the +presets like so:</p> + +<pre class="turtle-code"> +eg:mypreset + a pset:Preset ; + pset:appliesTo eg:myplugin ; + rdfs:seeAlso <mypreset.ttl> . +</pre> + +<p>This extension does not define a dynamic mechanism for changing plugin +presets for plugins that require such a facility, but may be extended to do +so.</p> +""" . + +pset:Preset + a rdfs:Class ; + rdfs:subClassOf lv2:PluginBase ; + rdfs:label "LV2 Preset" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty rdfs:label ; + owl:someValuesFrom xsd:string ; + rdfs:comment "A Preset MUST have at least one string rdfs:label." + ] ; + rdfs:comment """ +A Preset for an LV2 Plugin. A preset can be considered an "overlay" on a +Plugin. Rather than attempting to define all valid predicates for a Preset +(which is not possible since presets may need to specify values for things +defined in other extensions), the presets extension simply provides this +class which can be augmented with any data in the exact same fashion as the +definition of a Plugin. + +A Preset SHOULD have at least one pset:appliesTo property. +Each Port on a Preset MUST have at least a lv2:symbol property and a +pset:value property. +""" . + +pset:appliesTo + a rdf:Property ; + rdfs:domain pset:Preset ; + rdfs:range lv2:Plugin ; + rdfs:label "Applies to" ; + rdfs:comment """ +Specifies the Plugin(s) a Preset may be applied to. When a Preset applies +to a Plugin, that Preset SHOULD have ports for every control port on that +plugin, each of which SHOULD have a pset:value property. If the Preset is +missing ports, or refers to ports which do not exist on the Plugin, then +the host SHOULD apply all the values in the preset that do match the Plugin. + +The Preset MAY have any other values that should be applied to the Plugin +in some way. The host SHOULD simply ignore any values on a Preset it does +not understand. +""" . + +pset:value + a rdf:Property ; + rdfs:domain lv2:Port ; + rdfs:label "Has value" ; + rdfs:comment """ +Specifies the value of a Port on some Preset. This property is used +in a similar way to e.g. lv2:default. +""" . diff --git a/lv2/lv2plug.in/ns/ext/presets/waf b/lv2/lv2plug.in/ns/ext/presets/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/presets/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/presets/wscript b/lv2/lv2plug.in/ns/ext/presets/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/presets/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/pui/ext.pc.in b/lv2/lv2plug.in/ns/ext/pui/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/pui/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/pui/manifest.ttl b/lv2/lv2plug.in/ns/ext/pui/manifest.ttl new file mode 100644 index 0000000..1229118 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/pui/manifest.ttl @@ -0,0 +1,8 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#>. +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. + +<http://lv2plug.in/ns/ext/pui> + a lv2:Specification; + lv2:minorVersion 0; + lv2:microVersion 1; + rdfs:seeAlso <pui.ttl>. diff --git a/lv2/lv2plug.in/ns/ext/pui/pui.h b/lv2/lv2plug.in/ns/ext/pui/pui.h new file mode 100644 index 0000000..caa7deb --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/pui/pui.h @@ -0,0 +1,374 @@ +/************************************************************************ + * + * Plugin UI extension for LV2 + * + * Copyright (C) 2006-2011 Lars Luthman <mail@larsluthman.net> + * + * Based on lv2.h, which was + * + * Copyright (C) 2000-2002 Richard W.E. Furse, Paul Barton-Davis, + * Stefan Westerfeld + * Copyright (C) 2006 Steve Harris, David Robillard. + * + * This header is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; either version 2.1 of the License, + * or (at your option) any later version. + * + * This header is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + * USA. + * + ***********************************************************************/ + +/** + @file pui.h C API for the LV2 UI extension <http://lv2plug.in/ns/ext/pui>. + + This file specifies a C API for communication between an LV2 host and an + LV2 UI. The interface is similar to the one used for actual LV2 plugins. + + The entry point is the function lv2ui_descriptor(). +*/ + +#ifndef LV2_PUI_H +#define LV2_PUI_H + +#include <lv2.h> + +/** The URI of this extension (note this is not the same as the prefix). */ +#define LV2_PUI_URI "http://lv2plug.in/ns/ext/pui" + +/** The numerical ID returned by LV2_PUI_Host_Descriptor::port_index() for + invalid port symbols. */ +#define LV2_PUI_INVALID_PORT_INDEX ((uint32_t)-1) + +/** The full URI for the pui:floatControl PortProtocol. */ +#define LV2_PUI_FLOAT_CONTROL_URI "http://lv2plug.in/ns/ext/pui#floatControl" + +/** The full URI for the pui:floatPeakRMS PortProtocol. */ +#define LV2_PUI_FLOAT_PEAK_RMS_URI "http://lv2plug.in/ns/ext/pui#floatPeakRMS" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + A data type that is used to pass peak and RMS values for a period of + audio data at an input or output port to an UI, using port_event. See the + documentation for pui:floatPeakRMS for details about how and when this + should be done. +*/ +typedef struct _LV2_PUI_Peak_RMS_Data { + + /** + The start of the measurement period. This is just a running counter that + must not be interpreted as any sort of global frame position. It should + only be interpreted relative to the starts of other measurement periods + in port_event() calls to the same plugin instance. + + This counter is allowed to overflow, in which case it should just wrap + around. + */ + uint32_t period_start; + + /** + The size of the measurement period, in the same units as period_start. + */ + uint32_t period_size; + + /** + The peak value for the measurement period. This should be the maximal + value for abs(sample) over all the samples in the period. + */ + float peak; + + /** + The RMS value for the measurement period. This should be the root mean + square value of the samples in the period, equivalent to + sqrt((pow(sample1, 2) + pow(sample2, 2) + ... + pow(sampleN, 2)) / N) + where N is period_size. + */ + float rms; + +} LV2_PUI_Peak_RMS_Data; + +/** + A pointer to a widget or other type of UI. + The actual type is defined by the type of the UI defined in the RDF data. + All the functionality provided by this extension is toolkit independent, the + host only needs to pass the necessary callbacks and display the widget, if + possible. Plugins may have several UIs, in various toolkits. +*/ +typedef void* LV2_PUI_Widget; + +/** + Handle for a particular instance of a UI. + It is valid to compare this to NULL (0 for C++) but otherwise the host MUST + NOT attempt to interpret it. The UI may use it to reference internal + instance data. +*/ +typedef void* LV2_PUI_Handle; + +/** + Handle for host functions and data provided to a UI. + An object of this type is passed to the UI's instantiate() function, and the + UI must in turn pass it as the first parameter to the callbacks in + LV2_PUI_Host_Descriptor. The host may use it to reference internal data, such + as the plugin instance that the UI is associated with. The UI MUST NOT + interpret the value of an LV2_PUI_Host_Handle in any way. +*/ +typedef void* LV2_PUI_Host_Handle; + +/** + Host-provided functions that the UI can use to control the plugin instance. + + A pointer to an object of this type is passed to the lv2ui_descriptor() + function. + + The host MUST provide non-NULL values for all the function pointers. +*/ +typedef struct _LV2_PUI_Host_Descriptor { + + /** + Send data to one of the plugin's input ports. + + The @c buffer parameter MUST point to a block of data @c buffer_size + bytes large. The contents of this buffer and what the host should do + with it depends on the value of the @c port_protocol parameter. + + The @c port_protocol parameter MUST be a numeric ID for a + pui:PortProtocol. Numeric IDs for PortProtocols are retrieved using the + port_protocol_id() function. + + The @c buffer is only valid during the time of this function call, so if + the host wants to keep it for later use it has to copy the contents to an + internal buffer. + + @param host_handle The @c host_handle that was passed to the UI's + instantiate() function. + @param port_index The index of the port that the data should be written + to, as returned by port_index(). + @param buffer_size The size of the data pointed to by @c buffer, in + bytes. + @param port_protocol The numeric ID of the Port Protocol to use, + as returned by port_protocol_id(). + */ + void (*write_port)(LV2_PUI_Host_Handle host_handle, + uint32_t port_index, + uint32_t buffer_size, + uint32_t port_protocol, + void const* buffer); + + /** + Return the numerical index for a port. + This index is used when writing data to ports using write_port() and whe + receiving data using port_event(). If @c port_symbol is not a valid port + symbol for @c plugin the host it MUST return + LV2_PUI_INVALID_PORT_INDEX. For performance reasons it may be a good idea + to cache port indices in the UI at instantiation time. + + @param host_handle The LV2_PUI_Host_Handle that was passed to the UI's + instantiate() function. + @param port_symbol The port's symbol, as defined in the RDF data for + the plugin. + */ + uint32_t (*port_index)(LV2_PUI_Host_Handle host_handle, + char const* port_symbol); + + /** + Subscribe to updates for a port. + This means that the host will call the UI's port_event() function when + the port value changes (as defined by the PortProtocol). + + Calling this function with the same @c port_index and @c port_protocol + as an already active subscription has no effect. + + @param host_handle The @c host_handle that was passed to the UI's + instantiate() function. + @param port_index The index of the port, as returned by port_index(). + @param port_protocol The numeric ID of the PortProtocol, as + returned by port_protocol_id(). + */ + void (*subscribe_to_port)(LV2_PUI_Host_Handle host_handle, + uint32_t port_index, + uint32_t port_protocol, + const LV2_Feature* const* features); + + /** + Unsubscribe from updates for a port. + This means that the host will cease calling calling port_event() when + the port value changes. + + Calling this function with a @c port_index and @c port_protocol that + does not refer to an active port subscription has no effect. + + @param host_handle The @c host_handle that was passed to the UI's + instantiate() function. + @param port_index The index of the port, as returned by port_index(). + @param port_protocol The numeric ID of the PortProtocol, as + returned by port_protocol_id(). + */ + void (*unsubscribe_from_port)(LV2_PUI_Host_Handle host_handle, + uint32_t port_index, + uint32_t port_protocol, + const LV2_Feature* const* features); + + +} LV2_PUI_Host_Descriptor; + +/** + This struct contains the implementation of an UI. A pointer to an + object of this type is returned by the lv2ui_descriptor() function. +*/ +typedef struct _LV2_PUI_Descriptor { + + /** + The URI for this UI (not for the plugin it controls). + */ + char const* URI; + + /** + Create a new UI object and return a handle to it. This function works + similarly to the instantiate() member in LV2_Descriptor. + + @param descriptor The descriptor for the UI to instantiate. + + @param plugin_uri The URI of the plugin that this UI will control. + + @param bundle_path The path to the bundle containing the RDF data that + references this shared object file, with trailing separator (e.g. '/'). + + @param host_descriptor A pointer to an object that contains function + pointers that the UI instance should use to control the plugin + instance. This pointer MUST be valid until cleanup() is called for this + UI instance. + + @param host_handle A handle that the host may use to reference internal + data. It MUST be passed as the first parameter to the function + pointers in @c host_descriptor, and MUST NOT be interpreted in any other + way by the UI. + + @param features A NULL-terminated array of LV2_Feature pointers. The + host must pass all feature URIs that it and the UI supports and any + additional data, just like in the LV2 plugin instantiate() + function. Note that UI features and plugin features are NOT necessarily + the same; @c features will probably not be the same array as the one the + plugin host passes to a plugin. + */ + LV2_PUI_Handle (*instantiate)( + struct _LV2_PUI_Descriptor const* descriptor, + char const* plugin_uri, + char const* bundle_path, + LV2_PUI_Host_Descriptor const* host_descriptor, + LV2_PUI_Host_Handle host_handle, + LV2_Feature const* const* features); + + /** + Return the widget pointer for the UI object. + This MUST return the same value during the entire lifetime of the UI + object. + */ + LV2_PUI_Widget (*get_widget)(LV2_PUI_Handle ui); + + /** + Destroy the UI object and the associated widget. + The host must not try to access the widget after calling this function. + */ + void (*cleanup)(LV2_PUI_Handle ui); + + /** + Notify the UI that something has happened to a subscribed port. + + This is called by the host when something happens at a plugin port that + has been subscribed to using + LV2_PUI_Host_Descriptor::add_port_subscription(). + + The @c buffer is only valid during the time of this function call, so if + the UI wants to keep it for later use it has to copy the contents to an + internal buffer. + + @param ui A handle for the UI object. + @param port_index The index of the port that has changed, as returned by + LV2_PUI_Host_Descriptor::port_index(). + @param buffer_size The size of the data buffer in bytes. + @param port_protocol The format of the data buffer, as returned by + LV2_PUI_Host_Descriptor::port_protocol_id(). + @param buffer A pointer to the data buffer. + */ + void (*port_event)(LV2_PUI_Handle ui, + uint32_t port_index, + uint32_t buffer_size, + uint32_t port_protocol, + void const* buffer); + + /** + Return a data structure associated with an extension URI. + + This facility can be used by extensions to extend the LV2_PUI_Descriptor + API. This function adheres to the same rules as + LV2_Descriptor::extension_data, except it applies to UIs rather than + plugins. + */ + void const* (*extension_data)(char const* uri); + +} LV2_PUI_Descriptor; + +typedef void* LV2_PUI_Lib_Data; + +/** + Descriptor for a plugin UI library. + + Each plugin UI shared library has exactly one of these objects, accessed + via the lv2_pui_lib_descriptor() function in that library. +*/ +typedef struct { + /** + Opaque library data which must be passed as the first parameter to + all the methods of this struct. + */ + LV2_PUI_Lib_Data lib_data; + + void (*cleanup)(LV2_PUI_Lib_Data lib_data); + + /** + Prototype for UI accessor function. + + This function follows the same rules as lv2_descriptor(), except it + applies to UIs rather than plugins. + */ + LV2_PUI_Descriptor const* (*pui_descriptor)(LV2_PUI_Lib_Data lib_data, + uint32_t index); + +} LV2_PUI_Lib_Descriptor; + +/** + Prototype for UI library accessor function. + + This is the entry point for a plugin UI library. Hosts load this symbol + from the library and call this function to obtain a library descriptor which + can be used to access all the UIs contained in this library. The returned + object must not be destroyed (with LV2_PUI_Lib_Descriptor::cleanup()) until + all UIs loaded from that library have been destroyed. +*/ +LV2_PUI_Lib_Descriptor const* lv2_pui_lib_descriptor( + const char* bundle_path, + LV2_Feature const* const* features); + +/** + Type of the lv2_pui_lib_descriptor() function in a UI library. +*/ +typedef LV2_PUI_Lib_Descriptor const* (*LV2_PUI_Lib_Descriptor_Func)( + const char* bundle_path, + LV2_Feature const* const* features); + +#ifdef __cplusplus +} +#endif + +#endif /* LV2_PUI_H */ diff --git a/lv2/lv2plug.in/ns/ext/pui/pui.ttl b/lv2/lv2plug.in/ns/ext/pui/pui.ttl new file mode 100644 index 0000000..d305769 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/pui/pui.ttl @@ -0,0 +1,284 @@ +# LV2 Plugin UI Extension +# Copyright (C) 2010-2011 Lars Luthman <mail@larsluthman.net> +# +# Based on lv2.ttl, which is +# Copyright (C) 2006-2008 Steve Harris, David Robillard +# +# This extension should be considered a replacement for the earlier +# in-process UI extension with the URI <http://lv2plug.in/ns/extensions/ui>. +# Hosts and plugins that used that extension should use this one instead. +# The earlier in-process UI extension is not compatible with LV2 revision 3 +# and later and may break in subtle ways. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#>. +@prefix pui: <http://lv2plug.in/ns/ext/pui#>. +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/pui> + a lv2:Specification ; + doap:license <http://usefulinc.com/doap/licenses/mit> ; + doap:name "LV2 UI" ; + doap:shortdesc "Generic UI interface for LV2 plugins." ; + doap:release [ + doap:revision "0.1" ; + doap:created "2011-03-26" + ] ; + doap:maintainer [ + a foaf:Person ; + foaf:name "Lars Luthman" ; + foaf:mbox <mailto:mail@larsluthman.net> + ] ; + lv2:documentation """ +<p>This extension defines an interface that can be used to create UIs for +plugins. The UIs are code that reside in shared object files in an LV2 +bundle and are referenced in the RDF data using the triples:</p> +<pre class="turtle-code"> +@prefix pui: <http://lv2plug.in/ns/ext/pui#> . + +<http://example.org/my-ui> + a pui:Gtk2UI ; + lv2:appliesTo <http://example.org/my-plugin> ; + pui:binary <my-ui.so> . +</pre> +<p>... where <code>http://example.org/my-plugin</code> is the URI of the plugin, +<code>http://example.org/my-ui</code> is the URI of the plugin UI and +<code>my-ui.so</code> is the relative URI to the shared object file. While it +is possible to have the plugin UI and the plugin in the same shared object file +it is probably a good idea to keep them separate so that hosts that don't want +UIs don't have to load the UI code.</p> + +<p>A UI MUST specify its class in the RDF data and the class MUST be a proper +subclass of pui:UI, in this case pui:Gtk2UI. The class defines what type the +UI is, e.g. what graphics toolkit it uses. There are no UI classes defined in +this extension, those are specified separately (and anyone can define their +own).</p> + +<p>It's entirely possible to have multiple UIs for the same plugin, or to have +the UI for a plugin in a different bundle from the actual plugin - this way +people other than the plugin author can write plugin UIs independently without +editing the original plugin bundle. It is also possible to have one UI that +works with several different plugins.</p> + +<p>UIs should also be written in such a way that the host may load several +instances of an UI, or different UIs, and use them with the same plugin +instance.</p> + +<p>Note that the process that loads the shared object file containing the UI +code and the process that loads the shared object file containing the actual +plugin implementation do not have to be the same. There are many valid reasons +for having the plugin and the UI in different processes, or even on different +machines. This means that you can <strong>not</strong> use singletons and +global variables and expect them to refer to the same objects in the UI and the +actual plugin. The function callback interface defined in the header pui.h is +all you can expect to work.</p> +""" . + +pui:UI + a rdfs:Class ; + rdfs:subClassOf lv2:Feature ; + rdfs:label "UI" ; + lv2:documentation """ +<p>The class which represents an LV2 plugin UI. +</p> + +<p>To be used by a host a UI MUST have at least the following properties:</p> +<ul> +<li>rdf:type (with object a proper subclass of pui:UI)</li> +<li>doap:name (one without language tag)</li> +<li>lv2:binary (with a shared object file as object)</li> +<li>lv2:appliesTo (with a LV2 plugin as object)</li> +</ul> + +<p>The rdf:type of an UI is used by the host to decide whether it supports the +UI and how to handle the LV2_PUI_Widget object that is returned by the UIs +get_widget() function. For example, a type of pui:Gtk2UI might tell the +host that LV2_PUI_Widget is a pointer to an object of a type defined in the +Gtk+ library. No UI types are defined in this extension, that is intentionally +left for other extensions.</p> + +<p>The doap:name property should be at most a few words in length using title +capitalization, e.g. "Flashy Mixer GUI". Use lv2:documentation for more +detailed descriptions.</p> + +<p>UIs may have optional or required features, specified using lv2:optionalFeature +or lv2:requiredFeature. The same rules apply here as for plugins; a host MUST +pass the LV2_Feature objects for all features it supports to the UI's +instantiate() function, a host SHOULD NOT try to instantiate an UI if it +doesn't support all of its required features, and an UI MUST fail to +instantiate if the host doesn't pass all required features to instantiate(). +</p> + +<p>For details about the C API used to load UIs, see the file pui.h. +</p> +""" . + +pui:PortProtocol + a rdfs:Class ; + rdfs:subClassOf lv2:Feature ; + rdfs:label "Port protocol" ; + lv2:documentation """ +<p>A PortProtocol defines a certain way of communicating port data between UI +and plugin. PortProtocols can be specified in additional extensions, and +those extensions MUST specify: +</p> + +<ol> +<li>Which plugin port types the buffer type is valid for</li> +<li>When the host should call port_event() in LV2_PUI_Descriptor</li> +<li>The format of the data in the buffer passed to port_event()</li> +<li>The format of the data in the buffer passed to write_port()</li> +<li>What happens when the UI calls write_port() in LV2_PUI_Host_Descriptor</li> +<li>What data (if any) should be passed in the LV2_Feature data pointer. </li> +</ol> + +<p>For an example, see pui:floatControl or pui:floatPeakRMS. +</p> + +<p>PortProtocol is a subclass of lv2:Feature, so UIs use lv2:optionalFeature and +lv2:requiredFeature to specify which PortProtocols they want to use. +</p> +""" . + +pui:floatControl + a pui:PortProtocol ; + rdfs:label "Floating point value" ; + lv2:documentation """ +<p>The rules (see pui:PortProtocol) for this port protocol are:</p> +<ol> +<li>This PortProtocol is valid for ports with the type lv2:ControlPort.</li> +<li>The host SHOULD call port_event() as soon as possible when the port value + has changed, but the plugin MUST NOT depend on a call for every change or + the timing of the calls. However, the host MUST do the calls in the same + order that the value changes occur in.</li> +<li>The format of the data in the buffer passed to port_event() is a single + float, and the buffer size is sizeof(float).</li> +<li>Same as 3.</li> +<li>The host SHOULD change the port value as soon as possible when write_port() + is called, but the UI MUST NOT depend on a change for every call or the + timing of the changes. However, the host MUST do the changes in the same + order that the function calls occur in.</li> +<li>The data pointer in the LV2_Feature object for this feature should be + NULL.</li> +</ol> +""" . + +pui:floatPeakRMS + a pui:PortProtocol ; + rdfs:label "Peak and RMS for a period of audio data" ; + lv2:documentation """ +<p>This port protocol defines a way for the host to send continuous peak +and RMS measurements of the audio signal at a certain port to the UI. The +intended use is visualisation, e.g. an animated meter widget that shows +the level of the audio input or output.</p> + +<p>A contiguous sequence of audio samples for which a single peak value +and a single RMS value have been computed is called a <em>measurement +period</em>.</p> + +<p>The rules (see pui:PortProtocol) for this port protocol are:</p> +<ol> +<li>This PortProtocol is valid for ports with the type lv2:AudioPort.</li> +<li>The host SHOULD call port_event() at regular intervals. The measurement + periods used for calls to port_event() for the same port SHOULD be + contiguous (i.e. the measurement period for one call should begin right + after the end of the measurement period for the previous call ends) unless + the UI has removed and re-added the port subscription between those calls. + However, UIs MUST NOT depend on either the regularity of the calls or the + contiguity of the measurement periods; hosts may change the call rate + or skip calls for performance or other reasons. Measurement periods for + different calls to port_event() for the same port MUST NOT overlap.</li> +<li>The format of the data in the buffer passed to port_event() is a single + LV2_PUI_Peak_RMS_Data object, and the buffer size is + sizeof(LV2_PUI_Peak_RMS_Data).</li> +<li>The UI MUST NOT call write_port() with the ID for this port protocol as + the port_protocol parameter.</li> +<li>The host MUST ignore any write_port() calls with the ID for this port + protocol as the port_protocol parameter.</li> +<li>The data pointer in the LV2_Feature object for this feature should be + NULL.</li> +</ol> +""" . + +pui:events + a pui:PortProtocol ; + rdfs:label "Event buffer" ; + lv2:documentation """ +<ol> +<li>This PortProtocol is valid for ports with the type ev:EventPort.</li> +<li>The host MUST call port_event() whenever there is an event in an input port + prior to the plugin instance's run() function is called, and whenever there + is an event in an output port after run() has been called. The UI MUST NOT + depend on the timing of the calls. However, the host MUST do the calls in + the same order that the events occur in. The host is allowed and encouraged + to bundle multiple events into a single port_event() call if it improves + performance.</li> +<li>The data buffer passed to port_event() is an LV2_Event_Buffer, as specified + in the Event extension. The stamp_type MUST be ignored. The frames and + subframes fields of every event in the buffer MUST be ignored. Events with + type 0 (reference counted events) MUST be ignored.</li> +<li>The data buffer passed to write_event() is an LV2_Event_Buffer, as + specified in the Event extension. The stamp_type MUST be ignored. The + frames and subframes fields of every event in the buffer MUST be + ignored. The host MUST NOT pass events with type 0 (references) unless the + UI supports the feature "http://lv2plug.in/ns/ext/event".</li> +<li>The host MUST pass all the events in the buffer to the plugin instance's + event port in the same order, but the plugin and the UI MUST NOT depend on + the timing of the events, or on whether they are all sent to the plugin in + the same run() call or distributed over multiple calls.</li> +<li>The data pointer in the LV2_Feature object for this feature should be + NULL.</li> +</ol> +""" . + +pui:Gtk2UI + a rdfs:Class ; + rdfs:subClassOf pui:UI ; + rdfs:label "Gtk+ UI" ; + lv2:documentation """ +<p>The class which represents a Gtk+ UI. For a successfully created instance of +an UI of this class, the get_widget() function MUST return a pointer to a valid +GtkWidget object compatible with Gtk+ version 2.0. The host MUST ensure that +the Gtk+ library has been initialised and that the Glib main loop is running +before an UI of this type is instantiated.</p> + +<p>Unless otherwise specified by extensions, all function pointers in +LV2_PUI_Descriptor may only be called from the thread that runs the Glib main +loop.</p> +""" . + +pui:noHostResize + a lv2:Feature ; + rdfs:label "No host resize" ; + lv2:documentation """ +<p>This Feature should only be used with UIs.</p> + +<p>When this Feature is active the host SHOULD NOT resize the UI widget to any +other size than its natural size, which the host should be able to determine +via the API of whatever toolkit the UI is implemented in. However, the UI MUST +NOT break if the widget is resized to another size. This Feature can be used +for example when the widget uses a fixed-size pixmap interface.</p> + +<p>The data pointer in the LV2_Feature object for this Feature should be set to +NULL.</p> +""" . diff --git a/lv2/lv2plug.in/ns/ext/pui/waf b/lv2/lv2plug.in/ns/ext/pui/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/pui/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/pui/wscript b/lv2/lv2plug.in/ns/ext/pui/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/pui/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/reference/ext.pc.in b/lv2/lv2plug.in/ns/ext/reference/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/reference/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/reference/manifest.ttl b/lv2/lv2plug.in/ns/ext/reference/manifest.ttl new file mode 100644 index 0000000..e25c54d --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/reference/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/reference> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 1 ; + rdfs:seeAlso <reference.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/reference/reference.h b/lv2/lv2plug.in/ns/ext/reference/reference.h new file mode 100644 index 0000000..26ef4c3 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/reference/reference.h @@ -0,0 +1,161 @@ +/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +/** + @file reference.h C header for the LV2 Reference extension + <http://lv2plug.in/ns/ext/reference>. +*/ + +#ifndef LV2_REFERENCE_H +#define LV2_REFERENCE_H + +#define LV2_REFERENCE_URI "http://lv2plug.in/ns/ext/reference" +#define LV2_REFERENCE_BLOB_SUPPORT_URI LV2_REFERENCE_URI "#blobSupport" + +#include <stdint.h> +#include <stddef.h> + +#include "lv2/lv2plug.in/ns/ext/atom/atom.h" + +/** + Dynamically Allocated Data. + + This is an opaque piece of data of any type, dynamically allocated in memory. + Unlike an "atom", a "blob" is not necessarily POD. Non-POD data is referred + to by a "reference (a special case of atom with type 0). + + This is a pointer to host data which is opaque to the plugin. Plugins MUST + NOT interpret this data in any way, except via host-provided functions in + LV2_Blob_Support. +*/ +typedef void* LV2_Blob; + +typedef LV2_Atom LV2_Reference; + +typedef void* LV2_Blob_Support_Data; + +typedef void (*LV2_Blob_Destroy)(LV2_Blob* blob); + +/** + The data field of the LV2_Feature for reference:blobSupport. + + A host which supports blobs must pass an LV2_Feature to the plugin's + instantiate method with 'URI' = "http://lv2plug.in/ns/ext/reference#blobSupport" + and 'data' pointing to an instance of this struct. All fields of this struct + MUST be set to non-NULL values by the host, except possibly 'data'. +*/ +typedef struct { + + /** + Pointer to opaque host data. + + The plugin MUST pass this to any call to functions in this struct. + Otherwise, the plugin MUST NOT interpret this value in any way. + */ + LV2_Blob_Support_Data data; + + /** + The size of a reference, in bytes. + + This value is provided by the host so plugins can allocate large enough + chunks of memory to store references. Note a reference is an LV2_Reference + with type reference:Reference, hence ref_size is a uint16, like + LV2_Reference.size. + */ + uint16_t ref_size; + + /** + Return the Blob referred to by @a ref. + + The returned value MUST NOT be used in any way other than by calling + methods defined in LV2_Blob_Support (e.g. it MUST NOT be directly + accessed, copied, or destroyed). The actual payload of the blob can + be accessed with LV2_Blob_Support.blob_get. + */ + LV2_Blob (*ref_get)(LV2_Blob_Support_Data data, + LV2_Reference* ref); + + /** + Copy a reference. + This copies a reference but not the blob it refers to, + i.e. after this call @a dst and @a src refer to the same LV2_Blob. + */ + void (*ref_copy)(LV2_Blob_Support_Data data, + LV2_Reference* dst, + LV2_Reference* src); + + /** + Reset (release) a reference. + After this call, @a ref is invalid. Implementations must be sure to + call this function when necessary, or memory leaks will result. The + specific times this is necessary MUST be defined by any extensions that + define a mechanism for transporting references. The standard semantics are: + <ul><li>Whenever passed a Reference (e.g. via a Port) and run, the + plugin owns that reference.</li> + <li>The plugin owns any reference it creates (e.g. by using blob_new or + ref_copy).</li> + <li>For any reference it owns, the plugin MUST either: + <ul><li>Copy the reference and store it (to be used in future runs and + released later).</li> + <li>Copy the reference to an output port exactly once.</li> + <li>Release it with ref_reset.</li></ul></li> + </ul> + */ + void (*ref_reset)(LV2_Blob_Support_Data data, + LV2_Reference* ref); + + /** + Initialize a reference to point to a newly allocated Blob. + + @param data Must be the data member of this struct. + @param ref Pointer to an area of memory at least as large as + the ref_size field of this struct. On return, this will + be the unique reference to the new blob, which is owned by the + caller. Assumed to be uninitialised, i.e. the caller MUST NOT + pass a valid reference since this could cause a memory leak. + @param destroy Function to destroy this blob. This function + MUST clean up any resources contained in the blob, but MUST NOT + attempt to free the memory pointed to by its LV2_Blob* parameter + (since this is allocated by the host). + @param type ID of type of blob to allocate. + @param size Size of blob to allocate in bytes. + */ + void (*blob_new)(LV2_Blob_Support_Data data, + LV2_Reference* ref, + LV2_Blob_Destroy destroy, + uint32_t type, + size_t size); + + /** + Get blob's type as an ID. + + The return value may be any type URI, mapped to an integer with the + URI Map extension with <code>context = NULL</code>. + */ + uint32_t (*blob_type)(LV2_Blob blob); + + /** + Get blob's body. + + Returns a pointer to the start of the blob data. The format of this + data is defined by the return value of the type method. It MUST NOT + be used in any way by code which does not understand that type. + */ + void* (*blob_data)(LV2_Blob blob); + +} LV2_Blob_Support; + +#endif /* LV2_REFERENCE_H */ diff --git a/lv2/lv2plug.in/ns/ext/reference/reference.ttl b/lv2/lv2plug.in/ns/ext/reference/reference.ttl new file mode 100644 index 0000000..bbf56d4 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/reference/reference.ttl @@ -0,0 +1,82 @@ +# LV2 Reference Extension +# Copyright 2007-2011 David Robillard <d@drobilla.net> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix atom: <http://lv2plug.in/ns/ext/atom#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix reference: <http://lv2plug.in/ns/ext/reference#> . + +<http://lv2plug.in/ns/ext/reference> + a lv2:Specification ; + doap:name "LV2 Reference" ; + doap:shortdesc "A reference data type for using non-POD data." ; + doap:release [ + doap:revision "0.1" ; + doap:created "2011-07-22" + ] ; + doap:maintainer [ + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + rdfs:seeAlso <http://drobilla.net/drobilla.rdf> + ] ; + lv2:documentation """ +<p>This extension defines a mechanism for working with generic/opaque +dynamically allocated memory, called a <a href="#Blob">"Blob"</a>, which is +(unlike an Atom) not necessarily POD. Blobs are accessed via a +reference:Reference, which is a special case of <a +href="http://lv2plug.in/ns/ext#Atom">Atom</a> that always has <code>type = +0</code>, is not POD, and can only be copied using host provided functions. +This allows plugins and hosts to work with data of any type at all.</p> +""" . + +reference:Reference a rdfs:Class ; + rdfs:subClassOf atom:Atom ; + rdfs:label "Reference" ; + lv2:documentation """ +<p>Reference to an lv2:Blob. The actual contents of a Reference are opaque and +host specific, and must not be copied, serialized, or otherwise interpreted by +a plugin, except via functions provided by the host in LV2_Blob_Support.</p> + +<p>A Reference is a special case of Atom with <code>type = 0</code>. +"Null" is the unique Atom with <code>type = 0</code> and +<code>size = 0</code>.</p> +""" . + +reference:blobSupport a lv2:Feature ; + rdfs:label "Blob support" ; + lv2:documentation """ +<p>Support for dynamically allocated blobs. If a host supports this feature, +it MUST pass a LV2_Feature with <code>URI</code> +http://lv2plug.in/ns/ext/atom#blobSupport and <code>data</code> pointing to a +LV2_Blob_Support.</p> +""" . + +reference:Blob a rdfs:Class ; + rdfs:label "Blob" ; + lv2:documentation """ +<p>Base class for all dynamically allocated blobs. An LV2_Blob is an opaque +pointer to host data. The type and data of a blob can be accessed via +host-provided functions in LV2_Blob_Support. The type of a blob can be any URI +that describes a data format. Blobs are always allocated by the host, and +unlike atoms are not necessarily POD.</p> + +<p>Blob data MUST NOT be used in any way by an implementation that does not +understand that blob type (unlike Atoms, meaningful type-oblivious use +of a Blob is impossible).</p> +""" . diff --git a/lv2/lv2plug.in/ns/ext/reference/waf b/lv2/lv2plug.in/ns/ext/reference/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/reference/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/reference/wscript b/lv2/lv2plug.in/ns/ext/reference/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/reference/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/resize-port/ext.pc.in b/lv2/lv2plug.in/ns/ext/resize-port/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/resize-port/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/resize-port/manifest.ttl b/lv2/lv2plug.in/ns/ext/resize-port/manifest.ttl new file mode 100644 index 0000000..37d1b42 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/resize-port/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/resize-port> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 1 ; + rdfs:seeAlso <resize-port.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/resize-port/resize-port.h b/lv2/lv2plug.in/ns/ext/resize-port/resize-port.h new file mode 100644 index 0000000..7f014a3 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/resize-port/resize-port.h @@ -0,0 +1,57 @@ +/* LV2 Resize Port Extension + * Copyright (C) 2007-2009 David Robillard <http://drobilla.net> + * + * This header is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This header is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef LV2_RESIZE_PORT_H +#define LV2_RESIZE_PORT_H + +#include <stdbool.h> +#include <stddef.h> +#include <stdint.h> + +#define LV2_RESIZE_PORT_URI "http://lv2plug.in/ns/ext/resize-port" + +typedef void* LV2_Resize_Port_Feature_Data; + +typedef struct { + + LV2_Resize_Port_Feature_Data data; + + /** Resize a port buffer to at least @a size bytes. + * + * This function MAY return false, in which case the port buffer was + * not resized and the port is still connected to the same location. + * Plugins MUST gracefully handle this situation. + * + * This function MUST NOT be called from any context other than + * the context associated with the port of the given index. + * + * The host MUST preserve the contents of the port buffer when + * resizing. + * + * Plugins MAY resize a port many times in a single run callback. + * Hosts SHOULD make this an inexpensive as possible (i.e. plugins + * can liberally use this function in a similar way to realloc). + */ + bool (*resize_port)(LV2_Resize_Port_Feature_Data data, + uint32_t index, + size_t size); + +} LV2_Resize_Port_Feature; + +#endif /* LV2_RESIZE_PORT_H */ + diff --git a/lv2/lv2plug.in/ns/ext/resize-port/resize-port.ttl b/lv2/lv2plug.in/ns/ext/resize-port/resize-port.ttl new file mode 100644 index 0000000..a458431 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/resize-port/resize-port.ttl @@ -0,0 +1,80 @@ +# LV2 Contexts Extension +# +# Allows for an LV2 plugin to have several independent contexts, each with its +# own run callback and associated ports. +# +# Copyright (C) 2007 David Robillard +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +@prefix rsz: <http://lv2plug.in/ns/ext/resize-port#> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . + +<http://lv2plug.in/ns/ext/resize-port> + a lv2:Specification ; + a lv2:Feature ; + doap:name "LV2 Resize Port Extension" ; + doap:shortdesc "Dynamically sized LV2 port buffers." ; + lv2:documentation """ +<p>An extension that allows LV2 plugins to request a resize of an output +port.</p> + +<p>Any host which supports this extension must pass an LV2_Feature to the +plugin's instantiate method with URI http://lv2plug.in/ns/ext/resize-port and a +pointer to a LV2_Resize_Port_Feature structure. This structure provides a +resize_port function which plugins may use to resize output port buffers as +necessary.</p> + +<p>This extension also defines several predicates useful for describing the +amount of space required for a particular port buffer.</p> +""" . + +rsz:asLargeAs a rdf:Property ; + rdfs:domain lv2:Port ; + rdfs:range lv2:Symbol ; + rdfs:label "as large as" ; + rdfs:comment """ +Indicates that a port requires at least as much buffer space as the port +with the given symbol on the same plugin instance. This may be used for +any ports, but is generally most useful to indicate an output port must +be at least as large as some input port (because it will copy from it). +If a port is asLargeAs several ports, it is asLargeAs the largest such port +(not the sum of those ports' sizes). + +The host guarantees that whenever an ObjectPort's run method is called, +any output O that is obj:asLargeAs an input I is connected to a buffer large +enough to copy I, or NULL if the port is lv2:connectionOptional. +""" . + +rsz:minimumSize a rdf:Property ; + rdfs:domain lv2:Port ; + rdfs:range lv2:Symbol ; + rdfs:label "minimum size" ; + rdfs:comment """ +Indicates that a port requires a buffer at least this large, in bytes. +Any host that supports the resize-port feature MUST connect any port with a +minimumSize specified to a buffer at least as large as the value given for +this property. Any host, especially those that do NOT support dynamic port +resizing, SHOULD do so or reduced functionality may result. +""" . diff --git a/lv2/lv2plug.in/ns/ext/resize-port/waf b/lv2/lv2plug.in/ns/ext/resize-port/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/resize-port/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/resize-port/wscript b/lv2/lv2plug.in/ns/ext/resize-port/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/resize-port/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/state/ext.pc.in b/lv2/lv2plug.in/ns/ext/state/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/state/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/state/manifest.ttl b/lv2/lv2plug.in/ns/ext/state/manifest.ttl new file mode 100644 index 0000000..bff9ad5 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/state/manifest.ttl @@ -0,0 +1,8 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/state> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 5 ; + rdfs:seeAlso <state.ttl> . diff --git a/lv2/lv2plug.in/ns/ext/state/state.h b/lv2/lv2plug.in/ns/ext/state/state.h new file mode 100644 index 0000000..b450b93 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/state/state.h @@ -0,0 +1,359 @@ +/* + Copyright 2010-2012 David Robillard <http://drobilla.net> + Copyright 2010 Leonard Ritter <paniq@paniq.org> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +/** + @file + C API for the LV2 State extension <http://lv2plug.in/ns/ext/state>. +*/ + +#ifndef LV2_STATE_H +#define LV2_STATE_H + +#include <stddef.h> +#include <stdint.h> + +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" + +#ifdef __cplusplus +extern "C" { +#else +# include <stdbool.h> +#endif + +#define LV2_STATE_URI "http://lv2plug.in/ns/ext/state" + +#define LV2_STATE_INTERFACE_URI LV2_STATE_URI "#Interface" +#define LV2_STATE_PATH_URI LV2_STATE_URI "#Path" +#define LV2_STATE_MAP_PATH_URI LV2_STATE_URI "#mapPath" +#define LV2_STATE_MAKE_PATH_URI LV2_STATE_URI "#makePath" + +typedef void* LV2_State_Handle; +typedef void* LV2_State_Map_Path_Handle; +typedef void* LV2_State_Make_Path_Handle; + +/** + Flags describing value characteristics. + + These flags are used along with the value's type URI to determine how to + (de-)serialise the value data, or whether it is even possible to do so. +*/ +typedef enum { + + /** + Plain Old Data. + + Values with this flag contain no references to non-persistent or + non-global resources (e.g. pointers, handles, local paths, etc.). It is + safe to copy POD values with a simple memcpy and store them for use at + any time in the future on a machine with a compatible architecture + (e.g. the same endianness and alignment). + + Implementations MUST NOT attempt to copy or serialise a non-POD value if + they do not understand its type (and thus know how to correctly do so). + */ + LV2_STATE_IS_POD = 1, + + /** + Portable (architecture independent) data. + + Values with this flag are in a format that is usable on any + architecture, i.e. if the value is saved on one machine it can safely be + restored on another machine regardless of endianness, alignment, etc. + */ + LV2_STATE_IS_PORTABLE = 1 << 1, + + /** + Native data. + + This flag is used by the host to indicate that the saved data is only + going to be used locally in the currently running process (e.g. for + instance duplication or snapshots), so the plugin should use the most + efficient representation possible and not worry about serialisation + and portability. + */ + LV2_STATE_IS_NATIVE = 1 << 2 + +} LV2_State_Flags; + +/** + A host-provided function to store a property. + @param handle Must be the handle passed to LV2_State_Interface.save(). + @param key The key (predicate) to store @c value under (URI mapped integer). + @param value Pointer to the value (object) to be stored. + @param size The size of the data at @c value in bytes. + @param type The type of @c value (URI). + @param flags LV2_State_Flags for @c value. + @return 0 on success, otherwise a non-zero error code. + + The host passes a callback of this type to LV2_State_Interface.save(). This + callback is called repeatedly by the plugin within + LV2_State_Interface.save() to store all the statements that describe its + current state. + + DO NOT INVENT NONSENSE URI SCHEMES FOR THE KEY. Best is to use keys from + existing vocabularies. If nothing appropriate is available, use http URIs + that point to somewhere you can host documents, so you can make + documentation resolvable. If this is not possible, invent a URN scheme, + e.g. urn:myproj:whatever. The plugin MUST NOT pass an invalid URI key. + + The host MAY fail to store a property for whatever reason, but SHOULD + store any property that is LV2_STATE_IS_POD and LV2_STATE_IS_PORTABLE. + Implementations SHOULD use the types from the LV2 Atom extension + (http://lv2plug.in/ns/ext/atom) wherever possible. + + Note that @c size MUST be > 0, and @c value MUST point to a valid region of + memory @c size bytes long (this is required to make restore unambiguous). + + The plugin MUST NOT attempt to use this function outside of the + LV2_State_Interface.restore() context. +*/ +typedef int (*LV2_State_Store_Function)(LV2_State_Handle handle, + uint32_t key, + const void* value, + size_t size, + uint32_t type, + uint32_t flags); + +/** + A host-provided function to retrieve a property. + @param handle Must be the handle passed to + LV2_State_Interface.restore(). + @param key The key (predicate) of the property to retrieve (URI). + @param size (Output) If non-NULL, set to the size of the restored value. + @param type (Output) If non-NULL, set to the type of the restored value. + @param flags (Output) If non-NULL, set to the LV2_State_Flags for + the returned value. + @return A pointer to the restored value (object), or NULL if no value + has been stored under @c key. + + A callback of this type is passed by the host to + LV2_State_Interface.restore(). This callback is called repeatedly by the + plugin within LV2_State_Interface.restore() to retrieve any properties it + requires to restore its state. + + The returned value MUST remain valid until LV2_State_Interface.restore() + returns. + + The plugin MUST NOT attempt to use this function, or any value returned from + it, outside of the LV2_State_Interface.restore() context. Returned values + MAY be copied for later use if necessary, assuming the plugin knows how to + do so correctly (e.g. the value is POD, or the plugin understands the type). +*/ +typedef const void* (*LV2_State_Retrieve_Function)(LV2_State_Handle handle, + uint32_t key, + size_t* size, + uint32_t* type, + uint32_t* flags); + +/** + State Extension Data. + + When the plugin's extension_data is called with argument LV2_STATE_URI, + the plugin MUST return an LV2_State structure, which remains valid for the + lifetime of the plugin. + + The host can use the contained function pointers to save and restore the + state of a plugin instance at any time (provided the threading restrictions + for the given function are met). + + The typical use case is to save the plugin's state when a project is saved, + and to restore the state when a project has been loaded. Other uses are + possible (e.g. cloning plugin instances or taking a snapshot of plugin + state). + + Stored data is only guaranteed to be compatible between instances of plugins + with the same URI (i.e. if a change to a plugin would cause a fatal error + when restoring state saved by a previous version of that plugin, the plugin + URI MUST change just as it must when ports change incompatibly). Plugin + authors should consider this possibility, and always store sensible data + with meaningful types to avoid such compatibility issues in the future. +*/ +typedef struct _LV2_State_Interface { + + /** + Save plugin state using a host-provided @c store callback. + + @param instance The instance handle of the plugin. + @param store The host-provided store callback. + @param handle An opaque pointer to host data, e.g. the map or + file where the values are to be stored. If @c store is called, this MUST + be passed as its handle parameter. + @param flags Flags describing desires properties of this save. The + plugin SHOULD use these values to determine the most appropriate and/or + efficient serialisation, but is not required to do so. + @param features Extensible parameter for passing any additional + features to be used for this save. + + The plugin is expected to store everything necessary to completely + restore its state later (possibly much later, in a different process, on + a completely different machine, etc.) + + The @c handle pointer and @c store function MUST NOT be used + beyond the scope of save(). + + This function has its own special threading class: it may not be called + concurrently with any "Instantiation" function, but it may be called + concurrently with functions in any other class, unless the definition of + that class prohibits it (e.g. it may not be called concurrently with a + "Discovery" function, but it may be called concurrently with an "Audio" + function. The plugin is responsible for any locking or lock-free + techniques necessary to make this possible. + + Note that in the simple case where state is only modified by restore(), + there are no synchronization issues since save() is never called + concurrently with restore() (though run() may read it during a save). + + Plugins that dynamically modify state while running, however, must take + care to do so in such a way that a concurrent call to save() will save a + consistent representation of plugin state for a single instant in time. + */ + void (*save)(LV2_Handle instance, + LV2_State_Store_Function store, + LV2_State_Handle handle, + uint32_t flags, + const LV2_Feature *const * features); + + /** + Restore plugin state using a host-provided @c retrieve callback. + + @param instance The instance handle of the plugin. + @param retrieve The host-provided retrieve callback. + @param handle An opaque pointer to host data, e.g. the map or + file from which the values are to be restored. If @c retrieve is + called, this MUST be passed as its handle parameter. + @param flags Currently unused. + @param features Extensible parameter for passing any additional + features to be used for this restore. + + The plugin MAY assume a restored value was set by a previous call to + LV2_State_Interface.save() by a plugin with the same URI. + + The plugin MUST gracefully fall back to a default value when a value can + not be retrieved. This allows the host to reset the plugin state with an + empty map. + + The @c handle pointer and @c store function MUST NOT be used + beyond the scope of restore(). + + This function is in the "Instantiation" threading class as defined by + LV2. This means it MUST NOT be called concurrently with any other + function on the same plugin instance. + */ + void (*restore)(LV2_Handle instance, + LV2_State_Retrieve_Function retrieve, + LV2_State_Handle handle, + uint32_t flags, + const LV2_Feature *const * features); + +} LV2_State_Interface; + +/** + Feature data for state:mapPath (LV2_STATE_MAP_PATH_URI). +*/ +typedef struct { + + /** + Opaque host data. + */ + LV2_State_Map_Path_Handle handle; + + /** + Map an absolute path to an abstract path for use in plugin state. + @param handle MUST be the @a handle member of this struct. + @param absolute_path The absolute path of a file. + @return An abstract path suitable for use in plugin state. + + The plugin MUST use this function to map any paths that will be stored + in files in plugin state. The returned value is an abstract path which + MAY not be an actual file system path; @ref absolute_path MUST be used + to map it to an actual path in order to use the file. + + Hosts MAY map paths in any way (e.g. by creating symbolic links within + the plugin's state directory or storing a list of referenced files + elsewhere). Plugins MUST NOT make any assumptions about abstract paths + except that they can be mapped back to an absolute path using @ref + absolute_path. + + This function may only be called within the context of + LV2_State_Interface.save() or LV2_State_Interface.restore(). The caller + is responsible for freeing the returned value. + */ + char* (*abstract_path)(LV2_State_Map_Path_Handle handle, + const char* absolute_path); + + /** + Map an abstract path from plugin state to an absolute path. + @param handle MUST be the @a handle member of this struct. + @param abstract_path An abstract path (e.g. a path from plugin state). + @return An absolute file system path. + + Since abstract paths are not necessarily actual file paths (or at least + not necessarily absolute paths), this function MUST be used in order to + actually open or otherwise use the file referred to by an abstract path. + + This function may only be called within the context of + LV2_State_Interface.save() or LV2_State_Interface.restore(). The caller + is responsible for freeing the returned value. + */ + char* (*absolute_path)(LV2_State_Map_Path_Handle handle, + const char* abstract_path); + +} LV2_State_Map_Path; + +/** + Feature data for state:makePath (@ref LV2_STATE_MAKE_PATH_URI). +*/ +typedef struct { + + /** + Opaque host data. + */ + LV2_State_Make_Path_Handle handle; + + /** + Return a path the plugin may use to create a new file. + @param handle MUST be the @a handle member of this struct. + @param path The path of the new file relative to a namespace unique + to this plugin instance. + @return The absolute path to use for the new file. + + This function can be used by plugins to create files and directories, + either at state saving time (if this feature is passed to + LV2_State_Interface.save()) or any time (if this feature is passed to + LV2_Descriptor.instantiate()). + + The host must do whatever is necessary for the plugin to be able to + create a file at the returned path (e.g. using fopen), including + creating any leading directories. + + If this function is passed to LV2_Descriptor.instantiate(), it may be + called from any non-realtime context. If it is passed to + LV2_State_Interface.save(), it may only be called within the dynamic + scope of that function call. + + The caller is responsible for freeing the returned value with free(). + */ + char* (*path)(LV2_State_Make_Path_Handle handle, + const char* path); + +} LV2_State_Make_Path; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV2_STATE_H */ diff --git a/lv2/lv2plug.in/ns/ext/state/state.ttl b/lv2/lv2plug.in/ns/ext/state/state.ttl new file mode 100644 index 0000000..6c0656a --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/state/state.ttl @@ -0,0 +1,359 @@ +# LV2 State Extension +# Copyright 2010-2012 David Robillard <d@drobilla.net> +# Copyright 2010 Leonard Ritter <paniq@paniq.org> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix dcs: <http://ontologi.es/doap-changeset#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix state: <http://lv2plug.in/ns/ext/state#> . + +<http://drobilla.net/drobilla#me> + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + foaf:mbox <mailto:d@drobilla.net> ; + rdfs:seeAlso <http://drobilla.net/drobilla> . + +<http://lv2plug.in/ns/ext/state> + a lv2:Specification ; + doap:name "LV2 State" ; + doap:shortdesc "An interface for LV2 plugins to save and restore state." ; + doap:license <http://opensource.org/licenses/isc> ; + doap:release [ + doap:revision "0.5" ; + doap:created "2012-01-29" ; + dcs:blame <http://drobilla.net/drobilla#me> + ] ; + doap:developer [ + a foaf:Person ; + foaf:name "Leonard Ritter" ; + foaf:homepage <http://paniq.org> + ] ; + doap:maintainer [ + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + rdfs:seeAlso <http://drobilla.net/drobilla.rdf> + ] ; + lv2:documentation """ +<p>This extension provides a simple mechanism for plugins to save and restore +state across instances, allowing hosts to save and restore a plugin instance's +state at any time. The goal is for an instance's state to be +<em>completely</em> described by port values (as with all LV2 plugins) and a +dictionary.</p> + +<p>The <q>state</q> described by this extension is conceptually a simple +key:value dictionary, where keys are URIDs (URIs mapped to integers) and values +are type-tagged blobs of any type. A single key:value pair is called a +<q>property</q>. To implement state, the plugin provides a state:Interface to +the host. To save or restore, the host calls LV2_State_Interface::save() or +LV2_State_Interface::restore(), passing a callback to be used for handling a +single property. The host is free to implement property storage and retrieval +in any way.</p> + +<p>This state model is simple yet has many benefits:</p> +<ul> + <li>URID keys provide both fast performance and RDF compatibility.</li> + <li>Fully extensible, no limitations on keys or value types.</li> + <li>Easy to serialise in many formats (e.g. any RDF syntax, plain + text, JSON, XML, key:value databases, SQL, s-expressions, etc.).</li> + <li>Elegantly described in Turtle, which is useful for describing presets + or default state in LV2 data files (the predicate state:state is provided + for this purpose).</li> + <li>Does not impose any file formats, data structures, or file system + requirements.</li> + <li>Suitable for portable persistent state as well as fast in-memory + snapshots.</li> + <li>Easily stored in a typical <q>map</q> or <q>dictionary</q> data + structure.</li> + <li>Keys may be defined by extensions and used by several plugins, + making state meaningful enabling dynamic state control.</li> +</ul> + +<p>Implementations or further extensions which work with plugin state +(including dynamic plugin control) SHOULD work entirely within this model. +That is, <strong>do not complicate the state model</strong>. <em>All</em> +information required to express an instance's state at any given time can, and +should, be expressed within this model.</p> + +<h3>Plugin Code Example</h3> + +<pre class="c-code"> +#define NS_EG "http://example.org/" +#define NS_ATOM "http://lv2plug.in/ns/ext/atom#" + +LV2_Handle my_instantiate(...) +{ + MyPlugin* plugin = ...; + plugin->uris.atom_String = map_uri(NS_ATOM "String"); + plugin->uris.eg_greeting = map_uri(NS_EG "greeting"); + plugin->state.greeting = strdup("Hello"); + return plugin; +} + +void my_save(LV2_Handle instance, + LV2_State_Store_Function store, + void* handle, + uint32_t flags, + const LV2_Feature *const * features) +{ + MyPlugin* plugin = (MyPlugin*)instance; + const char* greeting = plugin->state.greeting; + + store(handle, + plugin->uris.eg_greeting, + greeting, + strlen(greeting) + 1, + plugin->uris.atom_String, + LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); +} + +void my_restore(LV2_Handle instance, + LV2_State_Retrieve_Function retrieve, + void* handle, + uint32_t flags, + const LV2_Feature *const * features) +{ + MyPlugin* plugin = (MyPlugin*)instance; + + size_t size; + uint32_t type; + uint32_t flags; + const char* greeting = retrieve( + handle, plugin->uris.eg_greeting, &size, &type, &flags); + + if (greeting) { + free(plugin->state->greeting); + plugin->state->greeting = strdup(greeting); + } else { + plugin->state->greeting = strdup("Hello"); + } +} + +const void* my_extension_data(const char* uri) +{ + static const LV2_State_Interface state_iface = { my_save, my_restore }; + if (!strcmp(uri, LV2_STATE_INTERFACE_URI)) { + return &state_iface; + } +} +</pre> + +<h3>Host Code Example</h3> + +<pre class="c-code"> +int store_callback(void* handle, + uint32_t key, + const void* value, + size_t size, + uint32_t type, + uint32_t flags) +{ + if ((flags & LV2_STATE_IS_POD)) { + /* We only care about POD since we're keeping state in memory only. + If this was for disk or network storage/transmission, + LV2_STATE_IS_PORTABLE would have to be checked as well. + */ + Map* state_map = (Map*)handle; + state_map->insert(key, Value(copy(value), size, type, pod)); + return 0; + } else { + return 1; /* Non-POD events are unsupported. */ + } +} + +Map get_plugin_state(LV2_Handle instance) +{ + LV2_State* state = instance.extension_data("http://lv2plug.in/ns/ext/state"); + Map state_map; + /** Request a fast/native/POD save, since we're just copying in memory */ + state.save(instance, store_callback, &state_map, + LV2_STATE_IS_POD|LV2_STATE_IS_NATIVE); + return state_map; +} +</pre> + +<h3>Referring to Existing Files</h3> + +<p>Plugins may need to refer to files (e.g. loaded samples) in their state. +This is done by storing the file's path as a property just like any other +value. However, there are some rules which MUST be followed when storing +paths, see <a href="#mapPath">state:mapPath</a> for details.</p> + +<h3>Creating New Files or Directories</h3> + +<p>Implementations are strongly encouraged to avoid the use of files and simply +store all state as properties whenever possible. However, occasionally the +ability to create files is necessary. The feature <a +href="#newPath">state:newPath</a> makes this possible, if it is provided by the +host.</p> +""" . + +state:Interface + a rdfs:Class ; + rdfs:subClassOf lv2:ExtensionData ; + lv2:documentation """ +<p>A structure (LV2_State_Interface) which contains functions to be called by +the host to save and restore state. In order to support this extension, the +plugin must return a valid LV2_State_Interface from +LV2_Descriptor::extension_data() when it is called with +LV2_STATE_INTERFACE_URI.</p> + +<p>The plugin data file should describe this like so:</p> +<pre class="turtle-code"> +@prefix state: <http://lv2plug.in/ns/ext/state#> . + +<plugin> + a lv2:Plugin ; + lv2:extensionData state:Interface . +</pre> +""" . + +state:State + a rdfs:Class ; + rdfs:label "Plugin Instance State" ; + lv2:documentation """ +<p>This class is used to express a plugin instance's state in RDF. The +key/value properties of the instance form the predicate/object (respectively) +of triples with a state:State as the subject (see <a +href="#state">state:state</a> for an example). This may be used wherever it is +useful to express a plugin instance's state in RDF (e.g. for serialisation, +storing in a model, or transmitting over a network). Note that this class is +provided because it may be useful for hosts, plugins, or extensions that work +with instance state, but its use is not required to support the LV2 State +extension.</p> +""" . + +state:state + a rdf:Property ; + rdfs:range state:State ; + lv2:documentation """ +<p>Predicate to relate a plugin instance to its State. This may be used +wherever the state of a particular plugin instance needs to be represented. +Note that the domain of this property is unspecified, since LV2 does not define +any RDF class for plugin instance. This predicate may be used wherever it makes +sense to do so, e.g.:</p> +<pre class="turtle-code"> +@prefix eg: <http://example.org/> . + +<plugininstance> + state:state [ + eg:somekey "some value" ; + eg:someotherkey "some other value" ; + eg:favourite-number 2 + ] . +</pre> +<p>Note that this property is provided because it may be useful for hosts, +plugins, or extensions that work with instance state, but its use is not +required to support this extension.</p> +""" . + +state:mapPath + a lv2:Feature ; + rdfs:label "Support for storing paths in files" ; + lv2:documentation """ + +<p>This feature maps absolute paths to/from <q>abstract paths</q> which are +stored in state. To support this feature a host must pass an LV2_Feature with +URI LV2_STATE_MAP_PATH_URI and data pointed to an LV2_State_Map_Path to the +plugin's LV2_State_Interface methods.</p> + +<p>The plugin MUST map <em>all</em> paths stored in its state (including in any +files in its state). This is necessary to enable host to handle file system +references correctly, e.g. for distribution or archival.</p> + +<p>For example, a plugin may write a path to a state file like so:</p> + +<pre class="c-code"> +void write_path(LV2_State_Map_Path* map_path, FILE* myfile, const char* path) +{ + char* abstract_path = map_path->abstract_path(map_path->handle, path); + fprintf(myfile, "%s", abstract_path); + free(abstract_path); +} +</pre> + +<p>Then, later reload the path like so:</p> + +<pre class="c-code"> +char* read_path(LV2_State_Map_Path* map_path, FILE* myfile) +{ + /* Obviously this is not production quality code! */ + char abstract_path[1024]; + fscanf(myfile, "%s", abstract_path); + return map_path->absolute_path(map_path->handle, abstract_path); +} +</pre> +""" . + +state:makePath + a lv2:Feature ; + rdfs:label "Support for creating new files and directories" ; + lv2:documentation """ + +<p>This feature allows plugins to create new files and/or directories. To +support this feature the host passes an LV2_Feature with URI +LV2_STATE_MAKE_PATH_URI and data pointed to an LV2_State_Make_Path to the +plugin. The host may make this feature available only during save by passing +it to LV2_State_Interface::save(), or available any time by passing it to +LV2_Descriptor::instantiate(). If passed to LV2_State_Interface::save(), the +feature MUST NOT be used beyond the scope of that call.</p> + +<p>The plugin is guaranteed a hierarchial namespace unique to that plugin +instance, and may expect the returned path to have the requested path as a +suffix. There is <em>one</em> such namespace, even if the feature is passed to +both LV2_Descriptor::instantiate() <em>and</em> +LV2_State_Interface::save(). Beyond this, the plugin MUST NOT make any +assumptions about the returned paths.</p> + +<p>Like any other paths, the plugin MUST map these paths using <a +href="#mapPath">state:mapPath</a> before storing them in state. The plugin +MUST NOT assume these paths will be available across a save/restore otherwise, +i.e. only mapped paths saved to state are persistent, any other created paths +are temporary.</p> + +<p>For example, a plugin may create a file in a subdirectory like so:</p> + +<pre class="c-code"> +char* save_myfile(LV2_State_Make_Path* make_path) +{ + char* path = make_path->path(make_path->handle, "foo/bar/myfile.txt"); + FILE* myfile = fopen(path, 'w'); + fprintf(myfile, "Hello"); + fclose(myfile); + return path; +} +</pre> +""" . + +state:Path + a rdfs:Class ; + rdfs:label "Path" ; + lv2:documentation """ +<p>A path to a file or directory.</p> + +<p>The format of a state:Path is a C string, possibly escaped or otherwise +restricted in a system-specific manner. This URI (LV2_STATE_PATH_URI), mapped +to an integer, MUST be used as the <code>type</code> parameter for any files +passed to the LV2_State_Store_Function; and will likewise be returned by the +corresponding call to the LV2_State_Retrieve_Function.</p> + +<p>When storing and retrieving a path, the plugin MUST NOT assume the same path +will be restored. However, the restored path will refer to a file with +equivalent contents to the original.</p> +""" . diff --git a/lv2/lv2plug.in/ns/ext/state/waf b/lv2/lv2plug.in/ns/ext/state/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/state/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/state/wscript b/lv2/lv2plug.in/ns/ext/state/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/state/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/string-port/ext.pc.in b/lv2/lv2plug.in/ns/ext/string-port/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/string-port/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/string-port/manifest.ttl b/lv2/lv2plug.in/ns/ext/string-port/manifest.ttl new file mode 100644 index 0000000..d0e618e --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/string-port/manifest.ttl @@ -0,0 +1,8 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/string-port> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 1 ; + rdfs:seeAlso <string-port.ttl> . diff --git a/lv2/lv2plug.in/ns/ext/string-port/string-port.h b/lv2/lv2plug.in/ns/ext/string-port/string-port.h new file mode 100644 index 0000000..e7fc8c7 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/string-port/string-port.h @@ -0,0 +1,58 @@ +/* lv2_string_port.h - C header file for LV2 string port extension. + * Draft Revision 3 + * Copyright (C) 2008 Krzysztof Foltman <wdev@foltman.com> + * + * This header is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This header is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this header; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 01222-1307 USA + */ + +/** @file + * C header for the LV2 String Port extension + * <http://lv2plug.in/ns/ext/string-port#StringTransfer>. + */ + +#ifndef LV2_STRING_PORT_H +#define LV2_STRING_PORT_H + +#include <stdint.h> + +/** URI for the string port transfer mechanism feature */ +#define LV2_STRING_PORT_URI "http://lv2plug.in/ns/ext/string-port#StringTransfer" + +/** Flag: port data has been updated; for input ports, this flag is set by +the host. For output ports, this flag is set by the plugin. */ +#define LV2_STRING_DATA_CHANGED_FLAG 1 + +/** structure for string port data */ +typedef struct +{ + /** Buffer for UTF-8 encoded zero-terminated string value; host-allocated */ + char *data; + + /** Length in bytes (not characters), not including zero byte */ + size_t len; + + /** Output ports: storage space in bytes; must be >= RDF-specified requirements */ + size_t storage; + + /** Flags defined above */ + uint32_t flags; + + /** Undefined (pad to 8 bytes) */ + uint32_t pad; + +} LV2_String_Data; + +#endif + diff --git a/lv2/lv2plug.in/ns/ext/string-port/string-port.ttl b/lv2/lv2plug.in/ns/ext/string-port/string-port.ttl new file mode 100644 index 0000000..f36fa7a --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/string-port/string-port.ttl @@ -0,0 +1,105 @@ +# LV2 String Port Extension. +# Draft Revision 3 +# Copyright (C) 2008 Krzysztof Foltman +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +@prefix sp: <http://lv2plug.in/ns/ext/string-port#> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . + +<http://lv2plug.in/ns/ext/string-port> a lv2:Specification ; + doap:license <http://usefulinc.com/doap/licenses/mit> ; + doap:name "LV2 String Ports" ; + doap:maintainer [ + a foaf:Person ; + foaf:name "Krzysztof Foltman" ; + ] ; + lv2:documentation """ +<p>Defines ports which contain string data.</p> + +<h4>UI issues</h4> +<p>When using port_event / write_port (and possible other communication +mechanisms), the format parameter should contain the numeric value of URI +LV2_STRING_PORT_URI (mapped with http://lv2plug.in/ns/extensions/ui specified +as map URI).</p> + +<p>It's probably possible to use ports belonging to message context +<http://lv2plug.in/ns/ext/contexts#MessageContext> for transfer. However, +contexts mechanism does not offer any way to notify the message recipient about +which ports have been changed. To remedy that, this extension defines a flag +LV2_STRING_DATA_CHANGED_FLAG that carries that information inside a port value +structure.</p> + +<h4>Storage</h4> +<p>The value of string port are assumed to be "persistent": if a host saves and +restores a state of a plugin (e.g. control port values), the values of input +string ports should also be assumed to belong to that state. This also applies +to message context: if a session is being restored, the host MUST resend the +last value that was sent to the port before session has been saved. In other +words, string port values "stick" to message ports.</p> +""" . + +sp:StringTransfer a lv2:Feature ; + rdfs:label "String data transfer via LV2_String_Data" . + +sp:StringPort a lv2:Port ; + rdfs:label "String port" ; + lv2:documentation """ +<p>Indicates that the port data points to a LV2_String_Data structure +as defined in accompanying header file.</p> + +<h4>Input Port Semantics</h4> +<p>If the port does not have a context specified (it runs in the default, +realtime audio processing context), the values in the structure and the actual +string data MUST remain unchanged for the time a run() function of a plugin +is executed. However, if the port belongs to a different context, the same +data MUST remain unchanged only for the time a run() or message_process() +function of a given context is executed.</p> + +<h4>Output Port Semantics</h4> +<p>The plugin may only change the string or length in a run() function (if +the port belongs to default context) or in context-defined counterparts +(if the port belongs to another context). Because of that, using default +context output string ports is contraindicated for longer strings.</p> +""" . + +sp:default a rdf:Property ; + rdfs:label "Default value" ; + rdfs:domain sp:StringPort ; + rdfs:range xsd:string ; + rdfs:comment """ +Gives a default value for a string port. +""" . + +sp:requiredSpace a rdf:Property ; + rdfs:label "Required storage space in bytes" ; + rdfs:domain sp:StringPort ; + rdfs:range xsd:nonNegativeInteger ; + rdfs:comment """ +Specifies required buffer space for output string ports and those of +input string ports that are meant to be GUI-controlled. The host MUST +allocate a buffer of at least required size to accommodate for all values +that can be produced by the plugin. +""" . + diff --git a/lv2/lv2plug.in/ns/ext/string-port/waf b/lv2/lv2plug.in/ns/ext/string-port/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/string-port/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/string-port/wscript b/lv2/lv2plug.in/ns/ext/string-port/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/string-port/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/time/ext.pc.in b/lv2/lv2plug.in/ns/ext/time/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/time/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/time/manifest.ttl b/lv2/lv2plug.in/ns/ext/time/manifest.ttl new file mode 100644 index 0000000..2657388 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/time/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/time> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 1 ; + rdfs:seeAlso <time.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/time/time.h b/lv2/lv2plug.in/ns/ext/time/time.h new file mode 100644 index 0000000..f3b2e77 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/time/time.h @@ -0,0 +1,131 @@ +/* + Copyright 2011 David Robillard <http://drobilla.net> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +/** + @file time.h C header for the LV2 Time extension + <http://lv2plug.in/ns/ext/time>. +*/ + +#ifndef LV2_TIME_H +#define LV2_TIME_H + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + Time states. +*/ +typedef enum { + LV2_TIME_STOPPED = 0, /**< Transport halted */ + LV2_TIME_ROLLING = 1, /**< Transport playing */ +} LV2_Time_State; + +/** + Bits indicating properties of an LV2_Time_Position. +*/ +typedef enum { + LV2_TIME_HAS_BBT = 1 /**< Has Bar, Beat, Tick */ +} LV2_Time_Flags; + +/** + Description of a position and/or tempo. + + This struct is used as the payload of an event to notify the plugin about + time state, such as position and tempo. +*/ +typedef struct { + /** + @{ + @name Mandatory Fields + */ + + /** + Frame number on the timeline. + */ + uint64_t frame; + + /** + Bit field of LV2_Time_Flags values indicating which fields + of this struct are valid. + */ + uint32_t flags; + + /** + Transport state. + */ + LV2_Time_State state; + + /** + @} + @{ + @name LV2_TIME_BBT fields + These fields are valid iff the LV2_TIME_BBT bit is set in @ref flags. + */ + + /** + Current bar. + The first bar is number 0 (but should be represented in a UI as bar 1). + */ + int64_t bar; + + /** + Beat within the current bar. + The first beat is number 0. + Always <= @ref beats_per_bar. + */ + int32_t beat; + + /** + Tick within the current beat. + The first tick is number 0. + Always <= @ref ticks_per_beat. + */ + int32_t tick; + + /** + Number of beats per bar (top of time signature). + */ + int32_t beats_per_bar; + + /** + Type of note that counts as one beat (bottom of time signature). + */ + int32_t beat_type; + + /** + Number of ticks per beat. + Typically this is a large integer with many even divisors. + */ + int32_t ticks_per_beat; + + /** + Current tempo, in beats per minute. + */ + double beats_per_minute; + + /** + @} + */ +} LV2_Time_Position; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV2_TIME_H */ diff --git a/lv2/lv2plug.in/ns/ext/time/time.ttl b/lv2/lv2plug.in/ns/ext/time/time.ttl new file mode 100644 index 0000000..40bfdbb --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/time/time.ttl @@ -0,0 +1,57 @@ +# LV2 Time Extension +# Copyright 2011 David Robillard <d@drobilla.net> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix time: <http://lv2plug.in/ns/ext/time#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://lv2plug.in/ns/ext/time> + a lv2:Specification ; + doap:name "LV2 Time" ; + doap:shortdesc "A data type for transport speed and position." ; + doap:maintainer [ + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + rdfs:seeAlso <http://drobilla.net/drobilla.rdf> + ] ; + lv2:documentation """ +<p>This extension defines a structure type, LV2_Time_Position, which +describes a tempo and position along a timeline. This can be used as +an event payload by the host to notify plugins about the current +tempo and position.</p> +""" . + +time:Position + a rdfs:Class ; + rdfs:label "LV2 time position" ; + lv2:documentation """ +<p>Type for an LV2_Time_Position struct. This can be mapped to an integer and +used as the type field of an event to indicate that the event payload is an +LV2_Time_Positon struct. Plugins SHOULD indicate that a port supports time +information using the ev:supports predicate, e.g.:</p> +<pre class="turtle-code"> +<plugin> lv2:port [ + a lv2:InputPort , ev:EventPort ; + lv2:name "control" ; + lv2:index 0 ; + ev:supportsEvent time:Position +] . +</pre> +""" . diff --git a/lv2/lv2plug.in/ns/ext/time/waf b/lv2/lv2plug.in/ns/ext/time/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/time/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/time/wscript b/lv2/lv2plug.in/ns/ext/time/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/time/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/ui-resize/ext.pc.in b/lv2/lv2plug.in/ns/ext/ui-resize/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/ui-resize/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/ui-resize/manifest.ttl b/lv2/lv2plug.in/ns/ext/ui-resize/manifest.ttl new file mode 100644 index 0000000..ca5cdf9 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/ui-resize/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/ui-resize> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 1 ; + rdfs:seeAlso <ui-resize.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/ui-resize/ui-resize.h b/lv2/lv2plug.in/ns/ext/ui-resize/ui-resize.h new file mode 100644 index 0000000..cf5ccc6 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/ui-resize/ui-resize.h @@ -0,0 +1,58 @@ +/* + Copyright 2011 David Robillard <http://drobilla.net> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#ifndef LV2_UI_RESIZE_H +#define LV2_UI_RESIZE_H + +#define LV2_UI_RESIZE_URI "http://lv2plug.in/ns/ext/ui-resize" + +typedef void* LV2_UI_Resize_Feature_Data; + +/** + UI Resize Feature. + + This structure may be used in two ways: as a feature passed by the host + (e.g. via the features parameter of LV2UI_Descriptor::instantiate()) or + as a feature exposed by a UI (e.g. via LV2UI_Descriptor::extension_data()). + + In both cases, the URI to be used is + http://lv2plug.in/ns/ext/ui-resize#UIResize +*/ +typedef struct { + + LV2_UI_Resize_Feature_Data data; + + /** + Request or notify a size change. + + When this struct is provided by the host, the UI may call this + function to notify the host that a size change is desired, or notify + the host of the initial size of the UI. + + When this struct is provided by the plugin, the host may call this + function in the UI thread to notify the UI that it should change its + size to the given dimensions. + + @return 0 on success. + */ + int (*ui_resize)(LV2_UI_Resize_Feature_Data data, + int width, + int height); + +} LV2_UI_Resize_Feature; + +#endif /* LV2_UI_RESIZE_H */ + diff --git a/lv2/lv2plug.in/ns/ext/ui-resize/ui-resize.ttl b/lv2/lv2plug.in/ns/ext/ui-resize/ui-resize.ttl new file mode 100644 index 0000000..f3b7d92 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/ui-resize/ui-resize.ttl @@ -0,0 +1,43 @@ +# LV2 UI Resize Extension +# Copyright 2011 David Robillard <d@drobilla.net> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix uirsz: <http://lv2plug.in/ns/ext/ui-resize#> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . + +<http://lv2plug.in/ns/ext/ui-resize> + a lv2:Specification ; + doap:name "LV2 UI Resize Extension" ; + doap:shortdesc "A feature for self-resizing plugin UIs." ; + doap:license <http://opensource.org/licenses/isc> ; + lv2:documentation """ +<p>An extension that allows LV2 plugin UIs to notify the host about size +changes, or for the host to notify plugin UIs about size changes.</p> +""" . + +uirsz:UIResize + a lv2:Feature ; + lv2:documentation """ +<p>A feature that allows the UI to notify the host about its current size, or +request a size change. This feature corresponds to the LV2_UI_Resize_Feature +struct, which should be passed with the feature URI +<code>http://lv2plug.in/ns/ext/ui-resize#UIResize</code>. This struct may also +be provided by the UI as extension data using the same URI, in which case it +is used by the host to request that the UI change its size.</p> +""" . diff --git a/lv2/lv2plug.in/ns/ext/ui-resize/waf b/lv2/lv2plug.in/ns/ext/ui-resize/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/ui-resize/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/ui-resize/wscript b/lv2/lv2plug.in/ns/ext/ui-resize/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/ui-resize/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/uri-map/ext.pc.in b/lv2/lv2plug.in/ns/ext/uri-map/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/uri-map/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/uri-map/manifest.ttl b/lv2/lv2plug.in/ns/ext/uri-map/manifest.ttl new file mode 100644 index 0000000..0348a55 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/uri-map/manifest.ttl @@ -0,0 +1,8 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/uri-map> + a lv2:Specification ; + lv2:minorVersion 1 ; + lv2:microVersion 4 ; + rdfs:seeAlso <uri-map.ttl> . diff --git a/lv2/lv2plug.in/ns/ext/uri-map/uri-map.h b/lv2/lv2plug.in/ns/ext/uri-map/uri-map.h new file mode 100644 index 0000000..6767cd1 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/uri-map/uri-map.h @@ -0,0 +1,92 @@ +/* + Copyright 2008-2011 David Robillard <http://drobilla.net> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +/** + @file + C header for the LV2 URI Map extension <http://lv2plug.in/ns/ext/uri-map>. + + This extension defines a simple mechanism for plugins to map URIs to + integers, usually for performance reasons (e.g. processing events typed by + URIs in real time). The expected use case is for plugins to map URIs to + integers for things they 'understand' at instantiation time, and store those + values for use in the audio thread without doing any string comparison. + This allows the extensibility of RDF with the performance of integers (or + centrally defined enumerations). +*/ + +#ifndef LV2_URI_MAP_H +#define LV2_URI_MAP_H + +#define LV2_URI_MAP_URI "http://lv2plug.in/ns/ext/uri-map" + +#include <stdint.h> + +/** + Opaque pointer to host data. +*/ +typedef void* LV2_URI_Map_Callback_Data; + +/** + URI Map Feature. + + To support this feature the host must pass an LV2_Feature struct to the + plugin's instantiate method with URI "http://lv2plug.in/ns/ext/uri-map" + and data pointed to an instance of this struct. +*/ +typedef struct { + + /** + Opaque pointer to host data. + + The plugin MUST pass this to any call to functions in this struct. + Otherwise, it must not be interpreted in any way. + */ + LV2_URI_Map_Callback_Data callback_data; + + /** + Get the numeric ID of a URI from the host. + + @param callback_data Must be the callback_data member of this struct. + @param map The 'context' of this URI. Certain extensions may define a + URI that must be passed here with certain restrictions on the return + value (e.g. limited range). This value may be NULL if the plugin needs + an ID for a URI in general. Extensions SHOULD NOT define a context + unless there is a specific need to do so, e.g. to restrict the range of + the returned value. + @param uri The URI to be mapped to an integer ID. + + This function is referentially transparent; any number of calls with the + same arguments is guaranteed to return the same value over the life of a + plugin instance (though the same URI may return different values with a + different map parameter). However, this function is not necessarily very + fast: plugins SHOULD cache any IDs they might need in performance + critical situations. + + The return value 0 is reserved and indicates that an ID for that URI + could not be created for whatever reason. Extensions MAY define more + precisely what this means in a certain context, but in general plugins + SHOULD handle this situation as gracefully as possible. However, hosts + SHOULD NOT return 0 from this function in non-exceptional circumstances + (e.g. the URI map SHOULD be dynamic). Hosts that statically support only + a fixed set of URIs should not expect plugins to function correctly. + */ + uint32_t (*uri_to_id)(LV2_URI_Map_Callback_Data callback_data, + const char* map, + const char* uri); + +} LV2_URI_Map_Feature; + +#endif /* LV2_URI_MAP_H */ diff --git a/lv2/lv2plug.in/ns/ext/uri-map/uri-map.ttl b/lv2/lv2plug.in/ns/ext/uri-map/uri-map.ttl new file mode 100644 index 0000000..88f0fdd --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/uri-map/uri-map.ttl @@ -0,0 +1,93 @@ +# LV2 URI Map Extension +# Copyright 2008-2011 David Robillard <http://drobilla.net> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix dcs: <http://ontologi.es/doap-changeset#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix lv2ev: <http://lv2plug.in/ns/ext/event#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix umap: <http://lv2plug.in/ns/ext/uri-map#> . + +<http://drobilla.net/drobilla#me> + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + foaf:mbox <mailto:d@drobilla.net> ; + rdfs:seeAlso <http://drobilla.net/drobilla> . + +_:larsl + a foaf:Person ; + foaf:name "Lars Luthman" . + +<http://lv2plug.in/ns/ext/uri-map> + a lv2:Specification , + lv2:Feature ; + owl:deprecated true ; + doap:license <http://opensource.org/licenses/isc> ; + doap:name "LV2 URI Map" ; + doap:shortdesc "A feature for mapping URIs to integers." ; + doap:release [ + doap:revision "1.4" ; + doap:created "2011-11-21" ; + dcs:blame <http://drobilla.net/drobilla#me> ; + doap:file-release <http://lv2plug.in/spec/lv2-uri-map-1.4.tar.bz2> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Update packaging." + ] , [ + rdfs:label "Deprecate uri-map in favour of urid." + ] + ] + ] , [ + doap:revision "1.2" ; + doap:created "2011-05-26" ; + dcs:blame <http://drobilla.net/drobilla#me> ; + doap:file-release <http://lv2plug.in/spec/lv2-uri-map-1.2.tar.bz2> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Add build system (for installation)." + ] , [ + rdfs:label "Mark up documentation in HTML using lv2:docum" + ] + ] + ] , [ + doap:revision "1.0" ; + doap:created "2010-10-18" ; + doap:file-release <http://lv2plug.in/spec/lv2-uri-map-1.0.tar.gz> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Initial release." + ] + ] + ] ; + doap:maintainer <http://drobilla.net/drobilla#me> , + _:larsl ; + lv2:documentation """ +<p><span class="warning">This extension is deprecated.</span> New +implementations should use <a href="http://lv2plug.in/ns/ext/urid">LV2 URID</a> +instead.</p> + +<p>This extension defines a simple mechanism for plugins to map URIs to +integers, usually for performance reasons (e.g. processing events typed by URIs +in real time). The expected use case is for plugins to map URIs to integers +for things they 'understand' at instantiation time, and store those values for +use in the audio thread without doing any string comparison. This allows the +extensibility of RDF with the performance of integers (or centrally defined +enumerations).</p> +""" . diff --git a/lv2/lv2plug.in/ns/ext/uri-map/waf b/lv2/lv2plug.in/ns/ext/uri-map/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/uri-map/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/uri-map/wscript b/lv2/lv2plug.in/ns/ext/uri-map/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/uri-map/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/urid/ext.pc.in b/lv2/lv2plug.in/ns/ext/urid/ext.pc.in new file mode 120000 index 0000000..03dd044 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/urid/ext.pc.in @@ -0,0 +1 @@ +../../../../../ext.pc.in
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/urid/manifest.ttl b/lv2/lv2plug.in/ns/ext/urid/manifest.ttl new file mode 100644 index 0000000..4b23244 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/urid/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix urid: <http://lv2plug.in/ns/ext/urid#> . + +<http://lv2plug.in/ns/ext/urid> + a lv2:Specification ; + lv2:minorVersion 1 ; + lv2:microVersion 0 ; + rdfs:seeAlso <urid.ttl> . diff --git a/lv2/lv2plug.in/ns/ext/urid/urid.h b/lv2/lv2plug.in/ns/ext/urid/urid.h new file mode 100644 index 0000000..22c9a66 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/urid/urid.h @@ -0,0 +1,115 @@ +/* + Copyright 2011 Gabriel M. Beddingfield <gabrbedd@gmail.com> + Copyright 2008-2011 David Robillard <http://drobilla.net> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +/** + @file + C header for the LV2 URID extension <http://lv2plug.in/ns/ext/urid> +*/ + +#ifndef LV2_URID_H +#define LV2_URID_H + +#define LV2_URID_URI "http://lv2plug.in/ns/ext/urid" +#define LV2_URID_MAP_URI LV2_URID_URI "#map" +#define LV2_URID_UNMAP_URI LV2_URID_URI "#unmap" + +#include <stdint.h> + +/** + Opaque pointer to host data for LV2_URID_Map. +*/ +typedef void* LV2_URID_Map_Handle; + +/** + Opaque pointer to host data for LV2_URID_Unmap. +*/ +typedef void* LV2_URID_Unmap_Handle; + +/** + URI mapped to an integer. +*/ +typedef uint32_t LV2_URID; + +/** + URI Map (http://lv2plug.in/ns/ext/urid#map). +*/ +typedef struct { + /** + Opaque pointer to host data. + + This MUST be passed to map_uri() whenever it is called. + Otherwise, it must not be interpreted in any way. + */ + LV2_URID_Map_Handle handle; + + /** + Get the numeric ID of a URI. + + If the ID does not already exist, it will be created. + + This function is referentially transparent; any number of calls with the + same arguments is guaranteed to return the same value over the life of a + plugin instance. Note, however, that several URIs MAY resolve to the + same ID if the host considers those URIs equivalent. + + This function is not necessarily very fast or RT-safe: plugins SHOULD + cache any IDs they might need in performance critical situations. + + The return value 0 is reserved and indicates that an ID for that URI + could not be created for whatever reason. However, hosts SHOULD NOT + return 0 from this function in non-exceptional circumstances (i.e. the + URI map SHOULD be dynamic). + + @param handle Must be the callback_data member of this struct. + @param uri The URI to be mapped to an integer ID. + */ + LV2_URID (*map)(LV2_URID_Map_Handle handle, + const char* uri); +} LV2_URID_Map; + +/** + URI Unmap (http://lv2plug.in/ns/ext/urid#unmap). +*/ +typedef struct { + /** + Opaque pointer to host data. + + This MUST be passed to unmap() whenever it is called. + Otherwise, it must not be interpreted in any way. + */ + LV2_URID_Unmap_Handle handle; + + /** + Get the URI for a previously mapped numeric ID. + + Returns NULL if @c urid is not yet mapped. Otherwise, the corresponding + URI is returned in a canonical form. This MAY not be the exact same + string that was originally passed to LV2_URID_Map::map(), but it MUST be + an identical URI according to the URI syntax specification (RFC3986). A + non-NULL return for a given @c urid will always be the same for the life + of the plugin. Plugins that intend to perform string comparison on + unmapped URIs SHOULD first canonicalise URI strings with a call to + map_uri() followed by a call to unmap_uri(). + + @param handle Must be the callback_data member of this struct. + @param urid The ID to be mapped back to the URI string. + */ + const char* (*unmap)(LV2_URID_Unmap_Handle handle, + LV2_URID urid); +} LV2_URID_Unmap; + +#endif /* LV2_URID_H */ diff --git a/lv2/lv2plug.in/ns/ext/urid/urid.ttl b/lv2/lv2plug.in/ns/ext/urid/urid.ttl new file mode 100644 index 0000000..121ffaf --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/urid/urid.ttl @@ -0,0 +1,81 @@ +# LV2 URID Extension +# Copyright 2011 Gabriel M. Beddingfield <gabrbedd@gmail.com> +# Copyright 2008-2011 David Robillard <http://drobilla.net> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix dcs: <http://ontologi.es/doap-changeset#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix urid: <http://lv2plug.in/ns/ext/urid#> . + +<http://drobilla.net/drobilla#me> + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + foaf:mbox <mailto:d@drobilla.net> ; + rdfs:seeAlso <http://drobilla.net/drobilla> . + +_:gabrbedd + a foaf:Person ; + foaf:name "Gabriel M. Beddingfield" ; + foaf:homepage <http://gabe.is-a-geek.org/> . + +<http://lv2plug.in/ns/ext/urid> + a lv2:Specification ; + doap:license <http://opensource.org/licenses/isc> ; + doap:name "LV2 URID" ; + doap:shortdesc "Features for mapping URIs to and from integers." ; + doap:release [ + doap:revision "1.0" ; + doap:created "2011-11-21" ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Initial release." + ] + ] + ] ; + doap:developer _:gabrbedd ; + lv2:documentation """ +<p>This extension defines a simple mechanism for plugins to map URIs to and +from integers, usually for performance reasons (e.g. processing events typed by +URIs in real time). Typically, plugins map URIs to integers for things they +"understand" at instantiation time, and store those values for use in the audio +thread without doing any string comparison. This allows for the extensibility +of RDF but with the performance of integers.</p> + +<p>This extension is intended as an improved and simplified replacement for the +<a href="http://lv2plug.in/ns/ext/uri-map">uri-map</a> extension, since the +<q>map</q> context parameter has been found problematic. New implementations +are strongly encouraged to use this extension for URI mapping.</p> +""" . + +urid:map + a lv2:Feature ; + lv2:documentation """ +<p>A feature which is used to map URIs to integers. To support this feature, +the host must pass an LV2_Feature to LV2_Descriptor::instantiate() with URI +LV2_URID_MAP_URI and data pointed to an instance of LV2_URID_Map.</p> +""" . + +urid:unmap + a lv2:Feature ; + lv2:documentation """ +<p>A feature which is used to unmap URIs previously mapped to integers by +urid:map. To support this feature, the host must pass an LV2_Feature to +LV2_Descriptor::instantiate() with URI LV2_URID_UNMAP_URI and data pointed to +an instance of LV2_URID_Unmap.</p> +""" . diff --git a/lv2/lv2plug.in/ns/ext/urid/waf b/lv2/lv2plug.in/ns/ext/urid/waf new file mode 120000 index 0000000..5235032 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/urid/waf @@ -0,0 +1 @@ +../../../../../waf
\ No newline at end of file diff --git a/lv2/lv2plug.in/ns/ext/urid/wscript b/lv2/lv2plug.in/ns/ext/urid/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/urid/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file |