1 /* 2 LV2 - An audio plugin interface specification. 3 Copyright 2006-2012 Steve Harris, David Robillard. 4 Copyright 2018 Ethan Reker <http://cutthroughrecordings.com> 5 6 Based on LADSPA, Copyright 2000-2002 Richard W.E. Furse, 7 Paul Barton-Davis, Stefan Westerfeld. 8 9 Permission to use, copy, modify, and/or distribute this software for any 10 purpose with or without fee is hereby granted, provided that the above 11 copyright notice and this permission notice appear in all copies. 12 13 THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 14 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 15 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 16 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 18 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 19 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 */ 21 module dplug.lv2.lv2; 22 23 version(LV2): 24 25 import core.stdc.stdint; 26 import core.stdc.string; 27 28 enum LV2_CORE_URI = "http://lv2plug.in/ns/lv2core"; ///< http://lv2plug.in/ns/lv2core 29 enum LV2_CORE_PREFIX = LV2_CORE_URI ~ "#"; ///< http://lv2plug.in/ns/lv2core# 30 31 enum LV2_CORE__AllpassPlugin = LV2_CORE_PREFIX ~ "AllpassPlugin" ; ///< http://lv2plug.in/ns/lv2core#AllpassPlugin 32 enum LV2_CORE__AmplifierPlugin = LV2_CORE_PREFIX ~ "AmplifierPlugin" ; ///< http://lv2plug.in/ns/lv2core#AmplifierPlugin 33 enum LV2_CORE__AnalyserPlugin = LV2_CORE_PREFIX ~ "AnalyserPlugin" ; ///< http://lv2plug.in/ns/lv2core#AnalyserPlugin 34 enum LV2_CORE__AudioPort = LV2_CORE_PREFIX ~ "AudioPort" ; ///< http://lv2plug.in/ns/lv2core#AudioPort 35 enum LV2_CORE__BandpassPlugin = LV2_CORE_PREFIX ~ "BandpassPlugin" ; ///< http://lv2plug.in/ns/lv2core#BandpassPlugin 36 enum LV2_CORE__CVPort = LV2_CORE_PREFIX ~ "CVPort" ; ///< http://lv2plug.in/ns/lv2core#CVPort 37 enum LV2_CORE__ChorusPlugin = LV2_CORE_PREFIX ~ "ChorusPlugin" ; ///< http://lv2plug.in/ns/lv2core#ChorusPlugin 38 enum LV2_CORE__CombPlugin = LV2_CORE_PREFIX ~ "CombPlugin" ; ///< http://lv2plug.in/ns/lv2core#CombPlugin 39 enum LV2_CORE__CompressorPlugin = LV2_CORE_PREFIX ~ "CompressorPlugin" ; ///< http://lv2plug.in/ns/lv2core#CompressorPlugin 40 enum LV2_CORE__ConstantPlugin = LV2_CORE_PREFIX ~ "ConstantPlugin" ; ///< http://lv2plug.in/ns/lv2core#ConstantPlugin 41 enum LV2_CORE__ControlPort = LV2_CORE_PREFIX ~ "ControlPort" ; ///< http://lv2plug.in/ns/lv2core#ControlPort 42 enum LV2_CORE__ConverterPlugin = LV2_CORE_PREFIX ~ "ConverterPlugin" ; ///< http://lv2plug.in/ns/lv2core#ConverterPlugin 43 enum LV2_CORE__DelayPlugin = LV2_CORE_PREFIX ~ "DelayPlugin" ; ///< http://lv2plug.in/ns/lv2core#DelayPlugin 44 enum LV2_CORE__DistortionPlugin = LV2_CORE_PREFIX ~ "DistortionPlugin" ; ///< http://lv2plug.in/ns/lv2core#DistortionPlugin 45 enum LV2_CORE__DynamicsPlugin = LV2_CORE_PREFIX ~ "DynamicsPlugin" ; ///< http://lv2plug.in/ns/lv2core#DynamicsPlugin 46 enum LV2_CORE__EQPlugin = LV2_CORE_PREFIX ~ "EQPlugin" ; ///< http://lv2plug.in/ns/lv2core#EQPlugin 47 enum LV2_CORE__EnvelopePlugin = LV2_CORE_PREFIX ~ "EnvelopePlugin" ; ///< http://lv2plug.in/ns/lv2core#EnvelopePlugin 48 enum LV2_CORE__ExpanderPlugin = LV2_CORE_PREFIX ~ "ExpanderPlugin" ; ///< http://lv2plug.in/ns/lv2core#ExpanderPlugin 49 enum LV2_CORE__ExtensionData = LV2_CORE_PREFIX ~ "ExtensionData" ; ///< http://lv2plug.in/ns/lv2core#ExtensionData 50 enum LV2_CORE__Feature = LV2_CORE_PREFIX ~ "Feature" ; ///< http://lv2plug.in/ns/lv2core#Feature 51 enum LV2_CORE__FilterPlugin = LV2_CORE_PREFIX ~ "FilterPlugin" ; ///< http://lv2plug.in/ns/lv2core#FilterPlugin 52 enum LV2_CORE__FlangerPlugin = LV2_CORE_PREFIX ~ "FlangerPlugin" ; ///< http://lv2plug.in/ns/lv2core#FlangerPlugin 53 enum LV2_CORE__FunctionPlugin = LV2_CORE_PREFIX ~ "FunctionPlugin" ; ///< http://lv2plug.in/ns/lv2core#FunctionPlugin 54 enum LV2_CORE__GatePlugin = LV2_CORE_PREFIX ~ "GatePlugin" ; ///< http://lv2plug.in/ns/lv2core#GatePlugin 55 enum LV2_CORE__GeneratorPlugin = LV2_CORE_PREFIX ~ "GeneratorPlugin" ; ///< http://lv2plug.in/ns/lv2core#GeneratorPlugin 56 enum LV2_CORE__HighpassPlugin = LV2_CORE_PREFIX ~ "HighpassPlugin" ; ///< http://lv2plug.in/ns/lv2core#HighpassPlugin 57 enum LV2_CORE__InputPort = LV2_CORE_PREFIX ~ "InputPort" ; ///< http://lv2plug.in/ns/lv2core#InputPort 58 enum LV2_CORE__InstrumentPlugin = LV2_CORE_PREFIX ~ "InstrumentPlugin" ; ///< http://lv2plug.in/ns/lv2core#InstrumentPlugin 59 enum LV2_CORE__LimiterPlugin = LV2_CORE_PREFIX ~ "LimiterPlugin" ; ///< http://lv2plug.in/ns/lv2core#LimiterPlugin 60 enum LV2_CORE__LowpassPlugin = LV2_CORE_PREFIX ~ "LowpassPlugin" ; ///< http://lv2plug.in/ns/lv2core#LowpassPlugin 61 enum LV2_CORE__MixerPlugin = LV2_CORE_PREFIX ~ "MixerPlugin" ; ///< http://lv2plug.in/ns/lv2core#MixerPlugin 62 enum LV2_CORE__ModulatorPlugin = LV2_CORE_PREFIX ~ "ModulatorPlugin" ; ///< http://lv2plug.in/ns/lv2core#ModulatorPlugin 63 enum LV2_CORE__MultiEQPlugin = LV2_CORE_PREFIX ~ "MultiEQPlugin" ; ///< http://lv2plug.in/ns/lv2core#MultiEQPlugin 64 enum LV2_CORE__OscillatorPlugin = LV2_CORE_PREFIX ~ "OscillatorPlugin" ; ///< http://lv2plug.in/ns/lv2core#OscillatorPlugin 65 enum LV2_CORE__OutputPort = LV2_CORE_PREFIX ~ "OutputPort" ; ///< http://lv2plug.in/ns/lv2core#OutputPort 66 enum LV2_CORE__ParaEQPlugin = LV2_CORE_PREFIX ~ "ParaEQPlugin" ; ///< http://lv2plug.in/ns/lv2core#ParaEQPlugin 67 enum LV2_CORE__PhaserPlugin = LV2_CORE_PREFIX ~ "PhaserPlugin" ; ///< http://lv2plug.in/ns/lv2core#PhaserPlugin 68 enum LV2_CORE__PitchPlugin = LV2_CORE_PREFIX ~ "PitchPlugin" ; ///< http://lv2plug.in/ns/lv2core#PitchPlugin 69 enum LV2_CORE__Plugin = LV2_CORE_PREFIX ~ "Plugin" ; ///< http://lv2plug.in/ns/lv2core#Plugin 70 enum LV2_CORE__PluginBase = LV2_CORE_PREFIX ~ "PluginBase" ; ///< http://lv2plug.in/ns/lv2core#PluginBase 71 enum LV2_CORE__Point = LV2_CORE_PREFIX ~ "Point" ; ///< http://lv2plug.in/ns/lv2core#Point 72 enum LV2_CORE__Port = LV2_CORE_PREFIX ~ "Port" ; ///< http://lv2plug.in/ns/lv2core#Port 73 enum LV2_CORE__PortProperty = LV2_CORE_PREFIX ~ "PortProperty" ; ///< http://lv2plug.in/ns/lv2core#PortProperty 74 enum LV2_CORE__Resource = LV2_CORE_PREFIX ~ "Resource" ; ///< http://lv2plug.in/ns/lv2core#Resource 75 enum LV2_CORE__ReverbPlugin = LV2_CORE_PREFIX ~ "ReverbPlugin" ; ///< http://lv2plug.in/ns/lv2core#ReverbPlugin 76 enum LV2_CORE__ScalePoint = LV2_CORE_PREFIX ~ "ScalePoint" ; ///< http://lv2plug.in/ns/lv2core#ScalePoint 77 enum LV2_CORE__SimulatorPlugin = LV2_CORE_PREFIX ~ "SimulatorPlugin" ; ///< http://lv2plug.in/ns/lv2core#SimulatorPlugin 78 enum LV2_CORE__SpatialPlugin = LV2_CORE_PREFIX ~ "SpatialPlugin" ; ///< http://lv2plug.in/ns/lv2core#SpatialPlugin 79 enum LV2_CORE__Specification = LV2_CORE_PREFIX ~ "Specification" ; ///< http://lv2plug.in/ns/lv2core#Specification 80 enum LV2_CORE__SpectralPlugin = LV2_CORE_PREFIX ~ "SpectralPlugin" ; ///< http://lv2plug.in/ns/lv2core#SpectralPlugin 81 enum LV2_CORE__UtilityPlugin = LV2_CORE_PREFIX ~ "UtilityPlugin" ; ///< http://lv2plug.in/ns/lv2core#UtilityPlugin 82 enum LV2_CORE__WaveshaperPlugin = LV2_CORE_PREFIX ~ "WaveshaperPlugin" ; ///< http://lv2plug.in/ns/lv2core#WaveshaperPlugin 83 enum LV2_CORE__appliesTo = LV2_CORE_PREFIX ~ "appliesTo" ; ///< http://lv2plug.in/ns/lv2core#appliesTo 84 enum LV2_CORE__binary = LV2_CORE_PREFIX ~ "binary" ; ///< http://lv2plug.in/ns/lv2core#binary 85 enum LV2_CORE__connectionOptional = LV2_CORE_PREFIX ~ "connectionOptional" ; ///< http://lv2plug.in/ns/lv2core#connectionOptional 86 enum LV2_CORE__control = LV2_CORE_PREFIX ~ "control" ; ///< http://lv2plug.in/ns/lv2core#control 87 enum LV2_CORE__default = LV2_CORE_PREFIX ~ "default" ; ///< http://lv2plug.in/ns/lv2core#default 88 enum LV2_CORE__designation = LV2_CORE_PREFIX ~ "designation" ; ///< http://lv2plug.in/ns/lv2core#designation 89 enum LV2_CORE__documentation = LV2_CORE_PREFIX ~ "documentation" ; ///< http://lv2plug.in/ns/lv2core#documentation 90 enum LV2_CORE__enumeration = LV2_CORE_PREFIX ~ "enumeration" ; ///< http://lv2plug.in/ns/lv2core#enumeration 91 enum LV2_CORE__extensionData = LV2_CORE_PREFIX ~ "extensionData" ; ///< http://lv2plug.in/ns/lv2core#extensionData 92 enum LV2_CORE__freeWheeling = LV2_CORE_PREFIX ~ "freeWheeling" ; ///< http://lv2plug.in/ns/lv2core#freeWheeling 93 enum LV2_CORE__hardRTCapable = LV2_CORE_PREFIX ~ "hardRTCapable" ; ///< http://lv2plug.in/ns/lv2core#hardRTCapable 94 enum LV2_CORE__inPlaceBroken = LV2_CORE_PREFIX ~ "inPlaceBroken" ; ///< http://lv2plug.in/ns/lv2core#inPlaceBroken 95 enum LV2_CORE__index = LV2_CORE_PREFIX ~ "index" ; ///< http://lv2plug.in/ns/lv2core#index 96 enum LV2_CORE__integer = LV2_CORE_PREFIX ~ "integer" ; ///< http://lv2plug.in/ns/lv2core#integer 97 enum LV2_CORE__isLive = LV2_CORE_PREFIX ~ "isLive" ; ///< http://lv2plug.in/ns/lv2core#isLive 98 enum LV2_CORE__latency = LV2_CORE_PREFIX ~ "latency" ; ///< http://lv2plug.in/ns/lv2core#latency 99 enum LV2_CORE__maximum = LV2_CORE_PREFIX ~ "maximum" ; ///< http://lv2plug.in/ns/lv2core#maximum 100 enum LV2_CORE__microVersion = LV2_CORE_PREFIX ~ "microVersion" ; ///< http://lv2plug.in/ns/lv2core#microVersion 101 enum LV2_CORE__minimum = LV2_CORE_PREFIX ~ "minimum" ; ///< http://lv2plug.in/ns/lv2core#minimum 102 enum LV2_CORE__minorVersion = LV2_CORE_PREFIX ~ "minorVersion" ; ///< http://lv2plug.in/ns/lv2core#minorVersion 103 enum LV2_CORE__name = LV2_CORE_PREFIX ~ "name" ; ///< http://lv2plug.in/ns/lv2core#name 104 enum LV2_CORE__optionalFeature = LV2_CORE_PREFIX ~ "optionalFeature" ; ///< http://lv2plug.in/ns/lv2core#optionalFeature 105 enum LV2_CORE__port = LV2_CORE_PREFIX ~ "port" ; ///< http://lv2plug.in/ns/lv2core#port 106 enum LV2_CORE__portProperty = LV2_CORE_PREFIX ~ "portProperty" ; ///< http://lv2plug.in/ns/lv2core#portProperty 107 enum LV2_CORE__project = LV2_CORE_PREFIX ~ "project" ; ///< http://lv2plug.in/ns/lv2core#project 108 enum LV2_CORE__prototype = LV2_CORE_PREFIX ~ "prototype" ; ///< http://lv2plug.in/ns/lv2core#prototype 109 enum LV2_CORE__reportsLatency = LV2_CORE_PREFIX ~ "reportsLatency" ; ///< http://lv2plug.in/ns/lv2core#reportsLatency 110 enum LV2_CORE__requiredFeature = LV2_CORE_PREFIX ~ "requiredFeature" ; ///< http://lv2plug.in/ns/lv2core#requiredFeature 111 enum LV2_CORE__sampleRate = LV2_CORE_PREFIX ~ "sampleRate" ; ///< http://lv2plug.in/ns/lv2core#sampleRate 112 enum LV2_CORE__scalePoint = LV2_CORE_PREFIX ~ "scalePoint" ; ///< http://lv2plug.in/ns/lv2core#scalePoint 113 enum LV2_CORE__symbol = LV2_CORE_PREFIX ~ "symbol" ; ///< http://lv2plug.in/ns/lv2core#symbol 114 enum LV2_CORE__toggled = LV2_CORE_PREFIX ~ "toggled" ; ///< http://lv2plug.in/ns/lv2core#toggled 115 116 extern(C): 117 nothrow: 118 @nogc: 119 120 /** 121 Plugin Instance Handle. 122 123 This is a handle for one particular instance of a plugin. It is valid to 124 compare to NULL (or 0 for C++) but otherwise the host MUST NOT attempt to 125 interpret it. 126 */ 127 alias LV2_Handle = void *; 128 129 /** 130 Feature. 131 132 Features allow hosts to make additional functionality available to plugins 133 without requiring modification to the LV2 API. Extensions may define new 134 features and specify the `URI` and `data` to be used if necessary. 135 Some features, such as lv2:isLive, do not require the host to pass data. 136 */ 137 struct LV2_Feature 138 { 139 /** 140 A globally unique, case-sensitive identifier (URI) for this feature. 141 142 This MUST be a valid URI string as defined by RFC 3986. 143 */ 144 const(char)* URI; 145 146 /** 147 Pointer to arbitrary data. 148 149 The format of this data is defined by the extension which describes the 150 feature with the given `URI`. 151 */ 152 void * data; 153 } 154 155 /** 156 Plugin Descriptor. 157 158 This structure provides the core functions necessary to instantiate and use 159 a plugin. 160 */ 161 struct LV2_Descriptor 162 { 163 nothrow: 164 @nogc: 165 extern(C): 166 /** 167 A globally unique, case-sensitive identifier for this plugin. 168 169 This MUST be a valid URI string as defined by RFC 3986. All plugins with 170 the same URI MUST be compatible to some degree, see 171 http://lv2plug.in/ns/lv2core for details. 172 */ 173 const(char) * URI; 174 175 /** 176 Instantiate the plugin. 177 178 Note that instance initialisation should generally occur in activate() 179 rather than here. If a host calls instantiate(), it MUST call cleanup() 180 at some point in the future. 181 182 @param descriptor Descriptor of the plugin to instantiate. 183 184 @param sample_rate Sample rate, in Hz, for the new plugin instance. 185 186 @param bundle_path Path to the LV2 bundle which contains this plugin 187 binary. It MUST include the trailing directory separator (e.g. '/') so 188 that simply appending a filename will yield the path to that file in the 189 bundle. 190 191 @param features A NULL terminated array of LV2_Feature structs which 192 represent the features the host supports. Plugins may refuse to 193 instantiate if required features are not found here. However, hosts MUST 194 NOT use this as a discovery mechanism: instead, use the RDF data to 195 determine which features are required and do not attempt to instantiate 196 unsupported plugins at all. This parameter MUST NOT be NULL, i.e. a host 197 that supports no features MUST pass a single element array containing 198 NULL. 199 200 @return A handle for the new plugin instance, or NULL if instantiation 201 has failed. 202 */ 203 // LV2_Handle (*instantiate)(const struct _LV2_Descriptor * descriptor, 204 // double sample_rate, 205 // const char * bundle_path, 206 // const LV2_Feature *const * features); 207 LV2_Handle function(const LV2_Descriptor * descriptor, 208 double sample_rate, 209 const char * bundle_path, 210 const(LV2_Feature*)* features) nothrow @nogc instantiate; 211 212 /** 213 Connect a port on a plugin instance to a memory location. 214 215 Plugin writers should be aware that the host may elect to use the same 216 buffer for more than one port and even use the same buffer for both 217 input and output (see lv2:inPlaceBroken in lv2.ttl). 218 219 If the plugin has the feature lv2:hardRTCapable then there are various 220 things that the plugin MUST NOT do within the connect_port() function; 221 see lv2core.ttl for details. 222 223 connect_port() MUST be called at least once for each port before run() 224 is called, unless that port is lv2:connectionOptional. The plugin must 225 pay careful attention to the block size passed to run() since the block 226 allocated may only just be large enough to contain the data, and is not 227 guaranteed to remain constant between run() calls. 228 229 connect_port() may be called more than once for a plugin instance to 230 allow the host to change the buffers that the plugin is reading or 231 writing. These calls may be made before or after activate() or 232 deactivate() calls. 233 234 @param instance Plugin instance containing the port. 235 236 @param port Index of the port to connect. The host MUST NOT try to 237 connect a port index that is not defined in the plugin's RDF data. If 238 it does, the plugin's behaviour is undefined (a crash is likely). 239 240 @param data_location Pointer to data of the type defined by the port 241 type in the plugin's RDF data (e.g. an array of float for an 242 lv2:AudioPort). This pointer must be stored by the plugin instance and 243 used to read/write data when run() is called. Data present at the time 244 of the connect_port() call MUST NOT be considered meaningful. 245 */ 246 // void (*connect_port)(LV2_Handle instance, 247 // uint32_t port, 248 // void * data_location); 249 void function(LV2_Handle instance, 250 uint32_t port, 251 void * data_location) connect_port; 252 253 /** 254 Initialise a plugin instance and activate it for use. 255 256 This is separated from instantiate() to aid real-time support and so 257 that hosts can reinitialise a plugin instance by calling deactivate() 258 and then activate(). In this case the plugin instance MUST reset all 259 state information dependent on the history of the plugin instance except 260 for any data locations provided by connect_port(). If there is nothing 261 for activate() to do then this field may be NULL. 262 263 When present, hosts MUST call this function once before run() is called 264 for the first time. This call SHOULD be made as close to the run() call 265 as possible and indicates to real-time plugins that they are now live, 266 however plugins MUST NOT rely on a prompt call to run() after 267 activate(). 268 269 The host MUST NOT call activate() again until deactivate() has been 270 called first. If a host calls activate(), it MUST call deactivate() at 271 some point in the future. Note that connect_port() may be called before 272 or after activate(). 273 */ 274 // void (*activate)(LV2_Handle instance); 275 void function(LV2_Handle instance) activate; 276 277 /** 278 Run a plugin instance for a block. 279 280 Note that if an activate() function exists then it must be called before 281 run(). If deactivate() is called for a plugin instance then run() may 282 not be called until activate() has been called again. 283 284 If the plugin has the feature lv2:hardRTCapable then there are various 285 things that the plugin MUST NOT do within the run() function (see 286 lv2core.ttl for details). 287 288 As a special case, when `sample_count` is 0, the plugin should update 289 any output ports that represent a single instant in time (e.g. control 290 ports, but not audio ports). This is particularly useful for latent 291 plugins, which should update their latency output port so hosts can 292 pre-roll plugins to compute latency. Plugins MUST NOT crash when 293 `sample_count` is 0. 294 295 @param instance Instance to be run. 296 297 @param sample_count The block size (in samples) for which the plugin 298 instance must run. 299 */ 300 // void (*run)(LV2_Handle instance, 301 // uint32_t sample_count); 302 void function(LV2_Handle instance, 303 uint32_t sample_count) run; 304 305 /** 306 Deactivate a plugin instance (counterpart to activate()). 307 308 Hosts MUST deactivate all activated instances after they have been run() 309 for the last time. This call SHOULD be made as close to the last run() 310 call as possible and indicates to real-time plugins that they are no 311 longer live, however plugins MUST NOT rely on prompt deactivation. If 312 there is nothing for deactivate() to do then this field may be NULL 313 314 Deactivation is not similar to pausing since the plugin instance will be 315 reinitialised by activate(). However, deactivate() itself MUST NOT fully 316 reset plugin state. For example, the host may deactivate a plugin, then 317 store its state (using some extension to do so). 318 319 Hosts MUST NOT call deactivate() unless activate() was previously 320 called. Note that connect_port() may be called before or after 321 deactivate(). 322 */ 323 // void (*deactivate)(LV2_Handle instance); 324 void function(LV2_Handle instance) deactivate; 325 326 /** 327 Clean up a plugin instance (counterpart to instantiate()). 328 329 Once an instance of a plugin has been finished with it must be deleted 330 using this function. The instance handle passed ceases to be valid after 331 this call. 332 333 If activate() was called for a plugin instance then a corresponding call 334 to deactivate() MUST be made before cleanup() is called. Hosts MUST NOT 335 call cleanup() unless instantiate() was previously called. 336 */ 337 // void (*cleanup)(LV2_Handle instance); 338 void function(LV2_Handle instance) cleanup; 339 340 /** 341 Return additional plugin data defined by some extenion. 342 343 A typical use of this facility is to return a struct containing function 344 pointers to extend the LV2_Descriptor API. 345 346 The actual type and meaning of the returned object MUST be specified 347 precisely by the extension. This function MUST return NULL for any 348 unsupported URI. If a plugin does not support any extension data, this 349 field may be NULL. 350 351 The host is never responsible for freeing the returned value. 352 */ 353 // const void * (*extension_data)(const char * uri); 354 const (void) * function(const char * uri) extension_data; 355 } 356 357 //extern(C) const (LV2_Descriptor)* lv2_descriptor(uint32_t index); 358 359 /** 360 Type of the lv2_descriptor() function in a library (old discovery API). 361 */ 362 const LV2_Descriptor * function(uint32_t index) LV2_Descriptor_Function; 363 364 365 366 // Some extensions 367 368 // bufsize.h 369 370 enum LV2_BUF_SIZE_URI = "http://lv2plug.in/ns/ext/buf-size"; ///< http://lv2plug.in/ns/ext/buf-size 371 enum LV2_BUF_SIZE_PREFIX = LV2_BUF_SIZE_URI ~ "#"; ///< http://lv2plug.in/ns/ext/buf-size# 372 373 enum LV2_BUF_SIZE__boundedBlockLength = LV2_BUF_SIZE_PREFIX ~ "boundedBlockLength"; ///< http://lv2plug.in/ns/ext/buf-size#boundedBlockLength 374 enum LV2_BUF_SIZE__fixedBlockLength = LV2_BUF_SIZE_PREFIX ~ "fixedBlockLength"; ///< http://lv2plug.in/ns/ext/buf-size#fixedBlockLength 375 enum LV2_BUF_SIZE__maxBlockLength = LV2_BUF_SIZE_PREFIX ~ "maxBlockLength"; ///< http://lv2plug.in/ns/ext/buf-size#maxBlockLength 376 enum LV2_BUF_SIZE__minBlockLength = LV2_BUF_SIZE_PREFIX ~ "minBlockLength"; ///< http://lv2plug.in/ns/ext/buf-size#minBlockLength 377 enum LV2_BUF_SIZE__nominalBlockLength = LV2_BUF_SIZE_PREFIX ~ "nominalBlockLength"; ///< http://lv2plug.in/ns/ext/buf-size#nominalBlockLength 378 enum LV2_BUF_SIZE__powerOf2BlockLength = LV2_BUF_SIZE_PREFIX ~ "powerOf2BlockLength"; ///< http://lv2plug.in/ns/ext/buf-size#powerOf2BlockLength 379 enum LV2_BUF_SIZE__sequenceSize = LV2_BUF_SIZE_PREFIX ~ "sequenceSize"; ///< http://lv2plug.in/ns/ext/buf-size#sequenceSize 380 381 382 // kxstudio.h 383 384 enum LV2_KXSTUDIO_PROPERTIES_URI = "http://kxstudio.sf.net/ns/lv2ext/props"; 385 enum LV2_KXSTUDIO_PROPERTIES_PREFIX = LV2_KXSTUDIO_PROPERTIES_URI ~ "#"; 386 387 enum LV2_KXSTUDIO_PROPERTIES__NonAutomable = LV2_KXSTUDIO_PROPERTIES_PREFIX ~ "NonAutomable"; 388 enum LV2_KXSTUDIO_PROPERTIES__TimePositionTicksPerBeat = LV2_KXSTUDIO_PROPERTIES_PREFIX ~ "TimePositionTicksPerBeat"; 389 enum LV2_KXSTUDIO_PROPERTIES__TransientWindowId = LV2_KXSTUDIO_PROPERTIES_PREFIX ~ "TransientWindowId"; 390 391 // time.h 392 393 enum LV2_TIME_URI = "http://lv2plug.in/ns/ext/time"; ///< http://lv2plug.in/ns/ext/time 394 enum LV2_TIME_PREFIX = LV2_TIME_URI ~ "#"; ///< http://lv2plug.in/ns/ext/time# 395 396 enum LV2_TIME__Time = LV2_TIME_PREFIX ~ "Time"; ///< http://lv2plug.in/ns/ext/time#Time 397 enum LV2_TIME__Position = LV2_TIME_PREFIX ~ "Position"; ///< http://lv2plug.in/ns/ext/time#Position 398 enum LV2_TIME__Rate = LV2_TIME_PREFIX ~ "Rate"; ///< http://lv2plug.in/ns/ext/time#Rate 399 enum LV2_TIME__position = LV2_TIME_PREFIX ~ "position"; ///< http://lv2plug.in/ns/ext/time#position 400 enum LV2_TIME__barBeat = LV2_TIME_PREFIX ~ "barBeat"; ///< http://lv2plug.in/ns/ext/time#barBeat 401 enum LV2_TIME__bar = LV2_TIME_PREFIX ~ "bar"; ///< http://lv2plug.in/ns/ext/time#bar 402 enum LV2_TIME__beat = LV2_TIME_PREFIX ~ "beat"; ///< http://lv2plug.in/ns/ext/time#beat 403 enum LV2_TIME__beatUnit = LV2_TIME_PREFIX ~ "beatUnit"; ///< http://lv2plug.in/ns/ext/time#beatUnit 404 enum LV2_TIME__beatsPerBar = LV2_TIME_PREFIX ~ "beatsPerBar"; ///< http://lv2plug.in/ns/ext/time#beatsPerBar 405 enum LV2_TIME__beatsPerMinute = LV2_TIME_PREFIX ~ "beatsPerMinute"; ///< http://lv2plug.in/ns/ext/time#beatsPerMinute 406 enum LV2_TIME__frame = LV2_TIME_PREFIX ~ "frame"; ///< http://lv2plug.in/ns/ext/time#frame 407 enum LV2_TIME__framesPerSecond = LV2_TIME_PREFIX ~ "framesPerSecond"; ///< http://lv2plug.in/ns/ext/time#framesPerSecond 408 enum LV2_TIME__speed = LV2_TIME_PREFIX ~ "speed"; ///< http://lv2plug.in/ns/ext/time#speed 409 410 411 // lv2util.h 412 413 /** 414 Return the data for a feature in a features array. 415 416 If the feature is not found, NULL is returned. Note that this function is 417 only useful for features with data, and can not detect features that are 418 present but have NULL data. 419 */ 420 void* lv2_features_data(const (LV2_Feature*)* features, const char* uri) nothrow @nogc 421 { 422 if (features) { 423 for (const (LV2_Feature*)* f = features; *f; ++f) { 424 if (!strcmp(uri, (*f).URI)) { 425 return cast(void*)(*f).data; 426 } 427 } 428 } 429 return null; 430 }