diff options
author | David Robillard <d@drobilla.net> | 2012-06-05 19:44:54 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-06-05 19:44:54 +0000 |
commit | 50fb6095015dd8a64f868c9d9a70a8ae8170498d (patch) | |
tree | abae0c69f4536af2641e5e6d8f29b6334373edd0 | |
parent | 3c83ae6ed27e0486a1d5520f1674ee38ba6767c5 (diff) | |
download | lv2-50fb6095015dd8a64f868c9d9a70a8ae8170498d.tar.xz |
Add buf-size extension.
-rw-r--r-- | doc/reference.doxygen.in | 1 | ||||
-rw-r--r-- | lv2/lv2plug.in/ns/ext/buf-size/buf-size.h | 102 | ||||
-rw-r--r-- | lv2/lv2plug.in/ns/ext/buf-size/buf-size.ttl | 92 | ||||
-rw-r--r-- | lv2/lv2plug.in/ns/ext/buf-size/manifest.ttl | 9 | ||||
l--------- | lv2/lv2plug.in/ns/ext/buf-size/wscript | 1 | ||||
-rw-r--r-- | wscript | 2 |
6 files changed, 206 insertions, 1 deletions
diff --git a/doc/reference.doxygen.in b/doc/reference.doxygen.in index 6cbf3b8..a14b62a 100644 --- a/doc/reference.doxygen.in +++ b/doc/reference.doxygen.in @@ -569,6 +569,7 @@ INPUT = \ @LV2_SRCDIR@/lv2/lv2plug.in/ns/ext/atom/atom.h \ @LV2_SRCDIR@/lv2/lv2plug.in/ns/ext/atom/forge.h \ @LV2_SRCDIR@/lv2/lv2plug.in/ns/ext/atom/util.h \ + @LV2_SRCDIR@/lv2/lv2plug.in/ns/ext/buf-size/buf-size.h \ @LV2_SRCDIR@/lv2/lv2plug.in/ns/ext/data-access/data-access.h \ @LV2_SRCDIR@/lv2/lv2plug.in/ns/ext/dynmanifest/dynmanifest.h \ @LV2_SRCDIR@/lv2/lv2plug.in/ns/ext/event/event-helpers.h \ diff --git a/lv2/lv2plug.in/ns/ext/buf-size/buf-size.h b/lv2/lv2plug.in/ns/ext/buf-size/buf-size.h new file mode 100644 index 0000000..0e49210 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/buf-size/buf-size.h @@ -0,0 +1,102 @@ +/* + Copyright 2007-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. +*/ + +#ifndef LV2_BUF_SIZE_H +#define LV2_BUF_SIZE_H + +#include <stddef.h> +#include <stdint.h> + +#include "lv2/lv2plug.in/ns/ext/urid/urid.h" + +#define LV2_BUF_SIZE_URI "http://lv2plug.in/ns/ext/buf-size" +#define LV2_BUF_SIZE_PREFIX LV2_BUF_SIZE_URI "#" + +#define LV2_BUF_SIZE__access LV2_BUF_SIZE_PREFIX "access" +#define LV2_BUF_SIZE__boundedBlockLength LV2_BUF_SIZE_PREFIX "boundedBlockLength" +#define LV2_BUF_SIZE__fixedBlockLength LV2_BUF_SIZE_PREFIX "fixedBlockLength" +#define LV2_BUF_SIZE__powerOf2BlockLength LV2_BUF_SIZE_PREFIX "powerOf2BlockLength" + +#ifdef __cplusplus +extern "C" { +#else +# include <stdbool.h> +#endif + +typedef enum { + LV2_BUF_SIZE_SUCCESS = 0, /**< Completed successfully. */ + LV2_BUF_SIZE_ERR_UNKNOWN = 1, /**< Unknown error. */ + LV2_BUF_SIZE_ERR_BAD_TYPE = 2 /**< Failed due to unsupported type. */ +} LV2_Buf_Size_Status; + +typedef void* LV2_Buf_Size_Access_Handle; + +/** + The data for feature LV2_BUF_SIZE__access. +*/ +typedef struct { + /** + Opaque host data. + */ + LV2_Buf_Size_Access_Handle handle; + + /** + The size of this struct. + + The host MUST set this to sizeof(LV2_Buf_Size_Feature). + */ + size_t size; + + /** + Get properties of the sample_count parameter of LV2_Descriptor::run(). + + @param handle The handle field of this struct. + @param min Set to the minimum block length. + @param max Set to the maximum block length, or 0 for unlimited. + @param multiple_of Set to a number the block length will always be a + multiple of, possibly 1 for arbitrary block lengths. + @param power_of Set to a number the block length will always be a power + of, or 0 if no such restriction applies. + @return 0 for success, otherwise an error code. + */ + LV2_Buf_Size_Status + (*get_sample_count)(LV2_Buf_Size_Access_Handle handle, + uint32_t* min, + uint32_t* max, + uint32_t* multiple_of, + uint32_t* power_of); + + /** + Get the size for buffers of a given type. + + @param handle The handle field of this struct. + @param type The type of buffer. This is deliberately loosely defined + and may be a port type or some other type (e.g. an Atom type). + @param subtype Additional type parameter. This may be needed for some + types, otherwise it may be set to zero. + @return The buffer size for the given type, in bytes. + */ + size_t + (*get_buf_size)(LV2_Buf_Size_Access_Handle handle, + LV2_URID type, + LV2_URID subtype); +} LV2_Buf_Size_Access; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LV2_BUF_SIZE_H */ diff --git a/lv2/lv2plug.in/ns/ext/buf-size/buf-size.ttl b/lv2/lv2plug.in/ns/ext/buf-size/buf-size.ttl new file mode 100644 index 0000000..e6ec7e9 --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/buf-size/buf-size.ttl @@ -0,0 +1,92 @@ +@prefix bufsz: <http://lv2plug.in/ns/ext/buf-size#> . +@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 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/buf-size> + a lv2:Specification , + lv2:Feature ; + rdfs:seeAlso <buf-size.h> , + <../../meta/meta.ttl> ; + doap:name "LV2 Buf Size Extension" ; + doap:shortdesc "Access to, and restrictions on, buffer sizes." ; + doap:created "2012-05-25" ; + doap:developer <http://drobilla.net/drobilla#me> ; + doap:release [ + doap:revision "1.0" ; + doap:created "2012-04-17" ; + doap:file-release <http://lv2plug.in/spec/lv2-1.0.0.tar.bz2> ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Initial release." + ] + ] + ] ; + lv2:documentation """ +<p>This extension defines a facility for plugins to get information about the +block length (the sample_count parameter of LV2_Descriptor::run) and +port buffer sizes, as well as several features which can be used to restrict +the block length.</p> + +<p>Access to the relevant information is provided by the bufsz:access feature, +which may be used alone. To express restrictions on the block length, +additional data-only features are defined: bufsz:boundedBlockLength, +bufsz:powerOf2BlockLength, and bufsz:fixedBlockLength. There is currently no +facility for requiring specific values for the block length, this may be added +in the future if need arises.</p> +""" . + +bufsz:access + a lv2:Feature ; + lv2:documentation """ +<p>The feature that provides access to buffer size information. This feature +is the only one in this extension which carries data: to implement it the host +passes a feature with URI LV2_BUF_SIZE__access and an LV2_Buf_Size_Feature +for data, which provides functions the plugin can call to investigate the +buffer size.</p> +""" . + +bufsz:boundedBlockLength + a lv2:Feature ; + lv2:documentation """ +<p>A feature that indicates the host will provide a minimum and maximum block +length via LV2_Buf_Size_Feature::get_sample_count(). Plugins that copy data +from audio inputs can require this feature to ensure they know how much space +is required for auxilliary buffers. Note the minimum may be zero, this feature +is mainly useful to ensure a maximum is available.</p> + +<p>All hosts SHOULD support this feature, since it is simple to support and +necessary for several relatively straightforward use cases.</p> +""" . + +bufsz:fixedBlockLength + a lv2:Feature ; + lv2:documentation """ +<p>A feature that indicates the host will always call LV2_Descriptor::run() +with the same value for sample_count. If available, +LV2_Buf_Size_Feature::get_sample_count() must report this value for both min +and max.</p> + +<p>Note that requiring this feature may severely limit the number of hosts +capable of running the plugin.</p> +""" . + +bufsz:powerOf2BlockLength + a lv2:Feature ; + lv2:documentation """ +<p>A feature that indicates the host will always call LV2_Descriptor::run() +with a power of two sample_count. If available, +LV2_Buf_Size_Feature::get_sample_count() must report this value for both min +and max. Note this feature does not guarantee the value is the same each call, +to ensure that the plugin must require both this feature and +bufsz:fixedBlockLength.</p> + +<p>Note that requiring this feature may severely limit the number of hosts +capable of running the plugin.</p> +""" . diff --git a/lv2/lv2plug.in/ns/ext/buf-size/manifest.ttl b/lv2/lv2plug.in/ns/ext/buf-size/manifest.ttl new file mode 100644 index 0000000..c68587c --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/buf-size/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/buf-size> + a lv2:Specification ; + lv2:minorVersion 0 ; + lv2:microVersion 0 ; + rdfs:seeAlso <buf-size.ttl> . + diff --git a/lv2/lv2plug.in/ns/ext/buf-size/wscript b/lv2/lv2plug.in/ns/ext/buf-size/wscript new file mode 120000 index 0000000..7e2c01b --- /dev/null +++ b/lv2/lv2plug.in/ns/ext/buf-size/wscript @@ -0,0 +1 @@ +../../../../../ext.wscript
\ No newline at end of file @@ -14,7 +14,7 @@ import waflib.Scripting as Scripting # Variables for 'waf dist' APPNAME = 'lv2' -VERSION = '1.0.3' +VERSION = '1.0.5' # Mandatory variables top = '.' |