annotate win32-mingw/include/vamp/vamp.h @ 119:fba6405099d2

Update C++ libraries using libc++ on OS/X
author Chris Cannam <cannam@all-day-breakfast.com>
date Wed, 11 Mar 2015 13:30:03 +0000
parents c6e1ae789cfb
children
rev   line source
cannam@99 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@99 2
cannam@99 3 /*
cannam@99 4 Vamp
cannam@99 5
cannam@99 6 An API for audio analysis and feature extraction plugins.
cannam@99 7
cannam@99 8 Centre for Digital Music, Queen Mary, University of London.
cannam@99 9 Copyright 2006 Chris Cannam.
cannam@99 10
cannam@99 11 Permission is hereby granted, free of charge, to any person
cannam@99 12 obtaining a copy of this software and associated documentation
cannam@99 13 files (the "Software"), to deal in the Software without
cannam@99 14 restriction, including without limitation the rights to use, copy,
cannam@99 15 modify, merge, publish, distribute, sublicense, and/or sell copies
cannam@99 16 of the Software, and to permit persons to whom the Software is
cannam@99 17 furnished to do so, subject to the following conditions:
cannam@99 18
cannam@99 19 The above copyright notice and this permission notice shall be
cannam@99 20 included in all copies or substantial portions of the Software.
cannam@99 21
cannam@99 22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
cannam@99 23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
cannam@99 24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
cannam@99 25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
cannam@99 26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
cannam@99 27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
cannam@99 28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
cannam@99 29
cannam@99 30 Except as contained in this notice, the names of the Centre for
cannam@99 31 Digital Music; Queen Mary, University of London; and Chris Cannam
cannam@99 32 shall not be used in advertising or otherwise to promote the sale,
cannam@99 33 use or other dealings in this Software without prior written
cannam@99 34 authorization.
cannam@99 35 */
cannam@99 36
cannam@99 37 #ifndef VAMP_HEADER_INCLUDED
cannam@99 38 #define VAMP_HEADER_INCLUDED
cannam@99 39
cannam@99 40 #ifdef __cplusplus
cannam@99 41 extern "C" {
cannam@99 42 #endif
cannam@99 43
cannam@99 44 /**
cannam@99 45 * Plugin API version. This is incremented when a change is made that
cannam@99 46 * changes the binary layout of the descriptor records. When this
cannam@99 47 * happens, there should be a mechanism for retaining compatibility
cannam@99 48 * with older hosts and/or plugins.
cannam@99 49 *
cannam@99 50 * See also the vampApiVersion field in the plugin descriptor, and the
cannam@99 51 * hostApiVersion argument to the vampGetPluginDescriptor function.
cannam@99 52 */
cannam@99 53 #define VAMP_API_VERSION 2
cannam@99 54
cannam@99 55 /**
cannam@99 56 * C language API for Vamp plugins.
cannam@99 57 *
cannam@99 58 * This is the formal plugin API for Vamp. Plugin authors may prefer
cannam@99 59 * to use the C++ classes provided in the Vamp plugin SDK, instead of
cannam@99 60 * using this API directly. There is an adapter class provided that
cannam@99 61 * makes C++ plugins available using this C API with relatively little
cannam@99 62 * work, and the C++ headers are more thoroughly documented.
cannam@99 63 *
cannam@99 64 * IMPORTANT: The comments in this file summarise the purpose of each
cannam@99 65 * of the declared fields and functions, but do not provide a complete
cannam@99 66 * guide to their permitted values and expected usage. Please refer
cannam@99 67 * to the C++ headers in the Vamp plugin SDK for further details and
cannam@99 68 * plugin lifecycle documentation.
cannam@99 69 */
cannam@99 70
cannam@99 71 typedef struct _VampParameterDescriptor
cannam@99 72 {
cannam@99 73 /** Computer-usable name of the parameter. Must not change. [a-zA-Z0-9_] */
cannam@99 74 const char *identifier;
cannam@99 75
cannam@99 76 /** Human-readable name of the parameter. May be translatable. */
cannam@99 77 const char *name;
cannam@99 78
cannam@99 79 /** Human-readable short text about the parameter. May be translatable. */
cannam@99 80 const char *description;
cannam@99 81
cannam@99 82 /** Human-readable unit of the parameter. */
cannam@99 83 const char *unit;
cannam@99 84
cannam@99 85 /** Minimum value. */
cannam@99 86 float minValue;
cannam@99 87
cannam@99 88 /** Maximum value. */
cannam@99 89 float maxValue;
cannam@99 90
cannam@99 91 /** Default value. Plugin is responsible for setting this on initialise. */
cannam@99 92 float defaultValue;
cannam@99 93
cannam@99 94 /** 1 if parameter values are quantized to a particular resolution. */
cannam@99 95 int isQuantized;
cannam@99 96
cannam@99 97 /** Quantization resolution, if isQuantized. */
cannam@99 98 float quantizeStep;
cannam@99 99
cannam@99 100 /** Human-readable names of the values, if isQuantized. May be NULL. */
cannam@99 101 const char **valueNames;
cannam@99 102
cannam@99 103 } VampParameterDescriptor;
cannam@99 104
cannam@99 105 typedef enum
cannam@99 106 {
cannam@99 107 /** Each process call returns results aligned with call's block start. */
cannam@99 108 vampOneSamplePerStep,
cannam@99 109
cannam@99 110 /** Returned results are evenly spaced at samplerate specified below. */
cannam@99 111 vampFixedSampleRate,
cannam@99 112
cannam@99 113 /** Returned results have their own individual timestamps. */
cannam@99 114 vampVariableSampleRate
cannam@99 115
cannam@99 116 } VampSampleType;
cannam@99 117
cannam@99 118 typedef struct _VampOutputDescriptor
cannam@99 119 {
cannam@99 120 /** Computer-usable name of the output. Must not change. [a-zA-Z0-9_] */
cannam@99 121 const char *identifier;
cannam@99 122
cannam@99 123 /** Human-readable name of the output. May be translatable. */
cannam@99 124 const char *name;
cannam@99 125
cannam@99 126 /** Human-readable short text about the output. May be translatable. */
cannam@99 127 const char *description;
cannam@99 128
cannam@99 129 /** Human-readable name of the unit of the output. */
cannam@99 130 const char *unit;
cannam@99 131
cannam@99 132 /** 1 if output has equal number of values for each returned result. */
cannam@99 133 int hasFixedBinCount;
cannam@99 134
cannam@99 135 /** Number of values per result, if hasFixedBinCount. */
cannam@99 136 unsigned int binCount;
cannam@99 137
cannam@99 138 /** Names of returned value bins, if hasFixedBinCount. May be NULL. */
cannam@99 139 const char **binNames;
cannam@99 140
cannam@99 141 /** 1 if each returned value falls within the same fixed min/max range. */
cannam@99 142 int hasKnownExtents;
cannam@99 143
cannam@99 144 /** Minimum value for a returned result in any bin, if hasKnownExtents. */
cannam@99 145 float minValue;
cannam@99 146
cannam@99 147 /** Maximum value for a returned result in any bin, if hasKnownExtents. */
cannam@99 148 float maxValue;
cannam@99 149
cannam@99 150 /** 1 if returned results are quantized to a particular resolution. */
cannam@99 151 int isQuantized;
cannam@99 152
cannam@99 153 /** Quantization resolution for returned results, if isQuantized. */
cannam@99 154 float quantizeStep;
cannam@99 155
cannam@99 156 /** Time positioning method for returned results (see VampSampleType). */
cannam@99 157 VampSampleType sampleType;
cannam@99 158
cannam@99 159 /** Sample rate of returned results, if sampleType is vampFixedSampleRate.
cannam@99 160 "Resolution" of result, if sampleType is vampVariableSampleRate. */
cannam@99 161 float sampleRate;
cannam@99 162
cannam@99 163 /** 1 if the returned results for this output are known to have a
cannam@99 164 duration field.
cannam@99 165
cannam@99 166 This field is new in Vamp API version 2; it must not be tested
cannam@99 167 for plugins that report an older API version in their plugin
cannam@99 168 descriptor.
cannam@99 169 */
cannam@99 170 int hasDuration;
cannam@99 171
cannam@99 172 } VampOutputDescriptor;
cannam@99 173
cannam@99 174 typedef struct _VampFeature
cannam@99 175 {
cannam@99 176 /** 1 if the feature has a timestamp (i.e. if vampVariableSampleRate). */
cannam@99 177 int hasTimestamp;
cannam@99 178
cannam@99 179 /** Seconds component of timestamp. */
cannam@99 180 int sec;
cannam@99 181
cannam@99 182 /** Nanoseconds component of timestamp. */
cannam@99 183 int nsec;
cannam@99 184
cannam@99 185 /** Number of values. Must be binCount if hasFixedBinCount. */
cannam@99 186 unsigned int valueCount;
cannam@99 187
cannam@99 188 /** Values for this returned sample. */
cannam@99 189 float *values;
cannam@99 190
cannam@99 191 /** Label for this returned sample. May be NULL. */
cannam@99 192 char *label;
cannam@99 193
cannam@99 194 } VampFeature;
cannam@99 195
cannam@99 196 typedef struct _VampFeatureV2
cannam@99 197 {
cannam@99 198 /** 1 if the feature has a duration. */
cannam@99 199 int hasDuration;
cannam@99 200
cannam@99 201 /** Seconds component of duratiion. */
cannam@99 202 int durationSec;
cannam@99 203
cannam@99 204 /** Nanoseconds component of duration. */
cannam@99 205 int durationNsec;
cannam@99 206
cannam@99 207 } VampFeatureV2;
cannam@99 208
cannam@99 209 typedef union _VampFeatureUnion
cannam@99 210 {
cannam@99 211 // sizeof(featureV1) >= sizeof(featureV2) for backward compatibility
cannam@99 212 VampFeature v1;
cannam@99 213 VampFeatureV2 v2;
cannam@99 214
cannam@99 215 } VampFeatureUnion;
cannam@99 216
cannam@99 217 typedef struct _VampFeatureList
cannam@99 218 {
cannam@99 219 /** Number of features in this feature list. */
cannam@99 220 unsigned int featureCount;
cannam@99 221
cannam@99 222 /** Features in this feature list. May be NULL if featureCount is
cannam@99 223 zero.
cannam@99 224
cannam@99 225 If present, this array must contain featureCount feature
cannam@99 226 structures for a Vamp API version 1 plugin, or 2*featureCount
cannam@99 227 feature unions for a Vamp API version 2 plugin.
cannam@99 228
cannam@99 229 The features returned by an API version 2 plugin must consist
cannam@99 230 of the same feature structures as in API version 1 for the
cannam@99 231 first featureCount array elements, followed by featureCount
cannam@99 232 unions that contain VampFeatureV2 structures (or NULL pointers
cannam@99 233 if no V2 feature structures are present).
cannam@99 234 */
cannam@99 235 VampFeatureUnion *features;
cannam@99 236
cannam@99 237 } VampFeatureList;
cannam@99 238
cannam@99 239 typedef enum
cannam@99 240 {
cannam@99 241 vampTimeDomain,
cannam@99 242 vampFrequencyDomain
cannam@99 243
cannam@99 244 } VampInputDomain;
cannam@99 245
cannam@99 246 typedef void *VampPluginHandle;
cannam@99 247
cannam@99 248 typedef struct _VampPluginDescriptor
cannam@99 249 {
cannam@99 250 /** API version with which this descriptor is compatible. */
cannam@99 251 unsigned int vampApiVersion;
cannam@99 252
cannam@99 253 /** Computer-usable name of the plugin. Must not change. [a-zA-Z0-9_] */
cannam@99 254 const char *identifier;
cannam@99 255
cannam@99 256 /** Human-readable name of the plugin. May be translatable. */
cannam@99 257 const char *name;
cannam@99 258
cannam@99 259 /** Human-readable short text about the plugin. May be translatable. */
cannam@99 260 const char *description;
cannam@99 261
cannam@99 262 /** Human-readable name of plugin's author or vendor. */
cannam@99 263 const char *maker;
cannam@99 264
cannam@99 265 /** Version number of the plugin. */
cannam@99 266 int pluginVersion;
cannam@99 267
cannam@99 268 /** Human-readable summary of copyright or licensing for plugin. */
cannam@99 269 const char *copyright;
cannam@99 270
cannam@99 271 /** Number of parameter inputs. */
cannam@99 272 unsigned int parameterCount;
cannam@99 273
cannam@99 274 /** Fixed descriptors for parameter inputs. */
cannam@99 275 const VampParameterDescriptor **parameters;
cannam@99 276
cannam@99 277 /** Number of programs. */
cannam@99 278 unsigned int programCount;
cannam@99 279
cannam@99 280 /** Fixed names for programs. */
cannam@99 281 const char **programs;
cannam@99 282
cannam@99 283 /** Preferred input domain for audio input (time or frequency). */
cannam@99 284 VampInputDomain inputDomain;
cannam@99 285
cannam@99 286 /** Create and return a new instance of this plugin. */
cannam@99 287 VampPluginHandle (*instantiate)(const struct _VampPluginDescriptor *,
cannam@99 288 float inputSampleRate);
cannam@99 289
cannam@99 290 /** Destroy an instance of this plugin. */
cannam@99 291 void (*cleanup)(VampPluginHandle);
cannam@99 292
cannam@99 293 /** Initialise an instance following parameter configuration. */
cannam@99 294 int (*initialise)(VampPluginHandle,
cannam@99 295 unsigned int inputChannels,
cannam@99 296 unsigned int stepSize,
cannam@99 297 unsigned int blockSize);
cannam@99 298
cannam@99 299 /** Reset an instance, ready to use again on new input data. */
cannam@99 300 void (*reset)(VampPluginHandle);
cannam@99 301
cannam@99 302 /** Get a parameter value. */
cannam@99 303 float (*getParameter)(VampPluginHandle, int);
cannam@99 304
cannam@99 305 /** Set a parameter value. May only be called before initialise. */
cannam@99 306 void (*setParameter)(VampPluginHandle, int, float);
cannam@99 307
cannam@99 308 /** Get the current program (if programCount > 0). */
cannam@99 309 unsigned int (*getCurrentProgram)(VampPluginHandle);
cannam@99 310
cannam@99 311 /** Set the current program. May only be called before initialise. */
cannam@99 312 void (*selectProgram)(VampPluginHandle, unsigned int);
cannam@99 313
cannam@99 314 /** Get the plugin's preferred processing window increment in samples. */
cannam@99 315 unsigned int (*getPreferredStepSize)(VampPluginHandle);
cannam@99 316
cannam@99 317 /** Get the plugin's preferred processing window size in samples. */
cannam@99 318 unsigned int (*getPreferredBlockSize)(VampPluginHandle);
cannam@99 319
cannam@99 320 /** Get the minimum number of input channels this plugin can handle. */
cannam@99 321 unsigned int (*getMinChannelCount)(VampPluginHandle);
cannam@99 322
cannam@99 323 /** Get the maximum number of input channels this plugin can handle. */
cannam@99 324 unsigned int (*getMaxChannelCount)(VampPluginHandle);
cannam@99 325
cannam@99 326 /** Get the number of feature outputs (distinct sets of results). */
cannam@99 327 unsigned int (*getOutputCount)(VampPluginHandle);
cannam@99 328
cannam@99 329 /** Get a descriptor for a given feature output. Returned pointer
cannam@99 330 is valid only until next call to getOutputDescriptor for this
cannam@99 331 handle, or releaseOutputDescriptor for this descriptor. Host
cannam@99 332 must call releaseOutputDescriptor after use. */
cannam@99 333 VampOutputDescriptor *(*getOutputDescriptor)(VampPluginHandle,
cannam@99 334 unsigned int);
cannam@99 335
cannam@99 336 /** Destroy a descriptor for a feature output. */
cannam@99 337 void (*releaseOutputDescriptor)(VampOutputDescriptor *);
cannam@99 338
cannam@99 339 /** Process an input block and return a set of features. Returned
cannam@99 340 pointer is valid only until next call to process,
cannam@99 341 getRemainingFeatures, or cleanup for this handle, or
cannam@99 342 releaseFeatureSet for this feature set. Host must call
cannam@99 343 releaseFeatureSet after use. */
cannam@99 344 VampFeatureList *(*process)(VampPluginHandle,
cannam@99 345 const float *const *inputBuffers,
cannam@99 346 int sec,
cannam@99 347 int nsec);
cannam@99 348
cannam@99 349 /** Return any remaining features at the end of processing. */
cannam@99 350 VampFeatureList *(*getRemainingFeatures)(VampPluginHandle);
cannam@99 351
cannam@99 352 /** Release a feature set returned from process or getRemainingFeatures. */
cannam@99 353 void (*releaseFeatureSet)(VampFeatureList *);
cannam@99 354
cannam@99 355 } VampPluginDescriptor;
cannam@99 356
cannam@99 357
cannam@99 358 /** Get the descriptor for a given plugin index in this library.
cannam@99 359 Return NULL if the index is outside the range of valid indices for
cannam@99 360 this plugin library.
cannam@99 361
cannam@99 362 The hostApiVersion argument tells the library code the highest
cannam@99 363 Vamp API version supported by the host. The function should
cannam@99 364 return a plugin descriptor compatible with the highest API version
cannam@99 365 supported by the library that is no higher than that supported by
cannam@99 366 the host. Provided the descriptor has the correct vampApiVersion
cannam@99 367 field for its actual compatibility level, the host should be able
cannam@99 368 to do the right thing with it: use it if possible, discard it
cannam@99 369 otherwise.
cannam@99 370
cannam@99 371 This is the only symbol that a Vamp plugin actually needs to
cannam@99 372 export from its shared object; all others can be hidden. See the
cannam@99 373 accompanying documentation for notes on how to achieve this with
cannam@99 374 certain compilers.
cannam@99 375 */
cannam@99 376 const VampPluginDescriptor *vampGetPluginDescriptor
cannam@99 377 (unsigned int hostApiVersion, unsigned int index);
cannam@99 378
cannam@99 379
cannam@99 380 /** Function pointer type for vampGetPluginDescriptor. */
cannam@99 381 typedef const VampPluginDescriptor *(*VampGetPluginDescriptorFunction)
cannam@99 382 (unsigned int, unsigned int);
cannam@99 383
cannam@99 384 #ifdef __cplusplus
cannam@99 385 }
cannam@99 386 #endif
cannam@99 387
cannam@99 388 #endif