annotate vamp/vamp.h @ 0:6479539d1b32

* Importing first cut of Sonic Visualiser's Vamp plugin format SDK
author cannam
date Fri, 31 Mar 2006 14:21:51 +0000
parents
children 8f10d35a4090
rev   line source
cannam@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@0 2
cannam@0 3 /*
cannam@0 4 Vamp
cannam@0 5
cannam@0 6 An API for audio analysis and feature extraction plugins.
cannam@0 7
cannam@0 8 Centre for Digital Music, Queen Mary, University of London.
cannam@0 9 Copyright 2006 Chris Cannam.
cannam@0 10
cannam@0 11 Permission is hereby granted, free of charge, to any person
cannam@0 12 obtaining a copy of this software and associated documentation
cannam@0 13 files (the "Software"), to deal in the Software without
cannam@0 14 restriction, including without limitation the rights to use, copy,
cannam@0 15 modify, merge, publish, distribute, sublicense, and/or sell copies
cannam@0 16 of the Software, and to permit persons to whom the Software is
cannam@0 17 furnished to do so, subject to the following conditions:
cannam@0 18
cannam@0 19 The above copyright notice and this permission notice shall be
cannam@0 20 included in all copies or substantial portions of the Software.
cannam@0 21
cannam@0 22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
cannam@0 23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
cannam@0 24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
cannam@0 25 NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR
cannam@0 26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
cannam@0 27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
cannam@0 28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
cannam@0 29
cannam@0 30 Except as contained in this notice, the names of the Centre for
cannam@0 31 Digital Music; Queen Mary, University of London; and Chris Cannam
cannam@0 32 shall not be used in advertising or otherwise to promote the sale,
cannam@0 33 use or other dealings in this Software without prior written
cannam@0 34 authorization.
cannam@0 35 */
cannam@0 36
cannam@0 37 #ifndef VAMP_HEADER_INCLUDED
cannam@0 38 #define VAMP_HEADER_INCLUDED
cannam@0 39
cannam@0 40 /*
cannam@0 41 * C language API for Vamp plugins.
cannam@0 42 *
cannam@0 43 * This is the formal plugin API for Vamp. Plugin authors may prefer
cannam@0 44 * to use the C++ classes defined in the sdk directory, instead of
cannam@0 45 * using this API directly. There is an adapter class provided that
cannam@0 46 * makes C++ plugins available using this C API with relatively little
cannam@0 47 * work. See the example plugins in the examples directory.
cannam@0 48 */
cannam@0 49
cannam@0 50 #ifdef __cplusplus
cannam@0 51 extern "C" {
cannam@0 52 #endif
cannam@0 53
cannam@0 54 typedef struct _VampParameterDescriptor
cannam@0 55 {
cannam@0 56 const char *name;
cannam@0 57 const char *description;
cannam@0 58 const char *unit;
cannam@0 59 float minValue;
cannam@0 60 float maxValue;
cannam@0 61 float defaultValue;
cannam@0 62 int isQuantized;
cannam@0 63 float quantizeStep;
cannam@0 64
cannam@0 65 } VampParameterDescriptor;
cannam@0 66
cannam@0 67 typedef enum
cannam@0 68 {
cannam@0 69 vampOneSamplePerStep,
cannam@0 70 vampFixedSampleRate,
cannam@0 71 vampVariableSampleRate
cannam@0 72
cannam@0 73 } VampSampleType;
cannam@0 74
cannam@0 75 typedef struct _VampOutputDescriptor
cannam@0 76 {
cannam@0 77 const char *name;
cannam@0 78 const char *description;
cannam@0 79 const char *unit;
cannam@0 80 int hasFixedValueCount;
cannam@0 81 unsigned int valueCount;
cannam@0 82 const char **valueNames;
cannam@0 83 int hasKnownExtents;
cannam@0 84 float minValue;
cannam@0 85 float maxValue;
cannam@0 86 int isQuantized;
cannam@0 87 float quantizeStep;
cannam@0 88 VampSampleType sampleType;
cannam@0 89 float sampleRate;
cannam@0 90
cannam@0 91 } VampOutputDescriptor;
cannam@0 92
cannam@0 93 typedef struct _VampFeature
cannam@0 94 {
cannam@0 95 int hasTimestamp;
cannam@0 96 int sec;
cannam@0 97 int nsec;
cannam@0 98 unsigned int valueCount;
cannam@0 99 float *values;
cannam@0 100 char *label;
cannam@0 101
cannam@0 102 } VampFeature;
cannam@0 103
cannam@0 104 typedef struct _VampFeatureList
cannam@0 105 {
cannam@0 106 unsigned int featureCount;
cannam@0 107 VampFeature *features;
cannam@0 108
cannam@0 109 } VampFeatureList;
cannam@0 110
cannam@0 111 typedef enum
cannam@0 112 {
cannam@0 113 vampTimeDomain,
cannam@0 114 vampFrequencyDomain
cannam@0 115
cannam@0 116 } VampInputDomain;
cannam@0 117
cannam@0 118 typedef void *VampPluginHandle;
cannam@0 119
cannam@0 120 typedef struct _VampPluginDescriptor
cannam@0 121 {
cannam@0 122 const char *name;
cannam@0 123 const char *description;
cannam@0 124 const char *maker;
cannam@0 125 int pluginVersion;
cannam@0 126 const char *copyright;
cannam@0 127 unsigned int parameterCount;
cannam@0 128 const VampParameterDescriptor **parameters;
cannam@0 129 unsigned int programCount;
cannam@0 130 const char **programs;
cannam@0 131 VampInputDomain inputDomain;
cannam@0 132
cannam@0 133 VampPluginHandle (*instantiate)(const struct _VampPluginDescriptor *,
cannam@0 134 float inputSampleRate);
cannam@0 135
cannam@0 136 void (*cleanup)(VampPluginHandle);
cannam@0 137
cannam@0 138 int (*initialise)(VampPluginHandle,
cannam@0 139 unsigned int inputChannels,
cannam@0 140 unsigned int stepSize,
cannam@0 141 unsigned int blockSize);
cannam@0 142
cannam@0 143 void (*reset)(VampPluginHandle);
cannam@0 144
cannam@0 145 float (*getParameter)(VampPluginHandle, int);
cannam@0 146 void (*setParameter)(VampPluginHandle, int, float);
cannam@0 147
cannam@0 148 unsigned int (*getCurrentProgram)(VampPluginHandle);
cannam@0 149 void (*selectProgram)(VampPluginHandle, unsigned int);
cannam@0 150
cannam@0 151 unsigned int (*getPreferredStepSize)(VampPluginHandle);
cannam@0 152 unsigned int (*getPreferredBlockSize)(VampPluginHandle);
cannam@0 153 unsigned int (*getMinChannelCount)(VampPluginHandle);
cannam@0 154 unsigned int (*getMaxChannelCount)(VampPluginHandle);
cannam@0 155
cannam@0 156 unsigned int (*getOutputCount)(VampPluginHandle);
cannam@0 157 VampOutputDescriptor *(*getOutputDescriptor)(VampPluginHandle,
cannam@0 158 unsigned int);
cannam@0 159 void (*releaseOutputDescriptor)(VampOutputDescriptor *);
cannam@0 160
cannam@0 161 VampFeatureList **(*process)(VampPluginHandle,
cannam@0 162 float **inputBuffers,
cannam@0 163 int sec,
cannam@0 164 int nsec);
cannam@0 165 VampFeatureList **(*getRemainingFeatures)(VampPluginHandle);
cannam@0 166 void (*releaseFeatureSet)(VampFeatureList **);
cannam@0 167
cannam@0 168 } VampPluginDescriptor;
cannam@0 169
cannam@0 170 const VampPluginDescriptor *vampGetPluginDescriptor(unsigned int index);
cannam@0 171
cannam@0 172 typedef const VampPluginDescriptor *(*VampGetPluginDescriptorFunction)(unsigned int);
cannam@0 173
cannam@0 174 #ifdef __cplusplus
cannam@0 175 }
cannam@0 176 #endif
cannam@0 177
cannam@0 178 #endif