annotate vamp/vamp.h @ 18:b4043af42278

* Some textual changes
author cannam
date Mon, 10 Apr 2006 10:31:19 +0000
parents a3d35e11c3fe
children e252b1ab423f
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@6 25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS 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@18 44 * to use the C++ classes provided in the Vamp plugin SDK, 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@18 47 * work, and the C++ headers are thoroughly documented.
cannam@0 48 */
cannam@0 49
cannam@0 50 #ifdef __cplusplus
cannam@0 51 extern "C" {
cannam@0 52 #endif
cannam@0 53
cannam@18 54 /**
cannam@18 55 * Plugin API version. Incompatible changes to the API may be expected
cannam@18 56 * prior to version 1.0.
cannam@18 57 */
cannam@18 58 #define VAMP_API_VERSION "0.2"
cannam@18 59 #define VAMP_API_VERSION_MAJOR 0
cannam@18 60 #define VAMP_API_VERSION_MINOR 2
cannam@18 61
cannam@0 62 typedef struct _VampParameterDescriptor
cannam@0 63 {
cannam@0 64 const char *name;
cannam@0 65 const char *description;
cannam@0 66 const char *unit;
cannam@0 67 float minValue;
cannam@0 68 float maxValue;
cannam@0 69 float defaultValue;
cannam@0 70 int isQuantized;
cannam@0 71 float quantizeStep;
cannam@9 72 const char **valueNames;
cannam@0 73
cannam@0 74 } VampParameterDescriptor;
cannam@0 75
cannam@0 76 typedef enum
cannam@0 77 {
cannam@0 78 vampOneSamplePerStep,
cannam@0 79 vampFixedSampleRate,
cannam@0 80 vampVariableSampleRate
cannam@0 81
cannam@0 82 } VampSampleType;
cannam@0 83
cannam@0 84 typedef struct _VampOutputDescriptor
cannam@0 85 {
cannam@0 86 const char *name;
cannam@0 87 const char *description;
cannam@0 88 const char *unit;
cannam@9 89 int hasFixedBinCount;
cannam@9 90 unsigned int binCount;
cannam@9 91 const char **binNames;
cannam@0 92 int hasKnownExtents;
cannam@0 93 float minValue;
cannam@0 94 float maxValue;
cannam@0 95 int isQuantized;
cannam@0 96 float quantizeStep;
cannam@0 97 VampSampleType sampleType;
cannam@0 98 float sampleRate;
cannam@0 99
cannam@0 100 } VampOutputDescriptor;
cannam@0 101
cannam@0 102 typedef struct _VampFeature
cannam@0 103 {
cannam@0 104 int hasTimestamp;
cannam@0 105 int sec;
cannam@0 106 int nsec;
cannam@0 107 unsigned int valueCount;
cannam@0 108 float *values;
cannam@0 109 char *label;
cannam@0 110
cannam@0 111 } VampFeature;
cannam@0 112
cannam@0 113 typedef struct _VampFeatureList
cannam@0 114 {
cannam@0 115 unsigned int featureCount;
cannam@0 116 VampFeature *features;
cannam@0 117
cannam@0 118 } VampFeatureList;
cannam@0 119
cannam@0 120 typedef enum
cannam@0 121 {
cannam@0 122 vampTimeDomain,
cannam@0 123 vampFrequencyDomain
cannam@0 124
cannam@0 125 } VampInputDomain;
cannam@0 126
cannam@0 127 typedef void *VampPluginHandle;
cannam@0 128
cannam@0 129 typedef struct _VampPluginDescriptor
cannam@0 130 {
cannam@0 131 const char *name;
cannam@0 132 const char *description;
cannam@0 133 const char *maker;
cannam@0 134 int pluginVersion;
cannam@0 135 const char *copyright;
cannam@0 136 unsigned int parameterCount;
cannam@0 137 const VampParameterDescriptor **parameters;
cannam@0 138 unsigned int programCount;
cannam@0 139 const char **programs;
cannam@0 140 VampInputDomain inputDomain;
cannam@0 141
cannam@0 142 VampPluginHandle (*instantiate)(const struct _VampPluginDescriptor *,
cannam@0 143 float inputSampleRate);
cannam@0 144
cannam@0 145 void (*cleanup)(VampPluginHandle);
cannam@0 146
cannam@0 147 int (*initialise)(VampPluginHandle,
cannam@0 148 unsigned int inputChannels,
cannam@0 149 unsigned int stepSize,
cannam@0 150 unsigned int blockSize);
cannam@0 151
cannam@0 152 void (*reset)(VampPluginHandle);
cannam@0 153
cannam@0 154 float (*getParameter)(VampPluginHandle, int);
cannam@0 155 void (*setParameter)(VampPluginHandle, int, float);
cannam@0 156
cannam@0 157 unsigned int (*getCurrentProgram)(VampPluginHandle);
cannam@0 158 void (*selectProgram)(VampPluginHandle, unsigned int);
cannam@0 159
cannam@0 160 unsigned int (*getPreferredStepSize)(VampPluginHandle);
cannam@0 161 unsigned int (*getPreferredBlockSize)(VampPluginHandle);
cannam@0 162 unsigned int (*getMinChannelCount)(VampPluginHandle);
cannam@0 163 unsigned int (*getMaxChannelCount)(VampPluginHandle);
cannam@0 164
cannam@0 165 unsigned int (*getOutputCount)(VampPluginHandle);
cannam@0 166 VampOutputDescriptor *(*getOutputDescriptor)(VampPluginHandle,
cannam@0 167 unsigned int);
cannam@0 168 void (*releaseOutputDescriptor)(VampOutputDescriptor *);
cannam@0 169
cannam@12 170 VampFeatureList *(*process)(VampPluginHandle,
cannam@0 171 float **inputBuffers,
cannam@0 172 int sec,
cannam@0 173 int nsec);
cannam@12 174 VampFeatureList *(*getRemainingFeatures)(VampPluginHandle);
cannam@12 175 void (*releaseFeatureSet)(VampFeatureList *);
cannam@0 176
cannam@0 177 } VampPluginDescriptor;
cannam@0 178
cannam@0 179 const VampPluginDescriptor *vampGetPluginDescriptor(unsigned int index);
cannam@0 180
cannam@0 181 typedef const VampPluginDescriptor *(*VampGetPluginDescriptorFunction)(unsigned int);
cannam@0 182
cannam@0 183 #ifdef __cplusplus
cannam@0 184 }
cannam@0 185 #endif
cannam@0 186
cannam@0 187 #endif