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@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@9
|
64 const char **valueNames;
|
cannam@0
|
65
|
cannam@0
|
66 } VampParameterDescriptor;
|
cannam@0
|
67
|
cannam@0
|
68 typedef enum
|
cannam@0
|
69 {
|
cannam@0
|
70 vampOneSamplePerStep,
|
cannam@0
|
71 vampFixedSampleRate,
|
cannam@0
|
72 vampVariableSampleRate
|
cannam@0
|
73
|
cannam@0
|
74 } VampSampleType;
|
cannam@0
|
75
|
cannam@0
|
76 typedef struct _VampOutputDescriptor
|
cannam@0
|
77 {
|
cannam@0
|
78 const char *name;
|
cannam@0
|
79 const char *description;
|
cannam@0
|
80 const char *unit;
|
cannam@9
|
81 int hasFixedBinCount;
|
cannam@9
|
82 unsigned int binCount;
|
cannam@9
|
83 const char **binNames;
|
cannam@0
|
84 int hasKnownExtents;
|
cannam@0
|
85 float minValue;
|
cannam@0
|
86 float maxValue;
|
cannam@0
|
87 int isQuantized;
|
cannam@0
|
88 float quantizeStep;
|
cannam@0
|
89 VampSampleType sampleType;
|
cannam@0
|
90 float sampleRate;
|
cannam@0
|
91
|
cannam@0
|
92 } VampOutputDescriptor;
|
cannam@0
|
93
|
cannam@0
|
94 typedef struct _VampFeature
|
cannam@0
|
95 {
|
cannam@0
|
96 int hasTimestamp;
|
cannam@0
|
97 int sec;
|
cannam@0
|
98 int nsec;
|
cannam@0
|
99 unsigned int valueCount;
|
cannam@0
|
100 float *values;
|
cannam@0
|
101 char *label;
|
cannam@0
|
102
|
cannam@0
|
103 } VampFeature;
|
cannam@0
|
104
|
cannam@0
|
105 typedef struct _VampFeatureList
|
cannam@0
|
106 {
|
cannam@0
|
107 unsigned int featureCount;
|
cannam@0
|
108 VampFeature *features;
|
cannam@0
|
109
|
cannam@0
|
110 } VampFeatureList;
|
cannam@0
|
111
|
cannam@0
|
112 typedef enum
|
cannam@0
|
113 {
|
cannam@0
|
114 vampTimeDomain,
|
cannam@0
|
115 vampFrequencyDomain
|
cannam@0
|
116
|
cannam@0
|
117 } VampInputDomain;
|
cannam@0
|
118
|
cannam@0
|
119 typedef void *VampPluginHandle;
|
cannam@0
|
120
|
cannam@0
|
121 typedef struct _VampPluginDescriptor
|
cannam@0
|
122 {
|
cannam@0
|
123 const char *name;
|
cannam@0
|
124 const char *description;
|
cannam@0
|
125 const char *maker;
|
cannam@0
|
126 int pluginVersion;
|
cannam@0
|
127 const char *copyright;
|
cannam@0
|
128 unsigned int parameterCount;
|
cannam@0
|
129 const VampParameterDescriptor **parameters;
|
cannam@0
|
130 unsigned int programCount;
|
cannam@0
|
131 const char **programs;
|
cannam@0
|
132 VampInputDomain inputDomain;
|
cannam@0
|
133
|
cannam@0
|
134 VampPluginHandle (*instantiate)(const struct _VampPluginDescriptor *,
|
cannam@0
|
135 float inputSampleRate);
|
cannam@0
|
136
|
cannam@0
|
137 void (*cleanup)(VampPluginHandle);
|
cannam@0
|
138
|
cannam@0
|
139 int (*initialise)(VampPluginHandle,
|
cannam@0
|
140 unsigned int inputChannels,
|
cannam@0
|
141 unsigned int stepSize,
|
cannam@0
|
142 unsigned int blockSize);
|
cannam@0
|
143
|
cannam@0
|
144 void (*reset)(VampPluginHandle);
|
cannam@0
|
145
|
cannam@0
|
146 float (*getParameter)(VampPluginHandle, int);
|
cannam@0
|
147 void (*setParameter)(VampPluginHandle, int, float);
|
cannam@0
|
148
|
cannam@0
|
149 unsigned int (*getCurrentProgram)(VampPluginHandle);
|
cannam@0
|
150 void (*selectProgram)(VampPluginHandle, unsigned int);
|
cannam@0
|
151
|
cannam@0
|
152 unsigned int (*getPreferredStepSize)(VampPluginHandle);
|
cannam@0
|
153 unsigned int (*getPreferredBlockSize)(VampPluginHandle);
|
cannam@0
|
154 unsigned int (*getMinChannelCount)(VampPluginHandle);
|
cannam@0
|
155 unsigned int (*getMaxChannelCount)(VampPluginHandle);
|
cannam@0
|
156
|
cannam@0
|
157 unsigned int (*getOutputCount)(VampPluginHandle);
|
cannam@0
|
158 VampOutputDescriptor *(*getOutputDescriptor)(VampPluginHandle,
|
cannam@0
|
159 unsigned int);
|
cannam@0
|
160 void (*releaseOutputDescriptor)(VampOutputDescriptor *);
|
cannam@0
|
161
|
cannam@0
|
162 VampFeatureList **(*process)(VampPluginHandle,
|
cannam@0
|
163 float **inputBuffers,
|
cannam@0
|
164 int sec,
|
cannam@0
|
165 int nsec);
|
cannam@0
|
166 VampFeatureList **(*getRemainingFeatures)(VampPluginHandle);
|
cannam@0
|
167 void (*releaseFeatureSet)(VampFeatureList **);
|
cannam@0
|
168
|
cannam@0
|
169 } VampPluginDescriptor;
|
cannam@0
|
170
|
cannam@0
|
171 const VampPluginDescriptor *vampGetPluginDescriptor(unsigned int index);
|
cannam@0
|
172
|
cannam@0
|
173 typedef const VampPluginDescriptor *(*VampGetPluginDescriptorFunction)(unsigned int);
|
cannam@0
|
174
|
cannam@0
|
175 #ifdef __cplusplus
|
cannam@0
|
176 }
|
cannam@0
|
177 #endif
|
cannam@0
|
178
|
cannam@0
|
179 #endif
|